解析腾讯视频真实地址
标签(空格分隔): php
分析
1 我们从腾讯视频上找到的网页链接格式是这样的
https://v.qq.com/x/page/b0136et5ztz.html
vid = b0136et5ztz
2 把vid放单到接口上
http://vv.video.qq.com/getinfo?vids=b0136et5ztz&platform=101001&charge=0&otype=json
3 php发送curl请求
QZOutputJson={"dltype":1,"exem":0,"fl":{"cnt":2,"fi":[{"id":100701,"name":"msd","lmt":0,"sb":1,"cname":"标清;(270P)","br":29,"profile":2,"drm":0,"video":1,"audio":1,"fs":35776912,"sl":1},{"id":2,"name":"mp4","lmt":0,"sb":1,"cname":"高清;(480P)","br":34,"profile":1,"drm":0,"video":1,"audio":1,"fs":74129447,"sl":0}]},"hs":0,"ip":"106.34.147.20","ls":0,"preview":1186,"s":"o","sfl":{"cnt":0},"tm":1534655232,"vl":{"cnt":1,"vi":[{"br":29,"ch":0,"cl":{"fc":0,"keyid":"b0136et5ztz.100701"},"ct":21600,"drm":0,"dsb":0,"fmd5":"87d7d2ef15f55a456bcdb359dd580795","fn":"b0136et5ztz.m701.mp4","fs":35776912,"fst":5,"fvkey":"40548D2700B697C2819E6821B6921EBB0F69BA24C3CDCCB1266447F91632D099BB54C11C40F651D63B97D5E165A948F69408C68D5780E56CAF3A8F2016CF712471F3CB3C882A4884B047EF3EC95EA265B38B43F0550E9D38F6C054E4BAFD5AAD81D084DB0A8372BB","head":0,"hevc":0,"iflag":0,"level":0,"lnk":"b0136et5ztz","logo":1,"mst":8,"pl":null,"share":1,"sp":0,"st":2,"tail":0,"td":"1186.92","ti":"解密潮汕多神信仰","tie":0,"type":3,"ul":{"ui":[{"url":"h*ttp://ugcws.video.gtimg.com/uwMRJfz-r5jAYaQXGdGnC2_ppdhgmrDlPaRvaV7F2Ic/*","vt":106,"dtc":0,"dt":2},{"url":"http://106.42.24.23/vhot2.qqvideo.tc.qq.com/AQoGsaMTX3SIQg301S_QauBdpyU-zT0TnVHKmgEswDkQ/","vt":200,"dtc":0,"dt":2},{"url":"http://ugclx.video.gtimg.com/uwMRJfz-r5jAYaQXGdGlAxqAgTq-niFnH3vfzZVGqxw/","vt":156,"dtc":0,"dt":2},{"url":"http://video.dispatch.tc.qq.com/","vt":0,"dtc":0,"dt":2}]},"vh":272,"vid":"b0136et5ztz","videotype":27,"vr":0,"vst":2,"vw":480,"wh":1.7647059,"wl":{"wi":[]},"uptime":1410505772,"fvideo":0,"fvpint":0}]}};
去除 QZOutputJson= 和 最后的分号就行json解析
取出:url [第一个url] | fn | vkey
真实地址:url + fn + ‘?vkey=‘ + fvkey
代码
$url = ‘http://vv.video.qq.com/getinfo?vids=b0136et5ztz&platform=101001&charge=0&otype=json‘;
$tencentVideoInfo = curl_request($url);
$tencentVideoJson = substr(explode(‘QZOutputJson=‘,$tencentVideoInfo)[1],0,-1);
$tencentVideoArray = json_decode($tencentVideoJson,true);
$fvkey = $tencentVideoArray[‘vl‘][‘vi‘][0][‘fvkey‘];
$fn = $tencentVideoArray[‘vl‘][‘vi‘][0][‘fn‘];
$url = $tencentVideoArray[‘vl‘][‘vi‘][0][‘ul‘][‘ui‘][0][‘url‘];
$video_url = $url.$fn.‘?vkey=‘.$fvkey;
return json(200, $video_url);
json数据
{
"code": 200,
"msg": "获取数据成功!",
"data": "http://ugcbsy.qq.com/uwMRJfz-r5jAYaQXGdGnC2_ppdhgmrDlPaRvaV7F2Ic/b0136et5ztz.m701.mp4?vkey=13DF1CA5CA214BCAB53C896CCA9541644FCB76176007AE9DAD8406F4FB134821DD93791EC4B6BCBFF26C0AF5648793A6D54C4E00D70C95E9D2FABC224C86FA9836A6251B89B8B16568F1FB2A7397D3A35C17E82E89A2090FEAC96D7376D66B0C0846E898579D27EB"
}
原文地址:https://www.cnblogs.com/yanweifeng/p/9501029.html
时间: 2024-10-14 11:32:36