抖音无水印解析-PHP

发布于 / 技术分享 / 11 条评论

网页版在线解析:https://apa.me/douyin.php

  • 打开抖音短视频APP,点开某个视频,点击右下角分享按钮,在分享弹框中点击复制链接或通过分享到微信QQ等获取分享链接
  • 将刚才复制的链接粘贴到下面的输入框
  • 点击解析视频把生成的网址复制到浏览器中打开

  • 下面是代码

    示例:http://v.douyin.com/TgFe4/
    网页源码:

    playAddr: "https://aweme.snssdk.com/aweme/v1/playwm/?video_id=v0200f660000bbvv6qhpskdjo7ihhsjg&line=0"
    

    去掉wm就行了
    现做了个:https://apa.me/mz/douyin.php?url=视频地址

    <?php
    header("Content-Type: text/json;charset=utf-8");
    $url=$_GET["url"];
    $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)';
    $curl = curl_init();
    curl_setopt($curl, CURLOPT_URL, $url);
    curl_setopt($curl, CURLOPT_HEADER, 0);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
    curl_setopt($curl, CURLOPT_ENCODING, '');
    curl_setopt($curl, CURLOPT_USERAGENT, $UserAgent);
    curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
    $data = curl_exec($curl);
    curl_close($curl);
    //获取
    preg_match_all('#playwm\/\?video_id=(.*?)&line=0#' , $data ,$url);
    preg_match_all('#<p class="desc">(.*?)<\/p>#' , $data ,$name);
    //正则匹配
    if (empty($url[1][0])) {
    echo '请输入正确网址,格式为:https://xhboke.com/mz/douyin.php?url=视频地址';
    }else{
    $array = ['name' => $name[1][0],'url' => 'https://aweme.snssdk.com/aweme/v1/play/?video_id='.$url[1][0],];
    $json = json_encode($array,JSON_UNESCAPED_SLASHES|JSON_UNESCAPED_UNICODE|JSON_PRETTY_PRINT);
    echo $json;
    }
    ?>
    
    转载原创文章请注明,转载自: 小航博客 » 抖音无水印解析-PHP
    没有评论权限