视频的播放源请求地址
https://app.bilibili.com/x/playurl?
device=android
&expire=0
&force_host=0
&session=76ef321c1786a658c3042b01acab083c
&mobi_app=android
&mid=0
&appkey=iVGUTjsxvpLeuDCf&fnval=16
&qn=32&npcybs=0&actionkey=appkey
&cid=55742838
&from_spmid=search.search-result.0.0
&otype=json
&platform=android
&ts=1555575788095&build=5400000
&fnver=0
&buvid=XZ590055864A901EC98C1AB6935097FA969B4
&aid=31873001
&spmid=main.ugc-video-detail.0.0
&sign=42b0264180d3bc1484568c810e1c6de9
如果你对这方面有兴趣,可以和我们一群程序员交流学习,共同进步
695623459
看到这样的请求,就意识到B站不好搞了,sign,凉凉
aid是视频id,换一个!果然。。。
{
"code": -3,
"message": "API校验密匙错误",
"ttl": 1
}
如果是正常请求
{
"code": 0,
"message": "0",
"ttl": 1,
"data": {
"from": "local",
"result": "suee",
"quality": 32,
"format": "flv480",
"timelength": 568301,
"accept_format": "flv,flv720,flv480,flv360",
"accept_description": ["高清 1080P", "高清 720P", "清晰 480P", "流畅 360P"],
"accept_quality": [80, 64, 32, 16],
"video_codecid": 7,
"fnver": 0,
"fnval": 16,
"video_project": true,
"seek_param": "start",
"seek_type": "offset",
"dash": {
"video": [{
"id": 16,
"base_url": "http://upos-hz-mirrorwcsu.acgvideo.com/upgcxcode/38/28/55742838/55742838-1-30015.m4s?e=ig8euxZM2rNcNbdlhoNvNC8BqJIzNbfqXBvEuENvNC8aNEVEtEvE9IMvXBvE2ENvNCImNEVEIj0Y2J_aug859r1qXg8xNEVE5XREto8GuFGv2U7SuxI72X6fTr859IB_\u0026deadline=1555585488\u0026gen=playurl\u0026nbs=1\u0026oi=3742042787\u0026os=wcsu\u0026platform=android\u0026trid=2fb7fb7056df4b76ae928a213b519628\u0026uipk=5\u0026upsig=b8c5bd2a8c4c638318ca4676af43dcd9\u0026uparams=e,deadline,gen,nbs,oi,os,platform,trid,uipk",
"bandwidth": 412782,
"codecid": 7
}, {
"id": 32,
"base_url": "http://upos-hz-mirrorbsyu.acgvideo.com/upgcxcode/38/28/55742838/55742838-1-30032.m4s?e=ig8euxZM2rNcNbdlhoNvNC8BqJIzNbfqXBvEuENvNC8aNEVEtEvE9IMvXBvE2ENvNCImNEVEIj0Y2J_aug859r1qXg8xNEVE5XREto8GuFGv2U7SuxI72X6fTr859IB_\u0026deadline=1555585488\u0026gen=playurl\u0026nbs=1\u0026oi=3742042787\u0026os=bsyu\u0026platform=android\u0026trid=2fb7fb7056df4b76ae928a213b519628\u0026uipk=5\u0026upsig=5de7c4ca3b3683912976294a31613cab\u0026uparams=e,deadline,gen,nbs,oi,os,platform,trid,uipk",
"bandwidth": 924854,
"codecid": 7
}, {
"id": 64,
"base_url": "http://upos-hz-mirrorks3u.acgvideo.com/upgcxcode/38/28/55742838/55742838-1-30064.m4s?e=ig8euxZM2rNcNbdlhoNvNC8BqJIzNbfqXBvEuENvNC8aNEVEtEvE9IMvXBvE2ENvNCImNEVEIj0Y2J_aug859r1qXg8xNEVE5XREto8GuFGv2U7SuxI72X6fTr859IB_\u0026deadline=1555585488\u0026gen=playurl\u0026nbs=1\u0026oi=3742042787\u0026os=ks3u\u0026platform=android\u0026trid=2fb7fb7056df4b76ae928a213b519628\u0026uipk=5\u0026upsig=c549a912a6550391b287d10a3c2a9e92\u0026uparams=e,deadline,gen,nbs,oi,os,platform,trid,uipk",
"bandwidth": 1513403,
"codecid": 7
}, {
"id": 80,
"base_url": "http://upos-hz-mirrorcosu.acgvideo.com/upgcxcode/38/28/55742838/55742838-1-30080.m4s?e=ig8euxZM2rNcNbdlhoNvNC8BqJIzNbfqXBvEuENvNC8aNEVEtEvE9IMvXBvE2ENvNCImNEVEIj0Y2J_aug859r1qXg8xNEVE5XREto8GuFGv2U7SuxI72X6fTr859IB_\u0026deadline=1555585488\u0026gen=playurl\u0026nbs=1\u0026oi=3742042787\u0026os=cosu\u0026platform=android\u0026trid=2fb7fb7056df4b76ae928a213b519628\u0026uipk=5\u0026upsig=851dc5a95a3816e87a093e358e6b6841\u0026uparams=e,deadline,gen,nbs,oi,os,platform,trid,uipk",
"bandwidth": 1517075,
"codecid": 7
}],
"audio": [{
"id": 30280,
"base_url": "http://upos-hz-mirrorks3u.acgvideo.com/upgcxcode/38/28/55742838/55742838-1-30280.m4s?e=ig8euxZM2rNcNbdlhoNvNC8BqJIzNbfqXBvEuENvNC8aNEVEtEvE9IMvXBvE2ENvNCImNEVEIj0Y2J_aug859r1qXg8xNEVE5XREto8GuFGv2U7SuxI72X6fTr859IB_\u0026deadline=1555585488\u0026gen=playurl\u0026nbs=1\u0026oi=3742042787\u0026os=ks3u\u0026platform=android\u0026trid=2fb7fb7056df4b76ae928a213b519628\u0026uipk=5\u0026upsig=aa9dc90f1ad8f3be3a3114b8a4d2806d\u0026uparams=e,deadline,gen,nbs,oi,os,platform,trid,uipk",
"bandwidth": 130927,
"codecid": 0
}, {
"id": 30216,
"base_url": "http://upos-hz-mirrorkodou.acgvideo.com/upgcxcode/38/28/55742838/55742838-1-30216.m4s?e=ig8euxZM2rNcNbdlhoNvNC8BqJIzNbfqXBvEuENvNC8aNEVEtEvE9IMvXBvE2ENvNCImNEVEIj0Y2J_aug859r1qXg8xNEVE5XREto8GuFGv2U7SuxI72X6fTr859IB_\u0026deadline=1555585488\u0026gen=playurl\u0026nbs=1\u0026oi=3742042787\u0026os=kodou\u0026platform=android\u0026trid=2fb7fb7056df4b76ae928a213b519628\u0026uipk=5\u0026upsig=f2952d81d700b53922f629baaa1f0d6c\u0026uparams=e,deadline,gen,nbs,oi,os,platform,trid,uipk",
"bandwidth": 67131,
"codecid": 0
}]
}
}
}
dash.video 中分别是4种不同清晰度的视频
清晰度id | 清晰度 | 格式 |
---|---|---|
80 | 高清 1080P | flv |
64 | 高清 720P | flv720 |
32 | 清晰 480P | flv480 |
16 | 流畅 360P | flv360 |
dash.audio 中分别是2个音频
音视频分离,然后客户端用定制的方法同步音视频
dash.video.base_url和dash.audio.base_url均为m4s格式
下载到本地后
ffmpeg -i input.m4s output.mp4