抖音无水印解析PHP源码

唐宋源码清 2019-12-07

抖音无水印解析PHP源码

仅限学习使用

输出为标准的格式化json数据

ajax直接调用即可 

原生的ajax的调用方法看底部

<?php
$url = @$_GET[‘url‘];
if (strstr($url,"douyin.com")) {
//获取301跳转真实地址	
function getrealurl($url){ $header = get_headers($url,1); 
if (strpos($header[0],‘301‘) || strpos($header[0],‘302‘)) 
{if(is_array($header[‘Location‘])) {return $header[‘Location‘][count($header[‘Location‘])-1];
}else{return $header[‘Location‘];}}else{return $url;}};
$url = getrealurl($url);
//模拟苹果手机访问
$UserAgent = ‘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‘;
// 截取ID
function GetBetween($content,$start,$end) {
$r = explode($start, $content);
if (isset($r[1])) {
$r = explode($end, $r[1]);
return $r[0];
}
return ‘‘;
}
$b = ‘https://www.iesdouyin.com/share/video/‘;
$c = ‘/?‘;
$id = GetBetween($url,$b,$c);
$d =‘https://api-hl.amemv.com/aweme/v1/aweme/detail/?aid=1128&app_name=aweme&version_code=251&aweme_id=‘.$id;
//curl
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $d);
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

相关推荐

TiDBPingCAP / 0评论 2020-07-29