bilibili-API-collect/docs/video/player.md
Session小胡 60a0c5d1a2
feat: 各种接口补充与错误修正 (#1066)
* fix(video/collection.md): unclosed xml tags

* feat(video/report.md): uuid not really random

* feat: b23.tv short link

* feat: login/moral/exp log

* feat: v_voucher

* feat: upload video cover & post

* feat(creativecenter/upload.md): upload octet-stream

* feat(creativecenter/upload.md): update some notes

* feat(clientinfo/ip.md): another from live

* feat: live web heartbeat

* feat: update popular series & precious

* fix(creativecenter/upload.md): mistakes in example

* feat: merge duplicate fav info

* feat(README.md): missing link to webmask

* feat(search/hot.md): word_type

* feat(login/login_action): recovery old api

* feat(video/collection.md):  series operation

* feat: video season operation

* feat: add & mod some links

* feat(search/suggest.md): up to date

* feat: web home header image

* feat(misc/sign/bili_ticket.md): demo for nodejs

* feat(creativecenter/upload.md): x-upos-auth validity period

* feat: add referer & buvid3 to request header

* feat: customer service message heartbeat & upload

* feat(customerservice/msg.md): upload code 1200201

* feat(video/report.md): click/web/h5

* feat(video/report.md): view count desc

* feat: laser2

* feat: wbi_key in bili_ticket

* fix: typo & unclosed XML tags

* feat(misc/sign/v_voucher): cookie x-bili-gaia-vtoken

* feat(search/hot.md): square

* feat(video/status_number.md): fold archive_stat/stat

* feat(fav/info.md): resource/infos invalid type 21

* feat: /x/activity/subject/info

* feat: lottery

* feat(docs/misc/b23.tv): remove some unnecessary fields

* feat(creativecenter/upload.md): types/predict

* fix(video/collection.md): invalid end tag

* feat: app version upgrade

* feat(creativecenter/upload.md): tag/recommend #528

* feat(user/status_number.md): navnum

* feat: /x/activity/page/list

* feat(comment/list.md): desc about pagination_str

* feat(comment/list.md): update example

* feat(dynamic/all.md): #1082

* fix(comment/list.md): -352 not -412

* feat: #700

* feat(video/video_stream.md): #606 & cv949156

* feat(message/private_msg.md): single_unread freq

* feat: getUserWallet

* fix: broken form

* feat(Layout.vue): copyright to 2024

* feat: /x/topic/pub/rcmd/search

* feat: #425

* feat(misc/time_stamp.md): rtc/getTimestamp

* fix(misc/time_stamp.md): missing end tag

* feat: #745

* feat(dynamic/all.md): update feed/all

* feat(danmaku/action.md): #220

* feat(live/info.md): gethistory from cv8186413

* fix(danmaku/action.md): missing end tag
2024-08-21 19:02:39 +08:00

6.5 KiB
Raw Blame History

播放器

web 播放器信息

web 播放器的信息接口,提供正常播放需要的元数据,包括:智能防挡弹幕、字幕、章节看点等。

https://api.bilibili.com/x/player/wbi/v2

请求方式GET

url 参数:

参数名 类型 内容 必要性 备注
aid num 稿件 avid 必要 (可选) aid 与 bvid 任选
bvid str 稿件 bvid 必要 (可选) aid 与 bvid 任选
cid num 稿件 cid 必要
w_rid str WBI 签名 不必要
wts num 当前 unix 时间戳 不必要

json 回复:

根对象:

字段 类型 内容 备注
code num 返回值 0成功
-400请求错误
message str 错误信息 默认为 0
ttl num 1
data obj 数据本体

data 对象:

字段 类型 内容 备注
aid num 视频 aid
bvid str 视频 bvid
cid num 视频 cid
dm_mask obj webmask 信息(如果没有这一项,说明这个视频没有防挡功能)
subtitle obj 字幕信息(需要登录,不登录此项内容为 []
view_points array 章节看点信息
其他 ... 主要是观看记录、使用者等级权限、背景音乐等信息

dm_mask对象(如果有):

字段 类型 内容 备注
cid num 视频 cid
plat num 未知
fps num webmask 取样 fps
time num 未知
mask_url str webmask 资源 url

解析 webmask 请看 智能防挡弹幕

subtitle对象:

字段 类型 内容 备注
allow_submit bool true
lan str ""
lan_doc str ""
subtitles array 不登录为 []

subtitles 数组内的元素:

字段 类型 内容 备注
ai_status num
ai_type num
id num
id_str str 和 id 不一样
is_lock bool
lan str 语言类型英文字母缩写
lan_doc str 语言类型中文名称
subtitle_url str 资源 url 地址
type num 0

view_point 数组内的元素:

字段 类型 内容 备注
content num 章节名
from num
to num
type num
imgUrl str 图片资源地址
logoUrl str ""

示例:

curl -G "https://api.bilibili.com/x/player/wbi/v2?aid=515345690&cid=825851971"
{
    "code": 0,
    "message": "0",
    "ttl": 1,
    "data": {
        "aid": 515345690,
        "bvid": "BV1Fg411D7Jy",
        ... // 省略
        "dm_mask": {
            "cid": 825851971,
            "plat": 0,
            "fps": 30,
            "time": 0,
            "mask_url": "//upos-sz-staticcos-cmask.bilivideo.com/cmaskboss/825851971_30_0.webmask?trid=219266863a1442baa05086b4285ba923B&orderid=0,1&logo=00000000"
        },
        "view_points": [
            {
                "type": 2,
                "from": 0,
                "to": 27,
                "content": "狗啃的",
                "imgUrl": "http://i0.hdslb.com/bfs/vchapter/825851971_0.jpg",
                "logoUrl": ""
            },
            {
                "type": 2,
                "from": 27,
                "to": 63,
                "content": "椒牌泡菜",
                "imgUrl": "http://i0.hdslb.com/bfs/vchapter/825851971_27.jpg",
                "logoUrl": ""
            }, ... // 省略
        ],
        "subtitle": {
            "allow_submit": true,
            "lan": "",
            "lan_doc": "",
            "subtitles": [], // 未登录,下面是登录的版本
            "subtitles":[
                {
                    "id": 1042985852759993300,
                    "lan": "ai-zh",
                    "lan_doc": "中文(自动生成)",
                    "is_lock": false,
                    "subtitle_url": "//aisubtitle.hdslb.com/bfs/ai_subtitle/prod/5153456908258519712094280c7c2884b77929bab82f64530f?auth_key=1714795727-a8eb254b60bc4a73bc8662da51005340-0-1c305894e48e959979b163636461fb8f",
                    "type": 1,
                    "id_str": "1042985852759993344",
                    "ai_type": 0,
                    "ai_status": 2
                }
            ]
        }
    }
}

播放反馈

https://app.bilibili.com/x/resource/laser2

请求方式: POST

注: 该接口不传 Cookie

URL参数:

参数名 类型 内容 必要性 备注
mid num 当前用户 mid 不必要 未登录为空
buvid str BUVID (APP) 或 buvid3 (Web) 必要 可为任意非空字符串
app_key str APP 密钥 必要 Web: web_player
可为任意非空字符串
url str 日志 URL 非必要 上传接口 得到的 upos 协议 URL
task_type num 任务类型 非必要 300: 播放卡顿
301: 进度条君无法调戏
354: 校园网无法访问
303: 弹幕无法显示
553: 跳过首尾时间有误
304: 出现浮窗广告
305: 无限小电视
302: 音画不同步
306: 黑屏
307: 其他

JSON回复:

字段 类型 内容 备注
code num 返回值 0: 成功
-400: 请求错误
message str 错误信息 默认为 0
ttl num 1
data obj 数据本体

data 对象:

字段 类型 内容 备注
task_id num 任务 ID?

示例:

播放反馈无限小电视, 不登录, 不传文件, buvid 为 chenrui-in-icu

curl -X POST "https://app.bilibili.com/x/resource/laser2" \
--data-urlencode "buvid=chenrui-in-icu" \
--data-urlencode "app_key=web_player" \
--data-urlencode "task_type=305"
查看响应示例:
{
  "code": 0,
  "message": "0",
  "ttl": 1,
  "data": {
    "task_id": 850448532
  }
}