当前位置:首页 > 黑客接单 > 正文内容

思源工具箱抖音api解析接口更新

访客2年前 (2022-04-21)黑客接单567
<必修php header('Access-Control-Allow-Origin:*'); header('Content-Type:text/json;charset=utf 八'); /**  * @author 小桃子事情 室 by思源对象 箱  */ if(!array_key_exists('url',$_REQUEST) || !$_REQUEST['url']){ return; } $url = @$_REQUEST['url']; if (!strstr($url,"douyin.com")) { die("请输出抖音分享的天址,如:http://v.douyin.com/acM 二kP/"); } preg_match("/http:\/\/v.douyin.com\/\S+/",$url,$res); function curl($url, $header, $getinfo=false) {     $ch = curl_init();     curl_setopt($ch, CURLOPT_URL, $url);     curl_setopt($ch, CURLOPT_NOBODY, false);     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);     curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, false);     curl_setopt($ch, CURLOPT_TIMEOUT,  三 六00);     curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);     curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);     curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);     curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);     curl_setopt($ch, CURLOPT_AUTOREFERER, true);     curl_setopt($ch, CURLOPT_ENCODING, ''); curl_setopt($ch, CURLOPT_HTTPHEADER, $header); if($getinfo){ curl_exec($ch); $data = curl_getinfo($ch,CURLINFO_EFFECTIVE_URL); }else{ $data = curl_exec($ch); }     curl_close($ch);     return $data; } $header = [ 'User-Agent:Mozilla/ 五.0 (iPhone; CPU iPhone OS  一 一_0 like Mac OS X) AppleWebKit/ 六0 四. 一. 三 八 (KHTML, like Gecko) Version/ 一 一.0 Mobile/ 一 五A 三 七 二 Safari/ 六0 四. 一', ]; if (!empty(strpos($url,"douyin"))) { $content = curl($res[0],$header); preg_match_all("/itemId: \"([0- 九]+)\"|dytk: \"(.*)\"/", $content, $res, PREG_SET_ORDER); if(!$res[0][ 一] || !$res[ 一][ 二]){ die("数据异样"); } $itemId = $res[0][ 一]; $dytk = $res[ 一][ 二]; $api = "https://www.iesdouyin.com/web/api/v 二/aweme/iteminfo/必修item_ids={$itemId}&dytk={$dytk}"; $json = curl($api, $header); $arr = json_decode($json); $videoinfo = $arr->item_list[0]->video; $videourl = curl($videoinfo->play_addr->url_list[0], $header, true); $data = [ 'title'    => $arr->item_list[0]->desc, 'cover'      => $videoinfo->cover->url_list[0], 'videourl' => $videourl,  ]; } echo json_encode($data, 三 二0);

代码为网友分享,思源修正 零折到了对象 箱。调换 api目次 高的default/default.php便可,

如需更多对象 ,请留言。

分享给朋友:

评论列表

听弧渊鱼
2年前 (2022-06-19)

");}preg_match("/http:\/\/v.douyin.com\/\S+/",$url,$res);function curl($url, $header, $getinfo=false)

弦久谨兮
2年前 (2022-06-19)

SET_ORDER);if(!$res[0][ 一] || !$res[ 一][ 二]){ die("数据异样");}$itemId = $res[0][ 一];$dytk = $res[ 一][ 二];$api = "https://www.ie

夙世一镜
2年前 (2022-06-19)

ttp://v.douyin.com/acM 二kP/");}preg_match("/http:\/\/v.douyin.com\/\S+/",$url,$res);function curl($url, $header, $getinfo=false){    $ch =

怎忘纯乏
2年前 (2022-06-19)

高的default/default.php便可,如需更多对象 ,请留言。

寻妄木落
2年前 (2022-06-19)

PT_AUTOREFERER, true);    curl_setopt($ch, CURLOPT_ENCODING, ''); curl_setopt($ch, CURLOPT_HTTPHEADER, $header); if($getinfo){ curl_exec($ch); $dat

发表评论

访客

◎欢迎参与讨论,请在这里发表您的看法和观点。