bilibili API 合集 - 目录
番组
注意
本文中的“番组”包括番剧,电影,纪录片,电视剧,综艺,国创等
获取番组信息、剧集列表
https://api.bilibili.com/pgc/view/web/season?ep_id={ep_id}
请求方式:GET
返回类型:json
请求参数 | 说明 |
---|---|
ep_id | epid 号 |
返回参数 | 说明 |
---|---|
code | 状态码,0 为成功,非 0 为失败 |
areas | 地区 |
cover | 封面 |
evaluate | 简介 |
new_ep | 剧集完结信息 |
publish | 上线日期 |
rating | 评分 |
season_id | season_id 号 |
media_id | media_id 号 |
episodes | 剧集列表 |
season_title | 标题 |
subtitle | 小标题,即播放数 |
season | 系列 |
section | PV,特别企划等 |
stat | 播放数、点赞数、投币数、收藏数等数据 |
type | 番组类型 |
番组类型
type | 类型 |
---|---|
1 | 番剧 |
2 | 电影 |
3 | 纪录片 |
4 | 国创 |
5 | 电视剧 |
7 | 综艺 |
返回 json 示例 (精简):
{
"code": 0,
"message": "success",
"result": {
"areas": [
{
"id": 2,
"name": "日本"
}
],
"cover": "...",
"episodes": [
{
"aid": 253061930,
"bvid": "...",
"cid": 482236646,
"cover": "...",
"duration": 1421000,
"id": 450055,
"link": "...",
"long_title": "....",
"pub_time": 1641915000,
"pv": 0,
"release_date": "",
"rights": {
"allow_demand": 0,
"allow_dm": 1,
"allow_download": 0,
"area_limit": 0
},
"share_copy": "...",
"share_url": "...",
"short_link": "...",
"status": 13,
"subtitle": "已观看3105.4万次",
"title": "1",
"vid": ""
}
],
"evaluate": "...",
"media_id": 28235858,
"new_ep": {
"desc": "已完结, 全12话",
"id": 474222,
"is_new": 0,
"title": "12"
},
"publish": {
"is_finish": 1,
"is_started": 1,
"pub_time": "2022-01-11 23:30:00",
"pub_time_show": "01月11日23:30",
"unknow_pub_date": 0,
"weekday": 0
},
"rating": {
"count": 8597,
"score": 5.9
},
"season_id": 40154,
"season_title": "...",
"seasons": [
"..."
],
"section": [
"..."
],
"stat": {
"coins": 81315,
"danmakus": 156102,
"favorite": 24485,
"favorites": 1200168,
"likes": 397319,
"reply": 22737,
"share": 10809,
"views": 31054276
},
"subtitle": "已观看3105.4万次",
"title": "...",
"total": 12,
"type": 1
}
}
获取下载地址
https://api.bilibili.com/pgc/player/web/playurl?bvid={bvid}&cid={cid}&qn=0&fnver=0&fnval=4048&fourk=1
请求方式:GET
返回类型:json
请求参数 | 说明 |
---|---|
bvid | BV 号 |
cid | cid |
返回参数 | 说明 |
---|---|
accept_description | 清晰度 |
accept_quality | 清晰度 id |
video | 视频下载地址,id 为清晰度id,每种清晰度下面都有3个元素,分别是 AVC/H.264,HEVC/H.265,AV1 编码的下载地址,另外 baseUrl,base_url,backupUrl,backup_url 这些地址都是一样的,并无区别 |
audio | 音频下载地址,id 为清晰度 id 加上 30200 |
清晰度
id | 清晰度 |
---|---|
16 | 流畅 360P |
32 | 清晰 480P |
64 | 高清 720P |
80 | 高清 1080P |
112 | 高清 1080P+ |
116 | 高清 1080P60 |
120 | 超清 4K |
125 | 真彩 HDR |
127 | 超高清 8K |
注意
- 此接口默认最高能获取到 1080P 的清晰度,对于更高清晰度的视频,请求头中带上大会员 Cookie 中的 SESSDATA 字段即可下载
- 下载的视频和音频是分开的,需使用 ffmpeg 合成
- 下载视频和音频的请求头中还要带上 referer 才能下载
返回 json 示例 (精简):
{
"code": 0,
"message": "0",
"ttl": 1,
"data": {
"accept_description": [
"高清 1080P+",
"高清 1080P",
"高清 720P",
"清晰 480P",
"流畅 360P"
],
"accept_quality": [
112,
80,
64,
32,
16
],
"dash": {
"video": [
{
"id": 80,
"baseUrl": "...",
"base_url": "...",
"backupUrl": [
"...",
"..."
],
"backup_url": [
"...",
"..."
],
"mimeType": "video/mp4",
"mime_type": "video/mp4",
"codecs": "avc1.640032",
"width": 1920,
"height": 1080,
"frameRate": "25",
"frame_rate": "25"
},
{
"id": 80,
"baseUrl": "...",
"base_url": "...",
"backupUrl": [
"...",
"..."
],
"backup_url": [
"...",
"..."
],
"mimeType": "video/mp4",
"mime_type": "video/mp4",
"codecs": "hev1.1.6.L150.90",
"width": 1920,
"height": 1080,
"frameRate": "25",
"frame_rate": "25"
},
{
"id": 80,
"baseUrl": "...",
"base_url": "...",
"backupUrl": [
"...",
"..."
],
"backup_url": [
"",
""
],
"mimeType": "video/mp4",
"mime_type": "video/mp4",
"codecs": "av01.0.08M.08.0.110.01.01.01.0",
"width": 1920,
"height": 1080,
"frameRate": "25",
"frame_rate": "25"
},
...
...
],
"audio": [
{
"id": 30280,
"baseUrl": "...",
"base_url": "...",
"backupUrl": [
"...",
"..."
],
"backup_url": [
"...",
"..."
],
"mimeType": "audio/mp4",
"mime_type": "audio/mp4",
"codecs": "mp4a.40.2"
},
...
...
]
}
}
}
声明
本文由 Scott Sloan 原创,转载请标明原作者。