Skip to content

Commit

Permalink
调整部分接口描述与错误修复 (#1088)
Browse files Browse the repository at this point in the history
* fix(search/search_request.md): cookie buvid3

* feat(login/login_action/password.md): more sms desc

* fix: typo

* feat(live/info.md): add ps for getRoomBaseInfo

* fix(danmaku/action.md): broken form

* chore: Browserslist: caniuse-lite is outdated

* feat(comment/list.md): reply/wbi/main param next

* feat(misc/buvid3_4.md): get buvid3 only

* fix: broken links & wrong code type

* feat: close all img & br tags

* feat(login/cookie_refresh.md): missing demo links

* feat(dynamic/detail.md): /lottery_svr/v1/lottery_svr/lottery_notice

* fix(video/action.md): share cookie buvid3

* feat: deprecated stat & attribute

* feat(dynamic/detail.md): reaction

* feat(misc/sign/v_voucher.md): header

* feat(dynamic/detail.md): update detail params & example

* feat(APP_widget/ver.md): /x/v2/version

* feat(video/info.md): update view

* feat(docs/user.md): remove channel

* feat(search/search_request.md): search/type -1200

* feat(user/space.md): audio

* feat(video/player.md): /x/player/wbi/v2

* feat(audio/musicstream_url.md): update web/url

* feat(comment/readme.md): state

* fix(user/medal.md): wrong guard_level desc

* feat(live/message_stream.md): DANMU_MSG

* fix(user/medals): wrong guard_level & guard_icon desc

* feat(live/message_stream.md): format & add more 'cmd'

* feat(live/message_stream.md): add more 'cmd'

* feat(live/message_stream.md): add tips for non-login users

* feat(video/player.md): need_login_subtitle

---------

Co-authored-by: 社会易姐QwQ <[email protected]>
  • Loading branch information
SessionHu and SocialSisterYi authored Sep 19, 2024
1 parent 2dbdcd8 commit 1e24c6b
Show file tree
Hide file tree
Showing 32 changed files with 4,152 additions and 2,599 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<p align="center">
<img src="./assets/img/logo.png" width="250" height="200">
<img src="./assets/img/logo.png" width="250" height="200" />
</p>
<h1 align="center">哔哩哔哩-API收集整理</h1>
<p align="center" class="shields">
Expand All @@ -13,7 +13,7 @@
<img src="https://img.shields.io/github/forks/SocialSisterYi/bilibili-API-collect.svg" alt="GitHub forks"/>
</a>
<a href="https://github.com/SocialSisterYi/bilibili-API-collect/actions">
<img src="https://img.shields.io/github/actions/workflow/status/SocialSisterYi/bilibili-API-collect/vuepress-deploy.yml">
<img src="https://img.shields.io/github/actions/workflow/status/SocialSisterYi/bilibili-API-collect/vuepress-deploy.yml" />
</a>
<a href="https://github.com/SocialSisterYi/bilibili-API-collect/blob/master/LICENSE" style="text-decoration:none" >
<img src="https://img.shields.io/badge/License-CC%20BY--NC%204.0-lightgrey.svg" alt="GitHub license"/>
Expand Down Expand Up @@ -111,7 +111,7 @@ B站 API 采用 C/S 结构,大多数接口为 REST API 和 gRPC,少部分接
- [ ] [视频](docs/video)
- [x] [视频分区一览 (分区代码)](docs/video/video_zone.md)
- [x] [基本信息](docs/video/info.md)
- [x] [状态数](docs/video/status_number.md)
- [x] [状态数](docs/video/status_number.md) (已失效)
- [x] [快照](docs/video/snapshot.md)
- [x] [点赞 & 投币 & 收藏 & 分享](docs/video/action.md)
- [ ] [TAG](docs/video/tags.md)
Expand Down Expand Up @@ -312,7 +312,7 @@ protobuf 序列格式:[传送门](https://www.jianshu.com/p/a24c88c0526a )

## 💦交流

<img src="https://avatars.githubusercontent.com/u/45892418" width="100" height="100">
<img src="https://avatars.githubusercontent.com/u/45892418" width="100" height="100" />

⚠注意:开源社群欢迎交流探讨,**拒绝**咨询、**不支持**合作,**黑产号**一经发现立即拉黑并举报相关 SRC

Expand All @@ -327,7 +327,7 @@ protobuf 序列格式:[传送门](https://www.jianshu.com/p/a24c88c0526a )

WeChat & Alipay:

<img src="./assets/img/sponsorQR.jpg" width="300" height="300">
<img src="./assets/img/sponsorQR.jpg" width="300" height="300" />

OR Aifadian:[https://afdian.net/@ShakaiAneE](https://afdian.net/@ShakaiAneE)

Expand Down
95 changes: 83 additions & 12 deletions docs/APP_widget/ver.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,78 @@
# 获取最新 APP 版本

## 获取版本信息

> https://app.bilibili.com/x/v2/version
*请求方法: GET*

<!--{
"from": {
"url": "https://app.bilibili.com/"
}
}-->

**URL参数:**

| 参数名 | 类型 | 内容 | 必要性 | 备注 |
| --- | --- | --- | --- | --- |
| mobi_app | str | 目标客户端类型 | 不必要 | 留空为最新有更新的平台<br />android: Android 版<br />iphone: iPhone 版<br />ipad: iPad HD 版<br />win: UWP 版<br />android_tv_yst: TV 版<br />android_car: 车机版<br />pc_client: PC 客户端 |

**JSON回复:**

| 字段 | 类型 | 内容 | 备注 |
| --- | --- | --- | --- |
| code | int | 返回值 | 0: 成功 |
| message | str | 错误信息 | 默认为 `0` |
| ttl | int | 1 | |
| data | array | 版本信息列表 | |

`data` 数组中的对象:

| 字段 | 类型 | 内容 | 备注 |
| --- | --- | --- | --- |
| plat | int | 平台 | 0: Android<br />1: iPhone<br />2: iPad HD<br />3: UWP<br />12: TV 版<br />35: 车机版<br />40: PC 客户端 |
| desc | str | 版本描述 | |
| version | str | 版本号 | |
| build | int | 内部版本号 | |

**示例:**

```shell
curl -G 'https://app.bilibili.com/x/v2/version' \
--url-query'mobi_app=android'
```

<details>
<summary>查看响应示例:</summary>

```json
{
"code": 0,
"message": "0",
"ttl": 1,
"data": [
{
"plat": 0,
"desc": "-修复了一些bug,切了个大西瓜~",
"version": "8.9.0",
"build": 8090300,
"ptime": 1723612377
},
// ...
{
"plat": 0,
"desc": "[修正]横屏状态下,视频列表加载失败的问题\n[修正]超过48kHz采样率的音频无法播放的问题\n[修正]部分系统黑屏的问题\nPS:帮下面的同学祈祷早日上架",
"version": "2.0.4",
"build": 0,
"ptime": 1382630400
}
]
}
```

</details>

## 版本升级

> https://app.bilibili.com/x/v2/version/fawkes/upgrade
Expand Down Expand Up @@ -67,18 +140,16 @@

**示例:**

```sh
curl 'https://app.bilibili.com/x/v2/version/fawkes/upgrade' \
--url-query 'build=8000200' \
--url-query 'channel=master' \
--url-query 'mobi_app=android' \
--url-query 'ov=30' \
--url-query 'nt=1' \
--url-query 'sn=15088473' \
--url-query 'vn=8.0.0' \
--header 'app-key: android64' \
--header 'buvid: XU607DF6A8098F57B0BAF7FC107714C3035F0' \
--header 'user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36'
```shell
curl -G 'https://app.bilibili.com/x/v2/version/fawkes/upgrade' \
--url-query 'build=1145141' \
--url-query 'channel=apt' \
--url-query 'mobi_app=android' \
--url-query 'nt=awa' \
--url-query 'ov=qwq' \
--url-query 'platform=archlinux' \
--url-query 'sn=919810' \
--url-query 'vn=!!!'
```

<details>
Expand Down
2 changes: 1 addition & 1 deletion docs/activity/info.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
**URL参数:**

| 参数名 | 类型 | 内容 | 必要性 | 备注 |
| - | - | - | - | - | - | - |
| - | - | - | - | - |
| sid | num | 活动 id | 必要 | |
| bvid | str | 来源视频 bvid | 非必要 | |

Expand Down
71 changes: 36 additions & 35 deletions docs/audio/musicstream_url.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,18 @@
| 参数名 | 类型 | 内容 | 必要性 | 备注 |
| ------ | ---- | -------- | ------ | ---- |
| sid | num | 音频auid | 必要 | |
| quality | num | 2 | 不必要 | |
| privilege | num | 2 | 不必要 | |

**json回复:**

根对象:

| 字段 | 类型 | 内容 | 备注 |
| ---- | ---- | -------- | ----------------------------------------------------------- |
| code | num | 返回值 | 0:成功<br />7201006:未找到或已下架<br />72000000:请求错误 |
| msg | str | 错误信息 | 默认为success |
| code | num | 返回值 | 0: 成功<br />4511006: 已跳过无法播放的歌曲<br />7201006:未找到或已下架<br />72000000:请求错误 |
| message | str | 返回值 | 字符串形式的 code |
| msg | str | 返回信息 | 成功为 success |
| data | obj | 数据本体 | |

`data`对象:
Expand All @@ -45,50 +48,49 @@
| --------- | ----- | --------- | --------------------------------------- |
| sid | num | 音频auid | |
| type | num | 音质标识 | -1:试听片段(192K)<br />1:192K |
| info | str || **作用尚不明确** |
| info | str || |
| timeout | num | 有效时长 | 单位为秒<br />一般为3h |
| size | num | 文件大小 | 单位为字节<br />当`type`为-1时`size`为0 |
| cdns | array | 音频流url | |
| qualities | null | - | |
| title | null | - | |
| cover | null | - | |
| qualities | null | | |
| title | str | | |
| cover | str | | |

`data`对象的`cdns`数组:


|| 类型 | 内容 | 备注 |
| ---- | ---- | ------------- | ---- |
| 0 | str | 音频流url | |
| 1 | str | 备用音频流url | |
| 1 | str | 备用音频流url | 可能不存在 |

**示例:**

```shell
curl -G 'https://www.bilibili.com/audio/music-service-c/web/url' \
--data-urlencode 'sid=sid=15664'
--data-urlencode 'sid=777180'
```

<details>
<summary>查看响应示例:</summary>

```json
{
"code": 0,
"msg": "success",
"data": {
"sid": 15664,
"type": 1,
"info": "",
"timeout": 10800,
"size": 4853263,
"cdns": [
"https://upos-sz-mirrorkodo.bilivideo.com/ugaxcode/7bf6a3a3e94421ccc653f005457b1e8c-192k.m4a?deadline=1595331310&gen=uga&os=kodobv&uparams=deadline,gen,os&upsig=0ecd3c7a8d9539f260239d8fa4c093db",
"https://upos-sz-mirrorks3.bilivideo.com/ugaxcode/7bf6a3a3e94421ccc653f005457b1e8c-192k.m4a?deadline=1595331310&gen=uga&os=ks3bv&uparams=deadline,gen,os&upsig=f3fe53aff56655b1b7264ae4ab65872e"
],
"qualities": null,
"title": null,
"cover": null
}
"code": 0,
"data": {
"sid": 777180,
"title": "",
"cover": "",
"type": 1,
"info": "",
"timeout": 10800,
"size": 5579903,
"cdns": [
"https://upos-sz-mirrorcos.bilivideo.com/ugaxcode/m190314ws1dikiap1oivtapctuj1agjc-192k.m4a?e=ig8euxZM2rNcNbdlhoNvNC8BqJIzNbfqXBvEqxTEto8BTrNvN0GvT90W5JZMkX_YN0MvXg8gNEV4NC8xNEV4N03eN0B5tZlqNxTEto8BTrNvNeZVuJ10Kj_g2UB02J0mN0B5tZlqNCNEto8BTrNvNC7MTX502C8f2jmMQJ6mqF2fka1mqx6gqj0eN0B599M=&uipk=5&nbs=1&deadline=1725013547&gen=playurlv2&os=cosbv&oi=1746706124&trid=493923009cef4225ab8e1b9bda42c635B&mid=0&platform=pc&og=cos&upsig=043779511e2770cf6c3da04ed8a89f25&uparams=e,uipk,nbs,deadline,gen,os,oi,trid,mid,platform,og&bvc=vod&nettype=0&orderid=0,1&logo=00000000"
],
"qualities": null
},
"message": "0",
"msg": "success"
}
```

Expand Down Expand Up @@ -176,7 +178,7 @@ curl -G 'https://www.bilibili.com/audio/music-service-c/web/url' \
Cookie方式:

```shell
curl -G 'https://api.bilibili.com/audio/music-service-c/url
curl -G 'https://api.bilibili.com/audio/music-service-c/url' \
--data-urlencode 'songid=682118' \
--data-urlencode 'quality=3' \
--data-urlencode 'privilege=2' \
Expand All @@ -188,7 +190,7 @@ curl -G 'https://api.bilibili.com/audio/music-service-c/url
APP方式:

```shell
curl -G 'https://api.bilibili.com/audio/music-service-c/url
curl -G 'https://api.bilibili.com/audio/music-service-c/url' \
--data-urlencode 'access_key=xxx' \
--data-urlencode 'songid=682118' \
--data-urlencode 'quality=3' \
Expand Down Expand Up @@ -262,17 +264,16 @@ curl -G 'https://api.bilibili.com/audio/music-service-c/url

## 音频流的获取

`data`.`cdns`.`[0]``data`.`cdns`.`[1]`中的内容作为url进行GET操作
`data.cdns[n]` 作为 URL 进行 GET 操作

需要验证请求`user-agent` 不为空
需要验证请求头 `User-Agent` 不为空且不含敏感字串, 且 `Referer` 必须在 `.bilibili.com`

**user-agent错误并且referer不在`*.bilibili.com`域名下的情况下会导致403 Forbidden,故无法获取**
**示例:**

**以上述音频url为例:**
使用 cURL + FFPlay 直接从音频流播放

```shell
wget 'https://upos-sz-mirrorkodo.bilivideo.com/ugaxcode/m190102ws2pzf6jitbem841vq2x0du5x-flac.flac?deadline=1595332269&gen=uga&os=kodobv&uparams=deadline,gen,os&upsig=ac2284d97a61ef8758681eccf621c56d' \
-O 'Download_music.flac'
curl -G "https://upos-sz-mirrorcos.bilivideo.com/ugaxcode/7bf6a3a3e94421ccc653f005457b1e8c-192k.m4a?e=ig8euxZM2rNcNbdlhoNvNC8BqJIzNbfqXBvEqxTEto8BTrNvN0GvT90W5JZMkX_YN0MvXg8gNEV4NC8xNEV4N03eN0B5tZlqNxTEto8BTrNvNeZVuJ10Kj_g2UB02J0mN0B5tZlqNCNEto8BTrNvNC7MTX502C8f2jmMQJ6mqF2fka1mqx6gqj0eN0B599M=&uipk=5&nbs=1&deadline=1725013121&gen=playurlv2&os=cosbv&oi=1823807031&trid=1a4703f1e7344bb891691c5857e8cfb9B&mid=0&platform=pc&og=cos&upsig=e3a9fba59b46ab2720c8b1807844e9f3&uparams=e,uipk,nbs,deadline,gen,os,oi,trid,mid,platform,og&bvc=vod&nettype=0&orderid=0,1&logo=00000000" \
--referer 'https://www.bilibili.com/' -A 'Mozilla/5.0' \
--output - | ffplay -
```

响应正文将返回一个flac文件
2 changes: 1 addition & 1 deletion docs/blackroom/jury/judgement_info.md
Original file line number Diff line number Diff line change
Expand Up @@ -712,7 +712,7 @@ curl -G 'https://api.bilibili.com/x/credit/jury/caseList' \

| 字段 | 类型 | 内容 | 备注 |
| ------- | ------ | -------- | ------------------------------------------------- |
| code | num | 返回值 | 0:成功;<br>-400:`ps`参数大于可允许的最大值`20` |
| code | num | 返回值 | 0:成功;<br />-400:`ps`参数大于可允许的最大值`20` |
| message | str | 信息 | 默认为0 |
| ttl | num | 1 | 作用尚不明确 |
| data | object | 数据本体 | |
Expand Down
8 changes: 3 additions & 5 deletions docs/comment/list.md
Original file line number Diff line number Diff line change
Expand Up @@ -862,8 +862,6 @@ curl -G 'https://api.bilibili.com/x/v2/reply' \
*请求方式:GET*

认证方式:Cookie(SESSDATA)或APP

鉴权方式:[Wbi 签名](../misc/sign/wbi.md)

注: Wbi 签名错误时返回 -403 而非 -352
Expand All @@ -876,6 +874,7 @@ curl -G 'https://api.bilibili.com/x/v2/reply' \
| type | num | 评论区类型代码 | 必要 | [类型代码见表](readme.md#评论区类型代码) |
| oid | num | 目标评论区 id | 必要 | |
| mode | num | 排序方式 | 非必要 | 默认为 3<br />0 3:仅按热度<br />1:按热度+按时间<br />2:仅按时间 |
| next | num | 翻页 | 非必要 | 不推荐, 已弃用, 优先级比 `pagination_str`|
| pagination_str | obj | 分页信息 | 非必要 | 见下 |
| plat | num | 平台类型 | 非必要 |`1` |
| seek_rpid | str || 非必要 | 当获取第一页评论时存在 |
Expand All @@ -892,7 +891,7 @@ curl -G 'https://api.bilibili.com/x/v2/reply' \
| 参数名 | 类型 | 内容 | 备注 |
| ----- | ---- | -- | - |
| type | num | 类型 | 当 URL 参数 mode 为 2 时, 此项为 3<br />当 URL 参数 mode 为 3 时, 此项为 1 |
| direction | num | 1 | |
| direction | num | 方向 | 1: 正序(默认)<br />2: 倒序 |
| data | obj | 分页数据 | 当 type 为 1 时存在 |
| Data | obj | 分页数据 | 当 type 为 3 时存在 |
<!--not typo here-->
Expand Down Expand Up @@ -1054,8 +1053,7 @@ curl -G 'https://api.bilibili.com/x/v2/reply/wbi/main' \
--data-urlencode 'type=1' \
--data-urlencode 'mode=2' \
--data-urlencode 'w_rid=xxx' \
--data-urlencode 'wts=xxx' \
-b 'SESSDATA='
--data-urlencode 'wts=xxx'
```

<details>
Expand Down
2 changes: 1 addition & 1 deletion docs/comment/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
| count | num | 二级评论条数 | |
| rcount | num | 回复评论条数 | |
| floor | num | 评论楼层号 | **注:若不支持楼层则无此项** |
| state | num | (?) | |
| state | num | 评论状态 | 0: 正常<br />17: 被阿瓦隆系统隐藏 (无法被别人看到, 只能自己看到) |
| fansgrade | num | 是否具有粉丝标签 | 0:无<br />1:有 |
| attr | num | 某属性位? | |
| ctime | num | 评论发送时间 | 时间戳 |
Expand Down
2 changes: 1 addition & 1 deletion docs/creativecenter/upload.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ JavaScript (Node.js) 请求[示例](https://gist.github.com/SessionHu/5e47a3a1a3
curl -X POST --url 'https://member.bilibili.com/x/vupre/web/archive/types/predict' \
--url-query 'csrf=d51eadf05ba3bc6c5f76def7fbcc0185' \
--data-urlencode 'filename=' \
-b '
-b 'SESSDATA=xxx; bili_jct=xxx'
```

<details>
Expand Down
2 changes: 1 addition & 1 deletion docs/danmaku/action.md
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ curl 'https://api.bilibili.com/x/v2/dm/command/post' \
`data`对象:

| 字段 | 类型 | 内容 | 备注 |
| ---- | ---- |
| ---- | ---- | ---- | ---- |
| dmid | num | 弹幕dmid | |
| dmid_str | str | 弹幕dmid | 字串形式 |
| visible | bool | 是否可见 | |
Expand Down
Loading

0 comments on commit 1e24c6b

Please sign in to comment.