2019年12月

2019/12/19

视(音)频类型id与编码、分辨率等对应关系

首先腾讯视频的m3u8链接一般长这样:

http://101.206.186.17/moviets.tc.qq.com/AN5SbV718VX6_2HWcx7ahexT_ZdqeD3jXHJoe4mD9NKM/uwMROfz2r5xggaQXGdGnC2df54QW1RJDjotqhbRC6iUyaxmU/dWU834FFbAZywdBb92AWkZwTetnAdWHQnHhYPgN-01EWtYg2H3dR-KubOrltU-9MVh5K0uCs_vi1o8tEqEhPvpplNhhmQqTr9rPDrxorb279J7VGAN8z8BjWhZ72lx_h0A1zF3dq3lJ-1XHivHpn8WaF_FKRLhS8goQoQyZtJDY/e0033e0q9cc.322016.ts.m3u8?ver=4
  • 最前面的ip是接口返回给用户的cdn ip
  • moviets.tc.qq.com是m3u8资源所位于的域名
  • 中间一串是变化的
  • e0033e0q9cc是视频vid
  • ver是m3u8版本 已知的有4和5
  • 最前面通常会是http://defaultts.tc.qq.com/defaultts.tc.qq.com/以及http://ltsbsy.qq.com等等
  • 322016是一个和视频编码分辨率相关的参数

已知id与视频/音频对应关系:

320001 -> 普通音频(AAC)
320069 -> 1080p h265 3Mbps码率
320093 -> 1080p h264
320143 -> 1080p h265(官方标注4K 实际是伪4K 不过码率高点罢了)
320144 -> ?
320159 -> 1080p h265 杜比视界(1.0, [email protected], BL+RPU) mediainfo示例:https://pastebin.com/77rpguT3
320156 -> ?
320161 -> ? 杜比视界
320160 -> 4K h265 杜比视界(1.0, [email protected], BL+RPU) mediainfo示例:https://pastebin.com/nzLY2S3R
320164 -> 1080p h265 杜比视界(1.0, [email protected], BL+RPU) mediainfo示例:https://pastebin.com/eFzFtytv
320179 -> 1080p h265 HDR10(Apple系) mediainfo示例:https://pastebin.com/VRcJpV2M
320194 -> 1080p h265 HDR10(Android系)
320199 -> 1080p h265 杜比视界(1.0, [email protected], BL+RPU) mediainfo示例:https://pastebin.com/npqv4Hf7
321001 -> 270p h264
321002 -> 480p h264
321003 -> 720p h264
321004 -> 1080p h264
321005 -> 1080p h264(官方标注杜比视听 实际只是码率高点)
322000 -> ?
322001 -> 270p h265
322002 -> 480p h265
322003 -> 720p h265
322004 -> 1080p h265
322005 -> ?
322006 -> ?
322011 -> 270p h265
322012 -> 480p h265
322013 -> 720p h265
322014 -> 1080p h265
322016 -> 4K h265
322069 -> ?
326013 -> 杜比音效(AC3)

2019/12/18

可以自己抓app的包看到参数

获取hdr+杜比音轨

http://vv.video.qq.com/getinfo?spptype=4,5,6,7,8,9,10,11,12&spaudio=15&spvideo=128&spwm=2&livequeue=1&defnpayver=5&hevclv=33&platform=10303&sdtfrom=v5000&vid=i0032qxbi2v&cKey=&ipstack=0&track=db&drm=104&defnsrc=3&charge=1&atime=26&spau=1&appVer=7.7.8.20476&defn=hdr10&encryptVer=5.1&dtype=3&incver=20476&newnettype=1&spsrt=1&sphls=1&otype=ojson&device=21&flowid=&clip=0&fhdswitch=0&
  • 普通音频&defn=audio
  • 返回hdr链接&defn=hdr10
  • 需要返回杜比音轨时添加&track=db

腾讯视频指定平台返回该平台支持的类型

{
    "spvideo":"128",
    "platform":"10303",
    "sdtfrom":"v5000",
    "hevclv":"33",
    "appVer":"7.7.8.20476",
    "encryptVer":"5.1"
}

指定&otype=ojson或者&otype=json,返回时会是纯json格式(没有QZOutputJson之类的),否则返回xml格式内容。
返回示例:
请输入图片描述
腾讯真正HDR的链接后缀应该是320194,此处HDR不是真正的HDR,而是普通的1080,因为并没提供(?)
请输入图片描述

原来是姿势不对,根据@花村 的分享spvideo改为140则会返回HDR,如图:
请输入图片描述

TODO

补充其他平台的参数...

西瓜视频高清下载方法

https://www.ixigua.com/i6767184571726299659/为例

打开网址查看网页源代码

请输入图片描述

找到视频vid(一般在末尾,建议通过视频标题快速定位)

请输入图片描述

拼接视频接口地址

参数控制如下

  • ratio 分辨率 举例:720p 1080p
  • watermark 水印 举例:0 1
  • h265 视频编码 举例:0 1
https://api-hl.amemv.com/aweme/v1/play/?video_id={vid}&ratio={分辨率}&watermark={水印控制}&h265={编码控制}

1080p视频h264编码无水印链接拼接结果(注意拼接的地址使用iPhone的User-Agent访问)

https://api-hl.amemv.com/aweme/v1/play/?video_id=v02004140000bnktrc1pjc2vd85k8qhg&ratio=1080p&watermark=0&h265=0

请输入图片描述
访问api得到视频地址为

http://v27-dy.ixigua.com/988d4d72c375a089f64876dbc769309d/5df76218/video/tos/cn/tos-cn-ve-4/3899c075e4ee4ca795aa3b05e6853367/?a=1128&br=2794&bt=1397&cr=0&cs=0&dr=0&ds=4&er=&l=201912161741070101440611491701C83F&lr=&qs=0&rc=anRuO3lmc2Z3cTMzNzczM0ApPGY5aWQ4NDw5N2c8NjYzM2dlNTJhL2cub2hfLS0uLS9zcy8tM2AuNjI0MF5gYjBfMWA6Yw%3D%3D

请输入图片描述
当然水印控制不一定有效:)

操作视频预览:
[dplayer url="https://alime-customer-upload-cn-hangzhou.oss-cn-hangzhou.aliyuncs.com/customer-upload/1576489684804_8pl0n44ent4l.mp4" autoplay="true"/]

6月22日起,该方案不再适用于WETV

该接口需要已经登录腾讯视频,或者你可以选择直接在QQ打开api地址。

视频地址举例:

https://v.qq.com/x/cover/rjae621myqca41h/h0033evbn3l.html

api地址示例(替换vid即可):

https://vv.video.qq.com/getinfo?defn=fhd&platform=10801&otype=ojson&sdtfrom=v4138&appVer=7&vid=h0033evbn3l&newnettype=1&fhdswitch=1&show1080p=1&dtype=3&sphls=2

请输入图片描述
优势在于不需要ckey等参数,且带有cookie访问api得到的链接(m3u8)不限速。

同样适用于wetv的视频
https://wetv.vip/play?vid=p0033zdmtkz
替换vid即可:)
请输入图片描述

WETV全集接口

https://wetv.vip/cgi/cover?cid=wyeltenqne3bn8q

返回结果中data.cidInfo.video_ids_country是正片的vid

请求

http://union.video.qq.com/fcgi-bin/data?tid=698&appid=10071005&appkey=0d1a9ddd94de871b&idlist=rjae621myqca41h

返回

This XML file does not appear to have any style information associated with it. The document tree is shown below.
<root>
<costtime>717</costtime>
<errormsg/>
<errorno>0</errorno>
<resptime>1575014263</resptime>
<results>
<fields>
<aboard_area_play_conf>8262313</aboard_area_play_conf>
<aboard_area_play_conf>1496217</aboard_area_play_conf>
<aboard_area_play_conf>1496218</aboard_area_play_conf>
<aboard_area_play_conf>1666680</aboard_area_play_conf>
<aboard_area_play_conf>1666681</aboard_area_play_conf>
<aboard_area_play_conf>1496216</aboard_area_play_conf>
<alias>庆余年 第一季</alias>
<all_ids>
[{"F":2,"V":"i0032qxbi2v"},{"F":2,"V":"j0032ubhl9s"},{"F":2,"V":"x0032o977cc"},{"F":0,"V":"k0032b4yiuw"},{"F":0,"V":"q00322u0hqy"},{"F":0,"V":"t003252vxsd"},{"F":7,"V":"k00329wv1ed"},{"F":7,"V":"t00329rbass"},{"F":7,"V":"y00326sr9vu"},{"F":4,"V":"w0032dmvfz1"},{"F":4,"V":"s0032roiam1"},{"F":4,"V":"p0032yhhvjs"},{"F":4,"V":"r0032e2icu2"},{"F":4,"V":"s00326ukd0b"},{"F":4,"V":"o0032hnei40"},{"F":4,"V":"p0032wkt07v"},{"F":4,"V":"q0032bvt850"},{"F":4,"V":"s00323k4ehy"},{"F":4,"V":"g0032fyniq3"},{"F":4,"V":"m0032m0g3av"},{"F":4,"V":"u0032dyit3i"},{"F":4,"V":"c0032ai1iwq"},{"F":4,"V":"g00325lzl35"}]
</all_ids>
<bgpic/>
<cartoon_age/>
<category_value>10470</category_value>
<child_aspect/>
<child_type/>
<copyright_expiration_time>2029-11-26 00:00:00</copyright_expiration_time>
<cover_checkup_grade>4</cover_checkup_grade>
<cover_checkup_time>2018-08-10 09:17:54</cover_checkup_time>
<cover_id>rjae621myqca41h</cover_id>
<data_checkup_grade>4</data_checkup_grade>
<description>
东晋末年,相国公刘裕篡位成为武帝。血腥政变中,只有皇妃叶轻眉刚出生的儿子幸免于难。尚书范建将他收养,取名范闲。范闲十八岁时,因其即将和皇室联姻的身份,成为各方争夺的目标,还被卷入皇子之间的争斗。他凭借自己的文采和机敏,破获悬案,仕途顺利,天下闻名。当各方势力都在为立储角力,范闲却发现自己的身世秘密……
</description>
<is_trailer>0</is_trailer>
<langue>普通话</langue>
<new_pic_hz>
http://puui.qpic.cn/vcover_hz_pic/0/rjae621myqca41h1574825567/0
</new_pic_hz>
<new_pic_vt>
http://puui.qpic.cn/vcover_vt_pic/0/rjae621myqca41h1574838571/0
</new_pic_vt>
<nomal_ids>
[{"F":2,"V":"i0032qxbi2v"},{"F":2,"V":"j0032ubhl9s"},{"F":2,"V":"x0032o977cc"},{"F":0,"V":"k0032b4yiuw"},{"F":0,"V":"q00322u0hqy"},{"F":0,"V":"t003252vxsd"},{"F":7,"V":"k00329wv1ed"},{"F":7,"V":"t00329rbass"},{"F":7,"V":"y00326sr9vu"},{"F":4,"V":"w0032dmvfz1"},{"F":4,"V":"s0032roiam1"},{"F":4,"V":"p0032yhhvjs"},{"F":4,"V":"r0032e2icu2"},{"F":4,"V":"s00326ukd0b"},{"F":4,"V":"o0032hnei40"},{"F":4,"V":"p0032wkt07v"},{"F":4,"V":"q0032bvt850"},{"F":4,"V":"s00323k4ehy"},{"F":4,"V":"g0032fyniq3"},{"F":4,"V":"m0032m0g3av"},{"F":4,"V":"u0032dyit3i"},{"F":4,"V":"c0032ai1iwq"},{"F":4,"V":"g00325lzl35"}]
</nomal_ids>
<off_time>0000-00-00 00:00:00</off_time>
<online_time>2019-11-26 00:00:00</online_time>
<pay_status>6</pay_status>
<playright>1</playright>
<playright>2</playright>
<playright>3</playright>
<playright>4</playright>
<playright>5</playright>
<playright>8</playright>
<playright>9</playright>
<playright>10</playright>
<playright>18</playright>
<playright>20</playright>
<playright>21</playright>
<playright>40</playright>
<playright>57</playright>
<playright>61</playright>
<publish_date>2019-11-26</publish_date>
<resolution_list>标清</resolution_list>
<resolution_list>高清</resolution_list>
<resolution_list>超清</resolution_list>
<resolution_list>全高清</resolution_list>
<resolution_list>4K</resolution_list>
<second_title>张若昀陷庙堂江湖绝处逢生</second_title>
<series_name>庆余年</series_name>
<time_long/>
<title>庆余年</title>
<title_en/>
<url>https://v.qq.com/x/cover/rjae621myqca41h.html</url>
<vip_ids>
[{"F":2,"V":"i0032qxbi2v"},{"F":2,"V":"j0032ubhl9s"},{"F":2,"V":"x0032o977cc"},{"F":7,"V":"k00329wv1ed"},{"F":7,"V":"t00329rbass"},{"F":7,"V":"y00326sr9vu"},{"F":4,"V":"w0032dmvfz1"},{"F":4,"V":"s0032roiam1"},{"F":4,"V":"p0032yhhvjs"},{"F":4,"V":"r0032e2icu2"},{"F":4,"V":"s00326ukd0b"},{"F":4,"V":"o0032hnei40"},{"F":4,"V":"p0032wkt07v"},{"F":4,"V":"q0032bvt850"},{"F":4,"V":"s00323k4ehy"},{"F":4,"V":"g0032fyniq3"},{"F":4,"V":"m0032m0g3av"},{"F":4,"V":"u0032dyit3i"},{"F":4,"V":"c0032ai1iwq"},{"F":4,"V":"g00325lzl35"}]
</vip_ids>
</fields>
<id>rjae621myqca41h</id>
<retcode>0</retcode>
</results>
</root>

tid取992、1000、341、121返回更详细的信息

单集

请求

http://union.video.qq.com/fcgi-bin/data?tid=98&appid=10001005&appkey=0d1a9ddd94de871b&idlist=k00329wv1ed,

返回

This XML file does not appear to have any style information associated with it. The document tree is shown below.
<root>
<costtime>1089</costtime>
<errormsg/>
<errorno>0</errorno>
<resptime>1575015826</resptime>
<results>
<fields>
<ad_multi/>
<adspots>660000</adspots>
<areaName>内地</areaName>
<area_id>153505</area_id>
<area_name>内地</area_name>
<c_full>0</c_full>
<category_map>10470</category_map>
<category_map>正片</category_map>
<category_map>1089</category_map>
<category_map>连续剧</category_map>
<category_map>2</category_map>
<category_map>电视剧</category_map>
<channel/>
<co_area/>
<colnum/>
<column_id>0</column_id>
<copyright>新丽传媒</copyright>
<copyright_id>470</copyright_id>
<cover_list>rjae621myqca41h</cover_list>
<create_time>2019-11-26 14:57:10</create_time>
<desc/>
<director/>
<douban_id/>
<drm>1</drm>
<duration>2770</duration>
<episode>04</episode>
<episode_all/>
<imdb_id/>
<is_trailer>0</is_trailer>
<keyword/>
<lang_id>2</lang_id>
<langue>普通话</langue>
<leading_actor/>
<link>u0032th0dyy</link>
<main_genre>古装</main_genre>
<modify_time>2019-11-28 22:32:10</modify_time>
<mtime_id/>
<pic_640_360>http://puui.qpic.cn/vpic/0/k00329wv1ed.png/0</pic_640_360>
<pioneer_tag/>
<producer/>
<publish_date/>
<publish_dateX/>
<race_teams_id/>
<race_teams_name/>
<second_title/>
<source>腾讯视频</source>
<source_id>8</source_id>
<state>4</state>
<sub_genre>剧情</sub_genre>
<subtype_id>2</subtype_id>
<subtype_id>1024</subtype_id>
<sync_cover>rjae621myqca41h</sync_cover>
<tag/>
<targetid>4455844424</targetid>
<title>庆余年_04</title>
<trytime/>
<upload_src>20</upload_src>
<url>https://v.qq.com/x/page/k00329wv1ed.html</url>
<vid>k00329wv1ed</vid>
<video_aspect_ratio>1.77799999714</video_aspect_ratio>
<video_checkup_time>2019-11-26 19:49:47</video_checkup_time>
<video_orc_datakey>vid=k00329wv1ed</video_orc_datakey>
<videotag>
<ts>
<t>
<cate>704</cate>
<did>36593342</did>
<gds>
<s>660000</s>
<sourceflag>1</sourceflag>
<t>2</t>
</gds>
<pt>660000</pt>
<ti>APP_BACKGROUND</ti>
<vbt>0</vbt>
<vet>0</vet>
</t>
</ts>
</videotag>
<view_all_count>11193278</view_all_count>
<vtags/>
<year/>
</fields>
<id>k00329wv1ed</id>
<retcode>0</retcode>
</results>
</root>

link字段是实际播放的vid
返回的link字段不知道是干啥的
id取535、672、733返回不同清晰度的大小
取647返回<container>mp4+ts+passlog+aac</container>字样
返回的是一些图片,最高720p。请求

http://union.video.qq.com/fcgi-bin/data?tid=1191&appid=10001005&appkey=0d1a9ddd94de871b&idlist=k00329wv1ed,

返回

This XML file does not appear to have any style information associated with it. The document tree is shown below.
<root>
<costtime>1114</costtime>
<errormsg/>
<errorno>0</errorno>
<resptime>1575017168</resptime>
<results>
<fields>
<best_pic_infos>
[{"848_480":"http://puui.qpic.cn/vpic/0/k00329wv1ed_848_480_1.jpg/0","640_360":"http://puui.qpic.cn/vpic/0/k00329wv1ed_640_360_1.jpg/0","score":1000,"id":1,"detect":{"push_black_rate":"0 0","qrcode_detected":0,"blackside_detected":0,"push_image_glass_ratio":"0","pos":"1","blurside_detected":0},"quality":50,"1280_720":"http://puui.qpic.cn/vpic/0/k00329wv1ed_1280_720_1.jpg/0"}]
</best_pic_infos>
<smart_pic_infos>
{"848_480":[{"url":"http://puui.qpic.cn/vpic/0/k00329wv1ed_848_480_1.jpg/0","score":1000,"pos":1,"quality":50},{"url":"http://puui.qpic.cn/vpic/0/k00329wv1ed_848_480_2.jpg/0","score":1000,"pos":2,"quality":50},{"url":"http://puui.qpic.cn/vpic/0/k00329wv1ed_848_480_3.jpg/0","score":1000,"pos":3,"quality":50},{"url":"http://puui.qpic.cn/vpic/0/k00329wv1ed_848_480_4.jpg/0","score":1000,"pos":4,"quality":50},{"url":"http://puui.qpic.cn/vpic/0/k00329wv1ed_848_480_5.jpg/0","score":1000,"pos":5,"quality":50},{"url":"http://puui.qpic.cn/vpic/0/k00329wv1ed_848_480_6.jpg/0","score":1000,"pos":6,"quality":50},{"url":"http://puui.qpic.cn/vpic/0/k00329wv1ed_848_480_7.jpg/0","score":1000,"pos":7,"quality":50},{"url":"http://puui.qpic.cn/vpic/0/k00329wv1ed_848_480_8.jpg/0","score":1000,"pos":8,"quality":10},{"url":"http://puui.qpic.cn/qqvideo_ori/0/k00329wv1ed_496_280/0","score":1000,"pos":0,"quality":50}],"detects":[{"push_black_rate":"0 0","qrcode_detected":0,"blackside_detected":0,"push_image_glass_ratio":"0","pos":"1","blurside_detected":0},{"push_black_rate":"0 0","qrcode_detected":0,"blackside_detected":0,"push_image_glass_ratio":"0","pos":"2","blurside_detected":0},{"push_black_rate":"0 0","qrcode_detected":0,"blackside_detected":0,"push_image_glass_ratio":"0","pos":"3","blurside_detected":0},{"push_black_rate":"0 0","qrcode_detected":0,"blackside_detected":0,"push_image_glass_ratio":"0","pos":"4","blurside_detected":0},{"push_black_rate":"0 0","qrcode_detected":0,"blackside_detected":0,"push_image_glass_ratio":"0","pos":"5","blurside_detected":0},{"push_black_rate":"0 0","qrcode_detected":0,"blackside_detected":0,"push_image_glass_ratio":"0","pos":"6","blurside_detected":0},{"push_black_rate":"0 0","qrcode_detected":0,"blackside_detected":0,"push_image_glass_ratio":"0","pos":"7","blurside_detected":0},{"push_black_rate":"36 0","blackside_data":{"width_percentage":0,"height_percentage":36},"qrcode_detected":0,"blackside_detected":1,"push_image_glass_ratio":"0","pos":"8","blurside_detected":0},{"push_black_rate":"0 0","qrcode_detected":0,"blackside_detected":0,"push_image_glass_ratio":"0","pos":"0","blurside_detected":0}],"640_360":[{"url":"http://puui.qpic.cn/vpic/0/k00329wv1ed_640_360_1.jpg/0","score":1000,"pos":1,"quality":50},{"url":"http://puui.qpic.cn/vpic/0/k00329wv1ed_640_360_2.jpg/0","score":1000,"pos":2,"quality":50},{"url":"http://puui.qpic.cn/vpic/0/k00329wv1ed_640_360_3.jpg/0","score":1000,"pos":3,"quality":50},{"url":"http://puui.qpic.cn/vpic/0/k00329wv1ed_640_360_4.jpg/0","score":1000,"pos":4,"quality":50},{"url":"http://puui.qpic.cn/vpic/0/k00329wv1ed_640_360_5.jpg/0","score":1000,"pos":5,"quality":50},{"url":"http://puui.qpic.cn/vpic/0/k00329wv1ed_640_360_6.jpg/0","score":1000,"pos":6,"quality":50},{"url":"http://puui.qpic.cn/vpic/0/k00329wv1ed_640_360_7.jpg/0","score":1000,"pos":7,"quality":50},{"url":"http://puui.qpic.cn/vpic/0/k00329wv1ed_640_360_8.jpg/0","score":1000,"pos":8,"quality":10},{"url":"http://puui.qpic.cn/qqvideo/0/k00329wv1ed/0","score":1000,"pos":0,"quality":50}],"1280_720":[{"url":"http://puui.qpic.cn/vpic/0/k00329wv1ed_1280_720_1.jpg/0","score":1000,"pos":1,"quality":50},{"url":"http://puui.qpic.cn/vpic/0/k00329wv1ed_1280_720_2.jpg/0","score":1000,"pos":2,"quality":50},{"url":"http://puui.qpic.cn/vpic/0/k00329wv1ed_1280_720_3.jpg/0","score":1000,"pos":3,"quality":50},{"url":"http://puui.qpic.cn/vpic/0/k00329wv1ed_1280_720_4.jpg/0","score":1000,"pos":4,"quality":50},{"url":"http://puui.qpic.cn/vpic/0/k00329wv1ed_1280_720_5.jpg/0","score":1000,"pos":5,"quality":50},{"url":"http://puui.qpic.cn/vpic/0/k00329wv1ed_1280_720_6.jpg/0","score":1000,"pos":6,"quality":50},{"url":"http://puui.qpic.cn/vpic/0/k00329wv1ed_1280_720_7.jpg/0","score":1000,"pos":7,"quality":50},{"url":"http://puui.qpic.cn/vpic/0/k00329wv1ed_1280_720_8.jpg/0","score":1000,"pos":8,"quality":10},{"url":"http://puui.qpic.cn/qqvideo_ori/0/k00329wv1ed_1280_720/0","score":1000,"pos":0,"quality":50}]}
</smart_pic_infos>
<title>庆余年_04</title>
</fields>
<id>k00329wv1ed</id>
<retcode>0</retcode>
</results>
</root>

获取弹幕,需要target_id和视频偏移时间,session_key会控制不同返回

https://mfm.video.qq.com/danmu?otype=json&callback=jQuery19105113893116358668_1575009929047&target_id=4456610069&session_key=0%2C0%2C0&timestamp=15&_=1575009929048

返回见链接:https://pastebin.com/kkraibYZ

生成指定内容的二维码

https://pay.video.qq.com/fcgi-bin/qrencode?isNeedShort=0&margin=3&url=从前

获取剧集详细信息

https://access.video.qq.com/pc_client/detail_intro?vappid=63524327&vsecret=03f74e77d53288bc0562697162d1642288fa11c7976c5859&vversion_name=5.4.0.1236&vplatform=1&g_tk=&g_vstk=1649211124&g_actk=592553318&cid=rjae621myqca41h&raw=1

获取合集信息,和最前面的类似

http://data.video.qq.com/fcgi-bin/data?tid=431&idlist=rjae621myqca41h&appid=10001005&appkey=0d1a9ddd94de871b