抖音短视频去水印PHP源码

2020年04月28日

转自hostloc论坛
这个是利用抖音官方api接口来去除短视频水印的方法,这里做个记录。

    <?php
    //by 勤勤学长
    //使用方法 域名/dyapi.php?url=https://v.douyin.com/TudRFh/
     
            $url = $_GET['url'];
            $res = qqxz_http_get($url);
            preg_match('/href="(.*?)">Found/', $res, $matches);
            $Xurl = str_replace('&', '&', $matches[1]);
            $res = qqxz_http_get($Xurl);
            preg_match('/itemId: "(.*?)",/', $res, $matches);
            $itemId = $matches[1];
            $url = 'https://www.iesdouyin.com/web/api/v2/aweme/iteminfo/?item_ids=' . $itemId;
            $res = qqxz_http_get($url);
            $arr = json_decode($res, true);//作品信息获取
            $play_addr_url = $arr['item_list'][0]["video"]["play_addr"]["url_list"][0];
            $res = qqxz_http_get($play_addr_url);
            preg_match('/href="(.*?)">Found/', $res, $matches);
            $videoUrl = str_replace('&', '&', $matches[1]);
            $douyin = ['code' => 1, 'url' => $videoUrl];
            echo json_encode($douyin);

           function qqxz_http_get($url)
    {
        $Header=array( "User-Agent:Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1");
        $con=curl_init((string)$url);
        curl_setopt($con,CURLOPT_HEADER,False);
        curl_setopt($con,CURLOPT_SSL_VERIFYPEER,False);
        curl_setopt($con,CURLOPT_RETURNTRANSFER,true);
        curl_setopt($con,CURLOPT_HTTPHEADER,$Header);
        curl_setopt($con,CURLOPT_TIMEOUT,5000);
        $result = curl_exec($con);
        return $result;
    }
    ?>


sicnature ---------------------------------------------------------------------
Your current IP address is: 18.206.187.81
Your IP address location: 美国 弗吉尼亚州阿什本amazon数据中心
Your IP address country and region: 美国 美国
Your current browser is:
Your current system is:
Original content, please indicate the source:
同福客栈论坛 | 蟒蛇科普海南乡情论坛 | JiaYu Blog
sicnature ---------------------------------------------------------------------
Welcome to reprint. Please indicate the source http://myzhenai.com.cn/post/3286.html

没有评论

发表评论

电子邮件地址不会被公开。 必填项已用*标注