XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet
公开
关注 0 Fork 0 Star 0
README.md

哔哩哔哩 - API 收集整理

GitHub issues GitHub stars GitHub forks Build status GitHub license

Trendshift

野生 API 文档

不断更新中....

本项目旨在对 B 站 WEB、APP、TV 等客户端中,散落在世界各地的野生 API 进行收集整理,研究使用方法并对其进行说明,运用了黑箱法、控制变量法、代码逆向分析、拆包及反编译法、网络抓包法等研究办法

本文档探讨的对象是主站业务接口,官方开放平台直播开放平台 均不属于本项目范畴,请移步

B站 API 采用 C/S 结构,大多数接口为 REST API 和 gRPC,少部分接口为 WebSocket;REST API 接口请求数据大多为 url query 表单或 JSON,返回数据大多为 JSON 或 Protobuf,强制使用 https 协议

📖阅读地址:Github Pages

小小的 Demo:av583785685 视频失效原因 (Youtube 备链)

  1. 本项目遵守 CC-BY-NC 4.0 协议,禁止一切商业使用,如需转载请注明作者 ID
  2. 请勿滥用,本项目仅用于学习和测试!请勿滥用,本项目仅用于学习和测试!请勿滥用,本项目仅用于学习和测试!
  3. 利用本项目提供的接口、文档等造成不良影响及后果与本人无关
  4. 由于本项目的特殊性,可能随时停止开发或删档
  5. 本项目为开源项目,不接受任何形式的催单和索取行为,更不容许存在付费内容
  6. 上传任何信息时请注意脱敏,删去账户密码、敏感 cookies 等可能泄漏个人信息的数据(例如 SESSDATAbili_jct 之类的 cookies)

🌱参与贡献

欢迎各位 dalao 对本项目做出贡献,也希望每个使用者都能提出宝贵的意见

目前本项目存在的问题包括但不限于:

  1. 文档二级目录尚未完成
  2. 部分文档较旧,修改与更新没有跟进
  3. 目前文档使用 Markdown 语法编写,不易生成编程语言的 SDK,详见 #604

更多信息请浏览 贡献指南

🍴目录

计划整理分类 & 目录:(文档已完结请选中 checkbox)

✨鸣谢

你们的存在,让社区更美好

contributors

📖相关协议基础

HTTP 协议:传送门

JSON 序列格式:传送门

XML 序列格式:传送门

ProtoBuf 序列格式:传送门

💦交流

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

🧋发电

欢迎来交♂易,大家的支持就是我继续开发的动力!

请可爱的易姐喝杯奶茶

WeChat & Alipay:

OR Aifadian:https://afdian.com/@ShakaiAneE

🔗相关项目推荐

库及文档

成品

其他

  • kuresaru/geetest-validator: GeeTest 调试器
  • bloomrpc/bloomrpc: GUI Client for GRPC Services
  • grpc/grpc: The C based gRPC (C++, Python, Ruby, Objective-C, PHP, C#)
  • glideapps/quicktype: quicktype generates strongly-typed models and serializers from JSON, JSON Schema, TypeScript, and GraphQL queries, making it a breeze to work with JSON type-safely in many programming languages. 一键生成多种语言的JSON反序列化所需类,以便于快速反序列化,有网页版
  • SessionHu/json-apidoc-gen: Simple CLI tool for generating BAC document template
LICENSE

Creative Commons Attribution-NonCommercial 4.0 International

Creative Commons Corporation ("Creative Commons") is not a law firm and does not provide legal services or legal advice. Distribution of Creative Commons public licenses does not create a lawyer-client or other relationship. Creative Commons makes its licenses and related information available on an "as-is" basis. Creative Commons gives no warranties regarding its licenses, any material licensed under their terms and conditions, or any related information. Creative Commons disclaims all liability for damages resulting from their use to the fullest extent possible.

Using Creative Commons Public Licenses

Creative Commons public licenses provide a standard set of terms and conditions that creators and other rights holders may use to share original works of authorship and other material subject to copyright and certain other rights specified in the public license below. The following considerations are for informational purposes only, are not exhaustive, and do not form part of our licenses.

  • Considerations for licensors: Our public licenses are intended for use by those authorized to give the public permission to use material in ways otherwise restricted by copyright and certain other rights. Our licenses are irrevocable. Licensors should read and understand the terms and conditions of the license they choose before applying it. Licensors should also secure all rights necessary before applying our licenses so that the public can reuse the material as expected. Licensors should clearly mark any material not subject to the license. This includes other CC-licensed material, or material used under an exception or limitation to copyright. More considerations for licensors : wiki.creativecommons.org/Considerations_for_licensors

  • Considerations for the public: By using one of our public licenses, a licensor grants the public permission to use the licensed material under specified terms and conditions. If the licensor's permission is not necessary for any reason–for example, because of any applicable exception or limitation to copyright–then that use is not regulated by the license. Our licenses grant only permissions under copyright and certain other rights that a licensor has authority to grant. Use of the licensed material may still be restricted for other reasons, including because others have copyright or other rights in the material. A licensor may make special requests, such as asking that all changes be marked or described. Although not required by our licenses, you are encouraged to respect those requests where reasonable. More considerations for the public : wiki.creativecommons.org/Considerations_for_licensees

Creative Commons Attribution-NonCommercial 4.0 International Public License

By exercising the Licensed Rights (defined below), You accept and agree to be bound by the terms and conditions of this Creative Commons Attribution-NonCommercial 4.0 International Public License ("Public License"). To the extent this Public License may be interpreted as a contract, You are granted the Licensed Rights in consideration of Your acceptance of these terms and conditions, and the Licensor grants You such rights in consideration of benefits the Licensor receives from making the Licensed Material available under these terms and conditions.

  • Section 1 – Definitions.

      1. Adapted Material means material subject to Copyright and Similar Rights that is derived from or based upon the Licensed Material and in which the Licensed Material is translated, altered, arranged, transformed, or otherwise modified in a manner requiring permission under the Copyright and Similar Rights held by the Licensor. For purposes of this Public License, where the Licensed Material is a musical work, performance, or sound recording, Adapted Material is always produced where the Licensed Material is synched in timed relation with a moving image.
      1. Adapter's License means the license You apply to Your Copyright and Similar Rights in Your contributions to Adapted Material in accordance with the terms and conditions of this Public License.
      1. Copyright and Similar Rights means copyright and/or similar rights closely related to copyright including, without limitation, performance, broadcast, sound recording, and Sui Generis Database Rights, without regard to how the rights are labeled or categorized. For purposes of this Public License, the rights specified in Section 2(b)(1)-(2) are not Copyright and Similar Rights.
      1. Effective Technological Measures means those measures that, in the absence of proper authority, may not be circumvented under laws fulfilling obligations under Article 11 of the WIPO Copyright Treaty adopted on December 20, 1996, and/or similar international agreements.
      1. Exceptions and Limitations means fair use, fair dealing, and/or any other exception or limitation to Copyright and Similar Rights that applies to Your use of the Licensed Material.
      1. Licensed Material means the artistic or literary work, database, or other material to which the Licensor applied this Public License.
      1. Licensed Rights means the rights granted to You subject to the terms and conditions of this Public License, which are limited to all Copyright and Similar Rights that apply to Your use of the Licensed Material and that the Licensor has authority to license.
      1. Licensor means the individual(s) or entity(ies) granting rights under this Public License.
      1. NonCommercial means not primarily intended for or directed towards commercial advantage or monetary compensation. For purposes of this Public License, the exchange of the Licensed Material for other material subject to Copyright and Similar Rights by digital file-sharing or similar means is NonCommercial provided there is no payment of monetary compensation in connection with the exchange.
      1. Share means to provide material to the public by any means or process that requires permission under the Licensed Rights, such as reproduction, public display, public performance, distribution, dissemination, communication, or importation, and to make material available to the public including in ways that members of the public may access the material from a place and at a time individually chosen by them.
      1. Sui Generis Database Rights means rights other than copyright resulting from Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases, as amended and/or succeeded, as well as other essentially equivalent rights anywhere in the world.
      1. You means the individual or entity exercising the Licensed Rights under this Public License. Your has a corresponding meaning.
  • Section 2 – Scope.

      1. License grant.
        1. Subject to the terms and conditions of this Public License, the Licensor hereby grants You a worldwide, royalty-free, non-sublicensable, non-exclusive, irrevocable license to exercise the Licensed Rights in the Licensed Material to:
          1. reproduce and Share the Licensed Material, in whole or in part, for NonCommercial purposes only; and
          1. produce, reproduce, and Share Adapted Material for NonCommercial purposes only.
        1. Exceptions and Limitations. For the avoidance of doubt, where Exceptions and Limitations apply to Your use, this Public License does not apply, and You do not need to comply with its terms and conditions.
        1. Term. The term of this Public License is specified in Section 6(a).
        1. Media and formats; technical modifications allowed. The Licensor authorizes You to exercise the Licensed Rights in all media and formats whether now known or hereafter created, and to make technical modifications necessary to do so. The Licensor waives and/or agrees not to assert any right or authority to forbid You from making technical modifications necessary to exercise the Licensed Rights, including technical modifications necessary to circumvent Effective Technological Measures. For purposes of this Public License, simply making modifications authorized by this Section 2(a)(4) never produces Adapted Material.
        1. Downstream recipients.
          1. Offer from the Licensor – Licensed Material. Every recipient of the Licensed Material automatically receives an offer from the Licensor to exercise the Licensed Rights under the terms and conditions of this Public License.
          1. No downstream restrictions. You may not offer or impose any additional or different terms or conditions on, or apply any Effective Technological Measures to, the Licensed Material if doing so restricts exercise of the Licensed Rights by any recipient of the Licensed Material.
        1. No endorsement. Nothing in this Public License constitutes or may be construed as permission to assert or imply that You are, or that Your use of the Licensed Material is, connected with, or sponsored, endorsed, or granted official status by, the Licensor or others designated to receive attribution as provided in Section 3(a)(1)(A)(i).
      1. Other rights.
        1. Moral rights, such as the right of integrity, are not licensed under this Public License, nor are publicity, privacy, and/or other similar personality rights; however, to the extent possible, the Licensor waives and/or agrees not to assert any such rights held by the Licensor to the limited extent necessary to allow You to exercise the Licensed Rights, but not otherwise.
        1. Patent and trademark rights are not licensed under this Public License.
        1. To the extent possible, the Licensor waives any right to collect royalties from You for the exercise of the Licensed Rights, whether directly or through a collecting society under any voluntary or waivable statutory or compulsory licensing scheme. In all other cases the Licensor expressly reserves any right to collect such royalties, including when the Licensed Material is used other than for NonCommercial purposes.
  • Section 3 – License Conditions.

    Your exercise of the Licensed Rights is expressly made subject to the following conditions.

      1. Attribution.
        1. If You Share the Licensed Material (including in modified form), You must:
          1. retain the following if it is supplied by the Licensor with the Licensed Material:
            1. identification of the creator(s) of the Licensed Material and any others designated to receive attribution, in any reasonable manner requested by the Licensor (including by pseudonym if designated);
            1. a copyright notice;
            1. a notice that refers to this Public License;
            1. a notice that refers to the disclaimer of warranties;
            1. a URI or hyperlink to the Licensed Material to the extent reasonably practicable;
          1. indicate if You modified the Licensed Material and retain an indication of any previous modifications; and
          1. indicate the Licensed Material is licensed under this Public License, and include the text of, or the URI or hyperlink to, this Public License.
        1. You may satisfy the conditions in Section 3(a)(1) in any reasonable manner based on the medium, means, and context in which You Share the Licensed Material. For example, it may be reasonable to satisfy the conditions by providing a URI or hyperlink to a resource that includes the required information.
        1. If requested by the Licensor, You must remove any of the information required by Section 3(a)(1)(A) to the extent reasonably practicable.
        1. If You Share Adapted Material You produce, the Adapter's License You apply must not prevent recipients of the Adapted Material from complying with this Public License.
  • Section 4 – Sui Generis Database Rights.

    Where the Licensed Rights include Sui Generis Database Rights that apply to Your use of the Licensed Material:

      1. for the avoidance of doubt, Section 2(a)(1) grants You the right to extract, reuse, reproduce, and Share all or a substantial portion of the contents of the database for NonCommercial purposes only;
      1. if You include all or a substantial portion of the database contents in a database in which You have Sui Generis Database Rights, then the database in which You have Sui Generis Database Rights (but not its individual contents) is Adapted Material; and
      1. You must comply with the conditions in Section 3(a) if You Share all or a substantial portion of the contents of the database.

    For the avoidance of doubt, this Section 4 supplements and does not replace Your obligations under this Public License where the Licensed Rights include other Copyright and Similar Rights.

  • Section 5 – Disclaimer of Warranties and Limitation of Liability.

      1. Unless otherwise separately undertaken by the Licensor, to the extent possible, the Licensor offers the Licensed Material as-is and as-available, and makes no representations or warranties of any kind concerning the Licensed Material, whether express, implied, statutory, or other. This includes, without limitation, warranties of title, merchantability, fitness for a particular purpose, non-infringement, absence of latent or other defects, accuracy, or the presence or absence of errors, whether or not known or discoverable. Where disclaimers of warranties are not allowed in full or in part, this disclaimer may not apply to You.
      1. To the extent possible, in no event will the Licensor be liable to You on any legal theory (including, without limitation, negligence) or otherwise for any direct, special, indirect, incidental, consequential, punitive, exemplary, or other losses, costs, expenses, or damages arising out of this Public License or use of the Licensed Material, even if the Licensor has been advised of the possibility of such losses, costs, expenses, or damages. Where a limitation of liability is not allowed in full or in part, this limitation may not apply to You.
      1. The disclaimer of warranties and limitation of liability provided above shall be interpreted in a manner that, to the extent possible, most closely approximates an absolute disclaimer and waiver of all liability.
  • Section 6 – Term and Termination.

      1. This Public License applies for the term of the Copyright and Similar Rights licensed here. However, if You fail to comply with this Public License, then Your rights under this Public License terminate automatically.
      1. Where Your right to use the Licensed Material has terminated under Section 6(a), it reinstates:
        1. automatically as of the date the violation is cured, provided it is cured within 30 days of Your discovery of the violation; or
        1. upon express reinstatement by the Licensor.

      For the avoidance of doubt, this Section 6(b) does not affect any right the Licensor may have to seek remedies for Your violations of this Public License.

      1. For the avoidance of doubt, the Licensor may also offer the Licensed Material under separate terms or conditions or stop distributing the Licensed Material at any time; however, doing so will not terminate this Public License.
      1. Sections 1, 5, 6, 7, and 8 survive termination of this Public License.
  • Section 7 – Other Terms and Conditions.

      1. The Licensor shall not be bound by any additional or different terms or conditions communicated by You unless expressly agreed.
      1. Any arrangements, understandings, or agreements regarding the Licensed Material not stated herein are separate from and independent of the terms and conditions of this Public License.
  • Section 8 – Interpretation.

      1. For the avoidance of doubt, this Public License does not, and shall not be interpreted to, reduce, limit, restrict, or impose conditions on any use of the Licensed Material that could lawfully be made without permission under this Public License.
      1. To the extent possible, if any provision of this Public License is deemed unenforceable, it shall be automatically reformed to the minimum extent necessary to make it enforceable. If the provision cannot be reformed, it shall be severed from this Public License without affecting the enforceability of the remaining terms and conditions.
      1. No term or condition of this Public License will be waived and no failure to comply consented to unless expressly agreed to by the Licensor.
      1. Nothing in this Public License constitutes or may be interpreted as a limitation upon, or waiver of, any privileges and immunities that apply to the Licensor or You, including from the legal processes of any jurisdiction or authority.

Creative Commons is not a party to its public licenses. Notwithstanding, Creative Commons may elect to apply one of its public licenses to material it publishes and in those instances will be considered the "Licensor." The text of the Creative Commons public licenses is dedicated to the public domain under the CC0 Public Domain Dedication. Except for the limited purpose of indicating that material is shared under a Creative Commons public license or as otherwise permitted by the Creative Commons policies published at creativecommons.org/policies, Creative Commons does not authorize the use of the trademark "Creative Commons" or any other trademark or logo of Creative Commons without its prior written consent including, without limitation, in connection with any unauthorized modifications to any of its public licenses or any other arrangements, understandings, or agreements concerning use of licensed material. For the avoidance of doubt, this paragraph does not form part of the public licenses.

Creative Commons may be contacted at creativecommons.org.

CONTRIBUTING.md

贡献指南

欢迎来到 bilibili-API-collect 社区贡献指南,本文主要面向想要对本项目参与贡献的用户, 请务必认真阅读本文正文与潜在的注释

总则

bilibili-API-collect 项目(简称 BAC 或 b-a-c)是一个仅用于学习研究、社区开源、公益性质的 B 站(哔哩哔哩)API(应用程序接口)文档,使用 CC-BY-NC 4.0 协议开源,它将无差别收集整理相关的主站业务接口

该项目使用 Markdown 语法进行文档书写,按照业务类型及功能以路径文件形式索引,任何用户都可通过 Issue、Pull Request 与 Discussion 提供自己分析出的接口地址与使用说明。

本项目收集的接口类型包括但不限于 REST API、gRPC、WebSocket,文档内统一优先使用安全套接字协议,如 httpssecurityRpcwss

Issue、Discussion 与社群讨论

对文档内容存在不理解之处、以及发现文档内容有所缺失错误,可直接提出,强烈建议以提交 Issue 的形式 添加 / 补充 / 更新 文档中的说明,以发起 Discussion 的形式提出问题、代码用例、情报分享,并希望关于本项目的各种交流都是公开进行的,因为这样才可以保证关键信息的一致性。

提交 Issue 请遵守以下原则:

  1. 标题需要点明 API 的用处, <title> 要替换为标题主要内容而不是保留不动,切勿仅填写 补充修复,形式良好的标题可以是 [新增请求] 新增 xx 接口[更新请求] xx 接口地址已失效[更新请求] xx 接口的参数有变化
  2. 正文请按照 Issue 模板进行填写,标明 API 来源(Web、Android、iOS、TV 等)、API 类型(REST、gRPC、WebSocket 等)、API 地址
  3. 详情描述需要提供该 API 的使用场景、请求及响应字段等,可附上原始抓包记录 (文本格式优先);在更新时还需指出原文档中与最新 API 行为不符之处,并附上已知的最新改动。例如:“在前端页面某地址 / APP 某界面访问某 API(标明地址),它的某参数与文档中不符(标明文档地址)”

发起 Discussion 请遵守以下原则:

  1. 标题言简意骇,说明欲提出的问题要点,如 如何通过 xx 接口获取 yy关于 xx 字段意义的探讨建议将 xx 加入 yy 分类 等标题;切勿使用表意含糊不清或索取性的标题,如 怎么解决风控搜索的接口是什么好兄弟有没有投稿的接口 等标题
  2. Discussion 正文应对遇到的问题进行尽可能详细的描述,展开并聚焦有关的信息,例如: “按照文档中某位置的说明进行了某操作,为什么无法获得预期结果”、“请问某 API 的某字段的具体含义是什么”
  3. 提出问题时注意提问的智慧并且别像弱智一样提问

同时,您还可以通过加入社群的方式参与讨论

QQ 交流群为综合技术交流群(兼 Owner 的粉丝群),可交流探讨任何技术,包括但不限于 BAC 项目

Telegram 交流群主要用作 BAC 项目的 Github Bot 接收,也可以进行项目相关的讨论,但不建议在此讨论交流其他内容(公开群)

群内讨论同样需要遵守公开交流的原则,以及群内会定期清理不活跃成员。

QQ 交流群的加群问题答案可以去 Owner 的主页 Contact 部分找到,如果您填写“我不知道,从 Github 来的”那么管理员将有理由禁止您进群讨论!

项目 Issue 及其相关社群中禁止询问讨论 风控解除、爬虫(采集)、破解、漏洞利用、买卖代码和账号 相关内容,抵制基于本项目进行的一切黑产行为!

目录与路径结构

目录

文档目录以 Markdown 无序列表语法写在 README.md 中,使用缩进标识文档的层级,如 视频 下存在 基本信息快照视频推荐TAG 等子分类,使用 Markdown 复选框语法该标注文档是否编写完成, 新文档写完后记得在目录添加入口

- [ ] 视频
  - [x] 基本信息
  - [x] 快照
  - [x] 视频推荐
  - [ ] TAG

路径

路径层级应当与文档目录一致,以文件夹的形式存放在项目中的 /docs 路径下,命名统一使用英文小写,如 videodanmakucomment, 不建议出现 & 等特殊字符

二级、三级路径应当存在二级三级目录,可选添加 README.md 以描述该子目录

文件

各个子接口集整理为 Markdown (.md) 文件,命名统一使用英文小写,如 info.mdaction.mdlist.md

文档文件中用于存放相关的接口的说明,如 video/ 下的 info.md,存在 查询视频基本信息查询视频简介查询视频分P列表 等内容

Markdown 文档内容格式

文档使用 VuePress 生成,可以使用 VuePress Markdown 扩展语法编写

注:以下文档范式主要针对接口类文档, 可根据实际情况进行调整, 你也可以使用 json-apidoc-gen 工具直接生成模板自行填充内容. 非接口类文档, 如算法等, 可以参考已有的内容

头部

文档首行为一级标签格式标题,如 # 用户基本信息

文档头部不需要手写索引,索引由 VuePress 自动生成

接口说明

文档中可存在多个接口说明,应当遵守同一范式,依次排列在文档中

接口说明分为 标题地址说明请求参数响应正文示例 这些部分

接口标题为二级以下的标签,接口地址使用块引用语法,地址只保留 REST API 路径,不应携带 query 等内容

接口地址下方需要注明接口的请求方法,如 GETPOSTPUT 等,使用斜体语法

若接口存在认证或鉴权,需要在说明中注明,如 Cookie (SESSDATA)APP(认证是针对用户的,鉴权是针对接口使用的)

其他使用说明也可写在这里,如 限制游客访问的视频需要登录

e.g.:

## 获取视频详细信息_web端

> https://api.bilibili.com/x/web-interface/view

*请求方法: GET*

认证方式: Cookie (SESSDATA)

限制游客访问的视频需要登录

请求参数应在接口说明的下方,应注明参数类型 URL 参数或正文参数(正文参数应注明 Content-Type,如 application/x-www-form-urlencodedmultipart/form-data),使用加粗语法

对象的字段及其含义使用表格进行整理,表头统一依次为 参数名类型内容必要性备注,使用 objectnumberstringbooleannumber[]string[]file 等这种类似 TypeScript 的类型系统,必要性为 必要非必要必要 (可选) 等,表格内每个字段为一行

e.g.:

参数名 类型 内容 必要性 备注
aid num 稿件 avid 必要 (可选) avid 与 bvid 任选
bvid str 稿件 bvid 必要 (可选) avid 与 bvid 任选

响应正文应在请求参数的下方,接口响应的数据格式应标注,如 JSON 回复XML 回复ProtoBuf 回复,使用加粗语法

JSON Object 或 ProtoBuf Message 应以对象的表格形式书写,表头为 根对象xx 中的 yy 对象xx.yy.zz 对象,若对象位于数组中则为 xx 数组中的对象xx[] 中的对象

表头统一依次为 字段类型内容备注,类型为 JSON / Protobuf 的标准类型,具体同请求参数一致

不明确定义的字段说明在内容的末尾添加问号,如 播放数?;定义尚未明确的字段使用 (?) 在内容中占位,并在备注中填写 作用尚不明确

多个对象及数组,使用遍历树的顺序进行排列, 若数组中的每一项结构均相同也可以直接省略为像 xxx 数组中的对象 这样的格式

e.g.:

data 对象:

字段 类型 内容 备注
bvid str 稿件 bvid
aid num 稿件 avid
videos num 稿件分P总数 默认为 1
tid num 分区 tid
no_cache bool (?) 作用尚不明确

Json Array 或 ProtoBuf Repeated 类型使用数组的表格形式书写,表头统一依次为 类型内容备注,无限长度数组表尾需要添加省略号

数组每项内容若与实际数据有关联,内容 字段则可标为 (n+1)P 视频内容 这样的形式

e.g.:

data 中的 pages 数组:

类型 内容 备注
0 obj 1P 视频内容 无分 P 仅有此项
n obj (n+1)P 视频内容
…… obj …… ……

示例部分位于所有响应正文部分下方,需要加粗格式,分为请求命令示例与响应体示例两部分

请求命令示例为一段可测试该接口的 cURL 命令或某种编程语言的代码,使用代码块语法书写,命令应当尽可能简短、便于使人阅读, 代码缩进为 2空格 (U+0020)

示例命令中的认证信息应做脱敏处理,如 Cookie、Token、access_key 等,可替换为 xxx 占位

示例命令前后可以适当添加一些文字说明

响应体示例为一段格式化后的 JSON 或 ProtoBuf Message,使用代码块语法书写, 代码块语言填写清楚, 注意 json jsonc 区别. 并使用 <details> 标签进行折叠, 仍一律使用 2空格 进行缩进

e.g.:

**示例:**

获取视频 `av85440373` 的基本信息

```shell
curl -G 'https://api.bilibili.com/x/web-interface/view' \
	--data-urlencode 'aid=85440373'
```

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

```jsonc
{
  "code": 0,
  "message": "0",
  "ttl": 1,
  "data": {
    "bvid": "BV117411r7R1",
    "aid": 85440373,
    "videos": 1,
    "tid": 28,
    "tname": "原创音乐",
    "copyright": 1,
    // ...
  }
}
```

</details>

枚举值与属性位

接口返回或请求中若存在一些 enum 类型或二进制属性位,应当单独进行探讨,如视频的属性位 attribute 或视频清晰度 qn

这些值及其说明使用表格进行整理,表头统一为 / 代码 / 含义备注

这些枚举值或属性位的用法应附加文字说明

e.g.:

含义 备注
6 240P 极速 仅 MP4 格式支持
platform=html5 时有效
16 360P 流畅
32 480P 清晰
64 720P 高清 WEB 端默认值
B 站前端需要登录才能选择,但是直接发送请求可以不登录就拿到 720P 的取流地址
无 720P 时则为 720P60
74 720P60 高帧率 需要登录认证
80 1080P 高清 TV 端与 APP 端默认值
需要登录认证

Proto 定义格式

proto 文件为 Protocol Buffers 以及 gRPC 的数据结构体定义,多用于客户端的接口,本文档也做相关的收集

存放于项目的 /grpc_api 路径下,使用包名进行路径层级的组织,如:

/grpc_api/bilibili/main/community/reply/v1/reply.proto
/grpc_api/bilibili/app/archive/v1/archive.proto
/grpc_api/bilibili/app/view/v1/view.proto

proto 文件内使用单行注释标注字段或对象的含义,如:

// UP主信息
message Author {
	// UP主mid
	int64 mid = 1;
	// UP主昵称
	string name = 2;
	// UP主头像url
	string face = 3;
}

文档提交

拉取 (Pull) 与 提交 (Commit)

本项目仓库仅托管于 GitHub, 使用 Git 作为版本控制系统, 你需要对两者有基础的了解

请先 fork, 然后在自己的 fork 上进行修改

提交的标题不要使用默认的 Update xxx, 请遵循 Conventional Commits (约定式提交) 规范, 标题语言可根据个人习惯

当发现远程与本地仓库不一致时, 若你操作的 fork 的 branch 无打开的 PR, 建议使用变基拉取, 而不是生成一个额外的合并提交的合并拉取, 反之则相反

移动文件请使用 git mv, 而不是删除并添加同一个文件于不同位置 (该问题在 VSCode 的 GUI 版 Git 中存在), 以便后续 blame 操作

拉取请求 (Pull Request)

使用 拉取请求 (Pull Request, PR) 将修改后的文档提交到 master 分支,标题需写明修改或新增的内容, 同样也需要遵循约定式提交规范, gh_pages 分支将在 PR 合并后自动更新

如果你还没有完成计划的全部修改, 请创建 Draft Pull Request 表示你还没有做好被合并的准备 (抢占先机, 精神可嘉, 值得鼓励)

PR 正文使用 无序列表 写明更改的每一项内容, 可以使用复选框表明进度, 需要关闭的 Issue 请使用 close #xxxx 这样的格式一并包含在内

如果内容包含代码等, 请一并提供测试的输入与输出的文本或截图, 最好可以附上完整的测试环境及相关可执行文件等

PR 合并后, 请及时删除或更新分支. 特别是在使用压缩合并或变基合并后, 请 Discard changes 或直接删除分支, 以免在下一次 PR 后出现重复相同提交的问题