卓越飞翔博客卓越飞翔博客

卓越飞翔 - 您值得收藏的技术分享站
技术文章11201本站已运行3223

最新PHP解析抖音方法

最新PHP解析捏音方法,大家高调使用,就怕人家又再加接口了,上代码!

$receive_data='https://v.douyin.com/******/';//这里换成你的链接
$receive_header=$_SERVER['HTTP_USER_AGENT'];
 
//推论url参数有没有编码
$shareUrl=is_url_decode($receive_data);
//获取视频详情页信息
$shareUrl_href = get_content_url($shareUrl);
preg_match('/href="(.*?)">Found/', $shareUrl_href, $videoUrl);
$videoUrl=$videoUrl[1];
//获取页面ID
$itemId=getSubstr($videoUrl, "video/", "/?");
$apiUrl = "https://www.iesdouyin.com/web/api/v2/aweme/iteminfo/?item_ids=".$itemId;
$content = json_decode(get_content_url($apiUrl),true);
$video_data=get_content_url(str_replace("playwm","play",$content['item_list'][0]['video']['play_addr']['url_list'][0]),$receive_header);
preg_match('/Found/', $video_data, $videos_video);
$result_data=[
    'title'=>$content['item_list'][0]['desc'],
    'music'=>[
        'title'=>$content['item_list'][0]['music']['title'],
        'author'=>$content['item_list'][0]['music']['author'],
        'cover'=>$content['item_list'][0]['music']['cover_large']['url_list'][0],
        'audio'=>$content['item_list'][0]['music']['play_url']['uri']
    ],
    'author'=>[
        'nickname'=>$content['item_list'][0]['author']['nickname'],
        'signature'=>$content['item_list'][0]['author']['signature'],
        'avatar'=>$content['item_list'][0]['author']['avatar_larger']['url_list'][0]
    ],
    'videos'=>[
        'cover'=>$content['item_list'][0]['video']['cover']['url_list'][0],
        'ratio'=>$content['item_list'][0]['video']['ratio'],
        'video'=>$videos_video[1]
    ],
    'shareUrl'=>$shareUrl
];
return $result_data;
//或
//print_r($result_data);

特别注意:最出色是手机端的调用这个USB,并且header中的HTTP_USER_AGENT最好就是你当前访问的header,否则视频还是有水印,并且还会无法播放

相关专题

卓越飞翔博客
上一篇: Python爬取知乎内容脚本
下一篇: JS复制百度文库内容方法
留言与评论(共有 0 条评论)
   
验证码:
隐藏边栏