立即注册 找回密码

QQ登录

只需一步,快速开始

查看: 4551|回复: 2

[Html 教程] 优酷土豆腾讯视频html地址转flash swf地址的方法

[复制链接]
发表于 2018-1-6 02:53:17 | 显示全部楼层 |阅读模式
道勤网-数据www.daoqin.net

亲注册登录道勤网-可以查看更多帖子内容哦!(包涵精彩图片、文字详情等)请您及时注册登录-www.daoqin.net

您需要 登录 才可以下载或查看,没有账号?立即注册

x
很多用户不知道如何复制flash地址,只能在程序中帮他们替换了:
  1. <?php
  2. /**
  3. * 支持优酷、土豆、腾讯视频html到swf转换
  4. * @link http://www.phpddt.com
  5. */
  6. function convert_html_to_swf($url = '')
  7. {
  8. if(!is_string($url) || empty($url)) return ;
  9. if(strpos($url, 'swf')) return $url;
  10. preg_match_all('/http:\/\/(.*?)?\.(.*?)?\.com\/(.*)/', $url, $types);
  11. $type = $types[2][0];
  12. $domain = $types[1][0];

  13. switch ($type) {
  14. case 'youku' :
  15. preg_match_all('/http:\/\/v\.youku\.com\/v_show\/id_(.*)?\.html/', $url, $url_array);
  16. $swf = 'http://player.youku.com/player.php/sid/' . str_replace('/', '', $url_array[1][0]) . '/v.swf';
  17. break;
  18. case 'tudou' :
  19. $method = substr($types[3][0], 0, 1);
  20. $method = $method == 'p' ? 'v' : $method;
  21. preg_match_all('/http:\/\/www.tudou\.com\/(.*)?\/(.*)?/', $url, $url_array);
  22. $str_arr = explode('/', $url_array[1][0]);
  23. $count = count($str_arr);
  24. if ($count == 1) {
  25. $id = explode('.', $url_array[2][0]);
  26. $id = $id[0];
  27. } else if ($count == 2) {
  28. $id = $str_arr[1];
  29. } else if ($count == 3) {
  30. $id = $str_arr[2];
  31. }
  32. $swf = 'http://www.tudou.com/' . $method . '/' . $id . '/v.swf';
  33. break;
  34. case 'qq' :
  35. $url_array = parse_url($url);
  36. $swf = "http://static.video.qq.com/TPout.swf?{$url_array['query']}&auto=0";
  37. break;

  38. default :
  39. $swf = $url;
  40. break;
  41. }
  42. return $swf;
  43. }


  44. /**
  45. * 优酷视频转换测试
  46. * html地址 http://v.youku.com/v_show/id_XNzU4Mzg2NDA4.html?f=22720170&ev=2&from=y1.1-2.10001-0.1-2
  47. * swf地址 http://player.youku.com/player.php/sid/XNzU4Mzg2NDA4/v.swf
  48. */

  49. echo convert_html_to_swf("http://v.youku.com/v_show/id_XNzU4Mzg2NDA4.html?f=22720170&ev=2&from=y1.1-2.10001-0.1-2");
  50. echo "<hr>";

  51. /**
  52. * 腾讯视频转换测试
  53. *
  54. * html地址 http://v.qq.com/cover/w/w5lb270k15j7ita.html?vid=v0015mnd5x6
  55. * swf地址 http://static.video.qq.com/TPout.swf?vid=v0015mnd5x6&auto=0
  56. */

  57. echo convert_html_to_swf("http://v.qq.com/cover/w/w5lb270k15j7ita.html?vid=v0015mnd5x6");
  58. echo "<hr>";

  59. /**
  60. * 土豆视频转换测试
  61. *
  62. * html地址 http://www.tudou.com/albumplay/hqtp6W5XLN8/Kscjyz4J-RE.html
  63. * swf地址 http://www.tudou.com/a/hqtp6W5XLN8/&iid=132223533&resourceId=0_04_0_99/v.swf
  64. */

  65. echo convert_html_to_swf("http://www.tudou.com/albumplay/hqtp6W5XLN8/Kscjyz4J-RE.html");
  66. echo "<hr>";
复制代码


道勤主机提供365天*24小时全年全天无休、实时在线、零等待的售后技术支持。竭力为您免费处理您在使用道勤主机过程中所遇到的一切问题! 如果您是道勤主机用户,那么您可以通过QQ【792472177】、售后QQ【59133755】、旺旺【诠释意念】、微信:q792472177免费电话、后台提交工单这些方式联系道勤主机客服! 如果您不是我们的客户也没问题,点击页面最右边的企业QQ在线咨询图标联系我们并购买后,我们为您免费进行无缝搬家服务,让您享受网站零访问延迟的迁移到道勤主机的服务!
 楼主| 发表于 2018-7-6 14:55:34 | 显示全部楼层
道勤网-数据www.daoqin.net
兴隆 发表于 2018-6-26 19:15
真是难得给力的帖子啊。

http://www.hunterbj.com/Article/nm.html

看到这帖子真是高兴!非常感谢道勤的老师,太感谢了
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

道勤网- 推荐内容!上一条 /2 下一条

!jz_fbzt! !jz_sgzt! !jz_xgzt! 快速回复 !jz_fhlb! !jz_lxwm! !jz_gfqqq!

关于我们|手机版|小黑屋|地图|【道勤网】-www.daoqin.net 软件视频自学教程|免费教程|自学电脑|3D教程|平面教程|影视动画教程|办公教程|机械设计教程|网站设计教程【道勤网】 ( 皖ICP备15000319号-1 )

GMT+8, 2024-3-29 21:14

Powered by DaoQin! X3.4 © 2016-2063 Dao Qin & 道勤科技

快速回复 返回顶部 返回列表