专栏首页宅机吧腾讯视频原始地址分析

腾讯视频原始地址分析

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

随机选一条视频为例:

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

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

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

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

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%3A%2F%2Fm.v.qq.com%2Fplay.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%3D&_qv_rmt2=arUV%2FH1d151758VSQ%3D&_1571877558519=

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

http://vv.video.qq.com/getinfo?vids=c0329j2hqcf&platform=101001&charge=0&otype=json
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

搞定第一步!!!

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

https://ugcws.video.gtimg.com/uwMROfz2r5xiIaQXGdGnC2dfDmbtJb36b1Em-3gvdwBZDsJd/c0329j2hqcf.mp4?sdtfrom=v3010&guid=c7a6d967626fae26fdd4cde1aed7d9e0&vkey=57508196ED81F812F6064202D8CDD38AE484BEFEBBB0AEEC2D8B0B6663919FFB0543ED00D9F09E3D60B44A99AE9B5CFBD16922E30CEFF9ACE77622B4A5A1A19AB129C295C77588B6C67BCFE672628BB1DFBD763FD8D86FF3941FD9C533AD7C16878BA007E6D7B59FFF56A403B60D500A9FC8EAF0E2DF79A57115CCE28240795B&platform=2

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

https://ugcws.video.gtimg.com/uwMROfz2r5xiIaQXGdGnC2dfDmbtJb36b1Em-3gvdwBZDsJd/c0329j2hqcf.mp4?vkey=57508196ED81F812F6064202D8CDD38AE484BEFEBBB0AEEC2D8B0B6663919FFB0543ED00D9F09E3D60B44A99AE9B5CFBD16922E30CEFF9ACE77622B4A5A1A19AB129C295C77588B6C67BCFE672628BB1DFBD763FD8D86FF3941FD9C533AD7C16878BA007E6D7B59FFF56A403B60D500A9FC8EAF0E2DF79A57115CCE28240795B

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

两个玩意:

https://ugcws.video.gtimg.com/uwMROfz2r5xiIaQXGdGnC2dfDmbtJb36b1Em-3gvdwBZDsJd/c0329j2hqcf.mp4
vkey=57508196ED81F812F6064202D8CDD38AE484BEFEBBB0AEEC2D8B0B6663919FFB0543ED00D9F09E3D60B44A99AE9B5CFBD16922E30CEFF9ACE77622B4A5A1A19AB129C295C77588B6C67BCFE672628BB1DFBD763FD8D86FF3941FD9C533AD7C16878BA007E6D7B59FFF56A403B60D500A9FC8EAF0E2DF79A57115CCE28240795B

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

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

https://ugcws.video.gtimg.com/uwMROfz2r5xiIaQXGdGnC2dfDmbtJb36b1Em-3gvdwBZDsJd/c0329j2hqcf.mp4

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

https://ugcws.video.gtimg.com/uwMROfz2r5xiIaQXGdGnC2dfDmbtJb36b1Em-3gvdwBZDsJd/
c0329j2hqcf.mp4

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

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

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

完全OJBK

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

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

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

本文分享自微信公众号 - 宅机吧(zhai-78),作者:许坏

原文出处及转载信息见文内详细说明,如有侵权,请联系 yunjia_community@tencent.com 删除。

原始发表时间:2019-10-24

本文参与腾讯云自媒体分享计划,欢迎正在阅读的你也加入,一起分享。

我来说两句

0 条评论
登录 后参与评论

相关文章

  • PHP开发公众号之发送位置查天气

    你不努力,永远不会有人对你公平,只有你努力了,有了资源,有了话语权以后,你才可能为自己争取公平的机会。

    许坏
  • 小程序上实现汉字转拼音及提取首字母

    2.在开发者工具中,对着小程序端的项目目录【miniprogram】选中后鼠标右键,选择【在终端中打开】

    许坏
  • 小程序开发解决margin或padding溢出问题

    当设置了父元素的宽度,子元素设置宽度为100%后再在加上子元素上添加padding或margin值就会溢出。

    许坏
  • PHP关于web页面交互内容

    1. 学php学了有一段时间了总结总结给大家分享一下 2. PHP中的引用 第一段程序: <?php $first_name="fir...

    lizelu
  • 教你秒建受信任的本地 SSL 证书,彻底解决开发测试环境的无效证书警告烦恼!

    您是否厌倦了在本地开发项目中使用不受信任的 SSL 证书?维护自己的证书颁发机构(CA)是一个痛苦的事情,这过程中需要用到神秘的程序和命令。在本指南中,我将向您...

    iMike
  • Serverless 与 Flask 框架结合进行 Blog 开发

    随着时间的发展,Serverless 架构越来越火热,其按量付费、弹性伸缩等诸多优质特性,让人眼前一亮,不得不惊叹云计算为我们带来的便利。 本实践通过一个博客...

    腾讯云serverless团队
  • 基于Serverless架构的Python Blog开发(原生开发与Flask框架结合)

    随着时间的发展,Serverless架构越来越火热,其按量付费,弹性伸缩… 等很多优质特性,都让人眼前一亮,不得惊叹云计算为我们带来的便利。但是就目前而言,Se...

    Dfounderliu
  • 开发微服务为何同时需要敏捷与软件工程?

    2016.9.25, 北京, Ken Fang 我们为何在开发微服务架构产品时,同时需要敏捷与软件工程实践? 其实,我想,任何一个人,只要是搞 IT 的,没有谁...

    Ken Fang 方俊贤
  • 强化学习(十二) Dueling DQN

        在强化学习(十一) Prioritized Replay DQN中,我们讨论了对DQN的经验回放池按权重采样来优化DQN算法的方法,本文讨论另一种优化方...

    刘建平Pinard
  • Flutter从配置安装到填坑指南详解

    用户1269200

扫码关注云+社区

领取腾讯云代金券