简单四步抓取腾讯视频MP4文件

1. 获取视频播放页地址,如:https://v.qq.com/x/page/j0329yq5lu0.html

2. 视频正片开播后,在H5播放器的右键菜单中选择“复制调试信息”。
注意,一定要是H5播放器!不是Flash播放器!
复制出来的信息如下:
{"pid":"5ec03277ec8ad8779a3b0556a6dece20","url":"https%3A%2F%2Fv.qq.com%2Fx%2Fpage%2Fj0329yq5lu0.html","vid":"j0329yq5lu0","version":"3.5.56","platform":"10201","playtype":3,"emsg2":"%7B%22flow%22%3A%5B%221542157206271%20getinfo%20ok%20285%22%5D%7D","id":"","action":"//btrace.qq.com/kvcollect?BossId=4372&Pwd=967411786","getinfo":"%2F%2Fvd.l.qq.com%2Fproxyhttp%2Fvinfoad%26charge%3D0%26defaultfmt%3Dauto%26otype%3Dojson%26guid%3D0ba80cda159a394ad0cd7f289314f187%26flowid%3D5ec03277ec8ad8779a3b0556a6dece20_10201%26platform%3D10201%26sdtfrom%3Dv1010%26defnpayver%3D1%26appVer%3D3.5.56%26host%3Dv.qq.com%26ehost%3Dhttps%253A%252F%252Fv.qq.com%252Fx%252Fpage%252Fj0329yq5lu0.html%26refer%3Dv.qq.com%26sphttps%3D1%26tm%3D1542157205%26spwm%3D4%26unid%3Db71ad650b23f11e79d19a0420722850a%26vid%3Dj0329yq5lu0%26defn%3D%26fhdswitch%3D0%26show1080p%3D1%26isHLS%3D1%26dtype%3D3%26sphls%3D2%26spgzip%3D1%26dlver%3D2%26drm%3D32%26spau%3D1%26spaudio%3D15%26defsrc%3D1%26encryptVer%3D7.3%26cKey%3D026d99c005ccb94b92a21e7ff4f69cc6%26fp2p%3D1","getkey":"","uin":"","ua":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML  like Gecko) Chrome/69.0.3497.100 Safari/537.36","refer":"https://v.qq.com/x/page/j0329yq5lu0.html","pvid":"6462927036","sessionid":"","main_login":"","vuserid":"","openid":"","appid":"","vurl":"https%3A%2F%2Fugcbsy.qq.com%2FuwMRJfz-r5jAYaQXGdGnC2_ppdhgmrDlPaRvaV7F2Ic%2Fj0329yq5lu0.p702.1.mp4%3Fsdtfrom%3Dv1010%26guid%3D0ba80cda159a394ad0cd7f289314f187%26vkey%3D10BE261141D4292BE0767F68C67AE65A9200FDEEC31A8E3ED827FC8D2173C09727E7DD32C3BF0C0D14A279CBF59121D0EBD8D9A62694EF0913A8B590EDE0E5A3127A8A13ADFC1A09F199F147BB9C4906447242C4EF8D5F461E07320FA339600374717AC95D0526127349252A921FD3B2400FBCC5250AD14B","cid":"","now":"2018-11-14 09:01:54","defn":"hd","uid":"0ba80cda159a394ad0cd7f289314f187"}

找到vurl节点,它的值就是视频的真实下载地址了。

3. 发现URL中有带%编码的字符,将它们转化成ASCII字符
字符转换表参见:
http://www.w3school.com.cn/tags/html_ref_urlencode.html
常用的有:
%3A -> :
%2F -> /
%3F -> ?
%3D -> =
%26 -> &

上述视频地址转化后变成:
https://ugcbsy.qq.com/uwMRJfz-r5jAYaQXGdGnC2_ppdhgmrDlPaRvaV7F2Ic/j0329yq5lu0.p702.1.mp4?sdtfrom=v1010&guid=0ba80cda159a394ad0cd7f289314f187&vkey=10BE261141D4292BE0767F68C67AE65A9200FDEEC31A8E3ED827FC8D2173C09727E7DD32C3BF0C0D14A279CBF59121D0EBD8D9A62694EF0913A8B590EDE0E5A3127A8A13ADFC1A09F199F147BB9C4906447242C4EF8D5F461E07320FA339600374717AC95D0526127349252A921FD3B2400FBCC5250AD14B

4. 在浏览器里打开上述转换后的地址,然后在播放器的右键菜单里选择“视频另存为...”,就可以把视频的MP4文件保存下来了。

你可能感兴趣的:(多媒体)