腾讯视频原始地址分析

2019-10-25 00:31:17 浏览数 (1)

今天10.24程序员节,咋们上点干货:

随机选一条视频为例:

代码语言:javascript复制
https://v.qq.com/x/page/c0329j2hqcf.html

先不谈技术,来欣赏欣赏这首爱了好多年的歌

欣赏完了下面我们来分析获取它的原始播放地址:

打开该页面,观察它的网络请求,发现这么一条接口

代码语言:javascript复制
https://h5vv.video.qq.com/getinfo?callback=txplayerJsonpCallBack_getinfo_508672&&charge=0&defaultfmt=auto&otype=json&guid=c7a6d967626fae26fdd4cde1aed7d9e0&flowid=97462f7b68d3e406f890b1ffcb5c7106_11001&platform=11001&sdtfrom=v3010&defnpayver=0&appVer=3.4.40&host=m.v.qq.com&ehost=https://m.v.qq.com/play.html&refer=m.v.qq.com&sphttps=1&sphls=&_rnd=1571877558&spwm=4&vid=c0329j2hqcf&defn=auto&fhdswitch=&show1080p=false&dtype=1&clip=4&defnsrc=&fmt=auto&defsrc=1&_qv_rmt=wfCJSWmlA17875kJW=&_qv_rmt2=arUV/H1d151758VSQ=&_1571877558519=

剔除掉无用的参数,也就是:

代码语言:javascript复制
http://vv.video.qq.com/getinfo?vids=c0329j2hqcf&platform=101001&charge=0&otype=json
代码语言:javascript复制
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": 8336750,"super": 0,"hdr10enh": 0,"sname": "标清","resolution": "270P","sl": 1    }, {"id": 2,"name": "mp4","lmt": 0,"sb": 1,"cname": "高清;(480P)","br": 34,"profile": 1,"drm": 0,"video": 1,"audio": 1,"fs": 17288525,"super": 0,"hdr10enh": 0,"sname": "高清","resolution": "480P","sl": 0    }]  },"hs": 0,"ip": "222.178.10.164","ls": 0,"preview": 276,"s": "o","sfl": {"cnt": 0  },"tm": 1571877814,"vl": {"cnt": 1,"vi": [{"br": 29,"ch": 0,"cl": {"fc": 0,"keyid": "c0329j2hqcf.100701"      },"ct": 21600,"drm": 0,"dsb": 0,"fmd5": "bcffa50267d0b13056a42ac6cdc942d6","fn": "c0329j2hqcf.m701.mp4","fs": 8336750,"fst": 5,"fvkey": "1C55034949058DF08C0289CAFBC969F95E1A3CD7A4086A062997FE99899BCADF51A24964967BAB5416A38833A109A0368751861015816B374031E139A586851B8D1F50FE381B2EB95FD42283694C350A5B6296DA411D6D3FB71A6BC8DAB2201777D45DCF4765AFDB54377EB9EC18963F","head": 0,"hevc": 0,"iflag": 0,"level": 0,"lnk": "c0329j2hqcf","logo": 1,"mst": 8,"pl": null,"share": 1,"sp": 0,"st": 2,"tail": 0,"td": "276.01","ti": "《你瞒我瞒》剧场版","tie": 0,"type": 5,"ul": {"ui": [{"url": "http://ugcws.video.gtimg.com/uwMROfz2r5xiIaQXGdGnC2dfhzl9rDaq1HqkRdFPJaJU5yKB/","vt": 106,"dtc": 0,"dt": 2        }, {"url": "http://ugcydzd.qq.com/uwMROfz2r5xiIaQXGdGlC2dfhznsgzQWO-l8eo7S3JfzgVkV/","vt": 146,"dtc": 0,"dt": 2        }, {"url": "http://183.66.104.113/vhot2.qqvideo.tc.qq.com/A0PxVM6woMeq46lI5cD2nGwkbSuDRJZrGdFX0Zyv9f2I/uwMROfz2r5xiIaQXGdGlK2dfhzmVEcQ99RBB-XsrAwSp9z6s/","vt": 200,"dtc": 0,"dt": 2        }, {"url": "http://video.dispatch.tc.qq.com/uwMROfz2r5xiIaQXGdGlKmdfhzkJTVO8q2eIFWSEzfgzJI2R/","vt": 0,"dtc": 0,"dt": 2        }]      },"vh": 272,"vid": "c0329j2hqcf","videotype": 22,"vr": 0,"vst": 2,"vw": 480,"wh": 1.7647059,"wl": {"wi": []      },"uptime": 1474288421,"fvideo": 0,"cached": 1,"fvpint": 0,"swhdcp": 0    }]  }};

敏感一点,这条接口肯定是解析的核心,先不继续,我们看看怎么确定这条接口

尝试一下,发现这条接口的唯一参数就是vids=c0329j2hqcf,这玩意儿本身就在它的播放地址里面:

https://v.qq.com/x/page/c0329j2hqcf.html

搞定第一步!!!

接下来,我们分析页面上视频播放的真实地址:

代码语言:javascript复制
https://ugcws.video.gtimg.com/uwMROfz2r5xiIaQXGdGnC2dfDmbtJb36b1Em-3gvdwBZDsJd/c0329j2hqcf.mp4?sdtfrom=v3010&guid=c7a6d967626fae26fdd4cde1aed7d9e0&vkey=57508196ED81F812F6064202D8CDD38AE484BEFEBBB0AEEC2D8B0B6663919FFB0543ED00D9F09E3D60B44A99AE9B5CFBD16922E30CEFF9ACE77622B4A5A1A19AB129C295C77588B6C67BCFE672628BB1DFBD763FD8D86FF3941FD9C533AD7C16878BA007E6D7B59FFF56A403B60D500A9FC8EAF0E2DF79A57115CCE28240795B&platform=2

同样的,我们尝试剔除掉无用参数:

代码语言:javascript复制
https://ugcws.video.gtimg.com/uwMROfz2r5xiIaQXGdGnC2dfDmbtJb36b1Em-3gvdwBZDsJd/c0329j2hqcf.mp4?vkey=57508196ED81F812F6064202D8CDD38AE484BEFEBBB0AEEC2D8B0B6663919FFB0543ED00D9F09E3D60B44A99AE9B5CFBD16922E30CEFF9ACE77622B4A5A1A19AB129C295C77588B6C67BCFE672628BB1DFBD763FD8D86FF3941FD9C533AD7C16878BA007E6D7B59FFF56A403B60D500A9FC8EAF0E2DF79A57115CCE28240795B

所以解析了要解决的东西很明了:

两个玩意:

代码语言:javascript复制
https://ugcws.video.gtimg.com/uwMROfz2r5xiIaQXGdGnC2dfDmbtJb36b1Em-3gvdwBZDsJd/c0329j2hqcf.mp4
代码语言:javascript复制
vkey=57508196ED81F812F6064202D8CDD38AE484BEFEBBB0AEEC2D8B0B6663919FFB0543ED00D9F09E3D60B44A99AE9B5CFBD16922E30CEFF9ACE77622B4A5A1A19AB129C295C77588B6C67BCFE672628BB1DFBD763FD8D86FF3941FD9C533AD7C16878BA007E6D7B59FFF56A403B60D500A9FC8EAF0E2DF79A57115CCE28240795B

下面vkey太肯定明了了,下面搞定他,直接全局搜:

这就解决了,下面我们看第一条;

代码语言:javascript复制
https://ugcws.video.gtimg.com/uwMROfz2r5xiIaQXGdGnC2dfDmbtJb36b1Em-3gvdwBZDsJd/c0329j2hqcf.mp4

首先分析,getinfo接口是没有直接返回任何mp4链接的,所以这里我们就要思考,该链接是否是拼凑出,尝试分解:

代码语言:javascript复制
https://ugcws.video.gtimg.com/uwMROfz2r5xiIaQXGdGnC2dfDmbtJb36b1Em-3gvdwBZDsJd/
代码语言:javascript复制
c0329j2hqcf.mp4

然后从小的开始,搜索mp4,正好刚刚出现了这个玩意儿

剩下需要解决的前面这部分,在页面找像这种链接形式的,然后尝试拼凑,不难发现这几条链接

试一下不会怀孕,随便选一条拼一拼,看看效果

完全OJBK

发布这篇文章,没其他意思,只是想说明一个道理:学编程,就要多尝试。

我们上面说的其实并非编程知识,充其量只算投机取巧罢了,但这些却是最容易入门最快可以成功的,换一句说,最容易建立兴趣。

所以再遇到这些如果感兴趣,别怕,试试又不会怀孕!

mp4

0 人点赞