手工解析腾讯视频真实 url 地址
最近因为开发微信小程序的原因,需要在小程序中播放腾讯视频,但是我们无法像公众号写文章那样直接填入视频地址就可以播放,因此我们必须通过其他手段解析出真实的的url才行。
我们先在腾讯视频上找个需要解析的目标视频,如下:
v.qq/x/page/l0167dtse0d.html
其中 l0167dtse0d 是该视频的id
现在,我们把 l0167dtse0d 值作为 vids 的值,传递全日制参数,获取我们需要的json
vv.qq/getinfo?vids=l0167dtse0d&platform=101001&charge=0&otype=json&defn=shd
获取的json如下:
QZOutputJson={"dltype":1,"exem":0,"fl":{"cnt":2,"fi":[{"id":100701,"name":"msd","lmt":0,"sb":1,"cname":"标清;(270P)","br":26,"profile":2,"drm":0,"video":1,"audio":1,"fs":1689378,"sl":1},{"id":2,"name":"mp4","lmt":0,"sb":1,"cname":"高清;(480P)","br":31,"profile":1,"drm":0,"video":1,"audio":1,"fs":3834360,"sl":0}]},"hs":0,"ip":"49.74.255.55","ls":0,"preview":62,"s":"o","sfl":{"cnt":0},"tm":1538742726,"vl":{"cnt":1,"vi":[{"br":26,"ch":0,"cl":{"fc":0,"keyid":"l0167dtse0d.100701"},"ct":21600,"drm":0,"dsb":0,"fmd5":"d13f05640be11412828e70af85d1b7ec","fn":"l0167dtse0d.m701.mp4","fs":1689378,"fst":5,"fvkey":"47E6C03A69E3A0F9C46CC583CF5B6576522F3933D3BA372BF0DFDEA3E419D5A7FD4F2DF9DBD2AA7066610707419068465F8CA7D74CB662C4BF3EDDACAC1EDAFE4098C6D533EF22D67656B17055BC940B70C0A9977A309FAEB4DE07BE8FC16BA282535E1428A6EE08","head":0,"hevc":0,"iflag":0,"level":0,"lnk":"l0167dtse0d","logo":1,"mst":8,"pl":null,"share":1,"sp":0,"st":2,"tail":0,"td":"62.333","ti":"老鼠打架斗殴","tie":0,"type":3,"ul":{"ui":[{"url":"222.184.110.89/vhot2.qqvideo.tc.qq/ArRemashBUh9Qyxvw8Rtr-JDAshsm-24XLeztXBBj7nU/","vt":200,"dtc":0,"dt":2},{"url":"ugcws.gtimg/uwMRJfz-r5jAYaQXGdGnCtD0ZkRh8BgOUQePMGh65cs/","vt":106,"dtc":0,"dt":2},{"url":"ugcbsy.qq/uwMRJfz-r5jAYaQXGdGlQlztpablXrNXWyAp2Qw2xW8/","vt":136,"dtc":0,"dt":2},{"url":"video.dispatch.tc.qq/","vt":0,"dtc":0,"dt":2}]},"vh":256,"vid":"l0167dtse0d","videotype":0,"vr":0,"vst":2,"vw":480,"wh":1.875,"wl":{"wi":[]},"uptime":0,"fvideo":0,"fvpint":0,"swhdcp":0}]}};
我们需要将json进行格式化,可以使用 notepad++ 格式化一下,得出如下结果:
{
"dltype": 1,
"exem": 0,
"fl": {
"cnt": 2,
"fi": [{
"id": 100701,
"name": "msd",
"lmt": 0,
"sb": 1,
"cname": "标清;(270P)",
"br": 26,
"profile": 2,
"drm": 0,
"video": 1,
"audio": 1,
"fs": 1689378,
"sl": 1
},
{
"id": 2,
"name": "mp4",
"lmt": 0,
"sb": 1,
"cname": "高清;(480P)",
"br": 31,
"profile": 1,
"drm": 0,
"video": 1,
"audio": 1,
"fs": 3834360,
"sl": 0
}]
},
"hs": 0,
"ip": "49.74.255.55",
"ls": 0,
"preview": 62,
"s": "o",
"sfl": {
"cnt": 0
},
"tm": 1538742726,
"vl": {
"cnt": 1,
"vi": [{
"br": 26,
"ch": 0,
"cl": {
"fc": 0,
"keyid": "l0167dtse0d.100701"
},
"ct": 21600,
"drm": 0,
"dsb": 0,
"fmd5": "d13f05640be11412828e70af85d1b7ec",
"fn": "l0167dtse0d.m701.mp4",
"fs": 1689378,
"fst": 5,
"fvkey": "47E6C03A69E3A0F9C46CC583CF5B6576522F3933D3BA372BF0DFDEA3E419D5A7FD4F2DF9DBD2AA7066610707419068465F8CA7D74CB662C4BF3EDDACAC1EDAFE4098C6D533EF22D67656B17055BC940B70C0A9977A309FAEB4DE07BE8FC16BA282535E1428A6EE08",
"head": 0,
"hevc": 0,
"iflag": 0,
"level": 0,
"lnk": "l0167dtse0d",
"logo": 1,
"mst": 8,
"pl": null,
"share": 1,
"sp": 0,
"st": 2,
"tail": 0,
"td": "62.333",
"ti": "老鼠打架斗殴",
"tie": 0,
"type": 3,
"ul": {
"ui": [{
"url": "222.184.110.89/vhot2.qqvideo.tc.qq/ArRemashBUh9Qyxvw8Rtr-JDAshsm-24XLeztXBBj7nU/",
"vt": 200,
"dtc": 0,
"dt": 2
},
{
"url": "ugcws.gtimg/uwMRJfz-r5jAYaQXGdGnCtD0ZkRh8BgOUQePMGh65cs/",
"vt": 106,
"dtc": 0,
"dt": 2
},
{
"url": "ugcbsy.qq/uwMRJfz-r5jAYaQXGdGlQlztpablXrNXWyAp2Qw2xW8/",
"vt": 136,
"dtc": 0,
"dt": 2
},
{
"url": "video.dispatch.tc.qq/",
"vt": 0,
"dtc": 0,
"dt": 2
}]
},
"vh": 256,
"vid": "l0167dtse0d",
"videotype": 0,
"vr": 0,
"vst": 2,
"vw": 480,
"wh": 1.875,
"wl": {
"wi": []
},
"uptime": 0,
"fvideo": 0,
"fvpint": 0,
"swhdcp": 0
}]
}
}
}
根据上面的json,拼凑完整url
ugcws.gtimg/uwMRJfz-r5jAYaQXGdGnCtD0ZkRh8BgOUQePMGh65cs/l0167dtse0d.m701.mp4?vkey=47E6C03A69E3A0F9C46CC583CF5B6576522F3933D3BA372BF0DFDEA3E419D5A7FD4F2DF9DBD2AA7066610707419068465F8CA7D74CB662C4BF3EDDACAC1EDAFE4098C6D533EF22D67656B17055BC940B70C0A9977A309FAEB4DE07BE8FC16BA282535E1428A6EE08
使用这个url,就可以正确播放所需视频了。
上一篇: Grafana镜像在阿里云镜像站首发上线
下一篇: 浅析常用的Python Web的几大框架