B站最新视频下载链接的获取

B站最新视频下载链接的获取

之前直接用的工具,发现21年的视频不能下载,得,还得自己分析一下

本文只讲方法,不提供工具,仅供学术研究~

1.获取视频的AID和CID

B站AID和CID的获取的本质(直接搜CID更方便)

B站最新视频下载链接的获取

偷懒工具:

B站最新视频下载链接的获取

2.解析视频

替换AID和CID:https://api.bilibili.com/x/player/playurl?avid={1}&cid={2}&qn=1&type=&otype=json&platform=html5&high_quality=1

通过浏览器拿到返回值:

{"code":0,"message":"0","ttl":1,"data":{"from":"local","result":"suee","message":"","quality":192,"format":"mp4720","timelength":3045000,"accept_format":"mp4720","accept_description":["高清 720P"],"accept_quality":[192],"video_codecid":7,"seek_param":"start","seek_type":"offset","durl":[{"order":1,"length":3045000,"size":716993619,"ahead":"","vhead":"","url":"https://upos-sz-mirrorcos.bilivideo.com/upgcxcode/02/15/315891502/315891502-1-192.mp4?e=ig8euxZM2rNcNbNz7WdVhwdlhbhBhwdVhoNvNC8BqJIzNbfq9rVEuxTEnE8L5F6VnEsSTx0vkX8fqJeYTj_lta53NCM=\u0026uipk=5\u0026nbs=1\u0026deadline=1642306699\u0026gen=playurlv2\u0026os=cosbv\u0026oi=3748392193\u0026trid=6b16b2feeedb48d5b448d8373e20367bT\u0026platform=html5\u0026upsig=bf7ce69d2e89bcbda89406bb8bd26fc1\u0026uparams=e,uipk,nbs,deadline,gen,os,oi,trid,platform\u0026mid=0\u0026bvc=vod\u0026nettype=0\u0026bw=235465\u0026orderid=0,1\u0026logo=80000000","backup_url":null}],"support_formats":[{"quality":192,"format":"mp4720","new_description":"720P 高清","display_desc":"720P","superscript":""}],"high_format":null}}

3.访问下载

只需要url里面的值,然后把转义字符\u0026还原成&

https://upos-sz-mirrorcos.bilivideo.com/upgcxcode/02/15/315891502/315891502-1-192.mp4?e=ig8euxZM2rNcNbNz7WdVhwdlhbhBhwdVhoNvNC8BqJIzNbfq9rVEuxTEnE8L5F6VnEsSTx0vkX8fqJeYTj_lta53NCM=&uipk=5&nbs=1&deadline=1642306699&gen=playurlv2&os=cosbv&oi=3748392193&trid=6b16b2feeedb48d5b448d8373e20367bT&platform=html5&upsig=bf7ce69d2e89bcbda89406bb8bd26fc1&uparams=e,uipk,nbs,deadline,gen,os,oi,trid,platform&mid=0&bvc=vod&nettype=0&bw=235465&orderid=0,1&logo=80000000

打开就可以下载视频了:

B站最新视频下载链接的获取

4.测试

随便点个2022的视频也是可以的:

B站最新视频下载链接的获取

B站最新视频下载链接的获取

上一篇:day17 定时任务crontab


下一篇:C++学习笔记(Day17 关联容器分类和的基本功能 )