抖音无水印PHP直连解析下载代码

2018-12-08 17:39:38 作者: 邵先森 浏览: 1206

抖音无水印PHP直连解析下载代码
整个思路就是获取抖音分享链接的源码取出视频链接去除水印就行了
然后新建PHP文件保存,http://域名/文件名.php?url=抖音分享链接
实例:http://lanyou.vip/dy/

PHP完整代码:
  1. <?php
  2. $url = @$_GET['url'];
  3. $UserAgent = 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; SLCC1; .NET CLR 2.0.50727; .NET CLR 3.0.04506; .NET CLR 3.5.21022; .NET CLR 1.0.3705; .NET CLR 1.1.4322)';
  4. $curl = curl_init();
  5. curl_setopt($curl, CURLOPT_URL, $url);
  6. curl_setopt($curl, CURLOPT_HEADER, 0);
  7. curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
  8. curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
  9. curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
  10. curl_setopt($curl, CURLOPT_ENCODING, '');
  11. curl_setopt($curl, CURLOPT_USERAGENT, $UserAgent);
  12. curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
  13. //设置这个选项为一个非零值(象 “Location: “)的头,服务器会把它当做HTTP头的一部分发送(注意这是递归的,PHP将发送形如 “Location: “的头)。
  14. $data = curl_exec($curl);
  15. curl_close($curl);
  16. $a = $data;
  17. $b = "playAddr: \"";
  18. $c = "\"";
  19. $s = GetBetween($a,$b,$c);
  20. function GetBetween($content,$start,$end) {
  21. $r = explode($start, $content);
  22. if (isset($r[1])) {
  23. $r = explode($end, $r[1]);
  24. return $r[0];
  25. }
  26. return '';
  27. }
  28. $surl = str_replace("playwm",'play' ,$s);
  29. $b = '

    ';

  30. $c = '

    ';
  31. $name = GetBetween($a,$b,$c);
  32. function unicodeDecode($name) {
  33. $json = '{"str":"'.$name.'"}';
  34. $arr = json_decode($json,true);
  35. if (empty($arr)) return '';
  36. return $arr['str'];
  37. }
  38. $name = unicodeDecode($name);
  39. $b = "desc\">";
  40. $c = "<";
  41. $txt = GetBetween($a,$b,$c);
  42. $txt = unicodeDecode($txt);
  43. $b = "/aweme/100x100/";
  44. $c = "\"";
  45. $namejpg = GetBetween($a,$b,$c);
  46. $namejpg = 'https://p3.pstatp.com/aweme/200x200/'.$namejpg;
  47. if (strstr($url,"douyin.com")) {
  48. echo "
    分享用户:".$name."
    ";
  49. echo "
    ";
  50. echo "分享说明: ". $txt. "
    ";
  51. $time = date('YmdHis');
  52. echo '视频地址: '. $surl. ' 播放 下载 复制链接
  • function copyUrl2() {
  • var Url2 = document.getElementById("biao1");
  • Url2.select();
  • document.execCommand("Copy");
  • alert("已复制好,可贴粘。");
  • }
  • ';
  • } else
  • {
  • echo '请输入抖音分享的地址,如:http://v.douyin.com/eRcTtj/';
  • }
  • ?>

  • 评论
    本文作者 阅读排行 文章推荐

    首页
    最新
    投稿
    精选
    我的