Skip to content

Releases: Nemo2011/bilibili-api

v18.0.0.a1 2026/01/01

01 Jan 11:43

Choose a tag to compare

v18.0.0.a1 2026/01/01 Pre-release
Pre-release

应该有人注意到 dev-dyn-fp 分支了。这里正进行着许多对模块功能大胆的尝试。目前阶段成品便是这个 pre-release。

总之变化很多,一时半会儿写不完(懒),有时间会在这里补充。主要会以代码示例形式体现。

总之先发出来。Docs

安装:pip3 install bilibili-api-dev。或者通过远程储存库 dev-dyn-fp 分支安装。

现在是写好一份介绍了,但有亿点长。不过首先是发布的版本有点小问题:

一些注意事项

模块 metadata 中遗漏了一项依赖:chompjs,若从 pypi 安装模块需要单独补上。

Major changes

fpgen 支持 in #973

运行前需要安装 fpgen 和 curl_cffi。亦可 pip3 install bilibili-api-dev[fingerprint]

fpgen 可以通过对应参数生成浏览器指纹。详细信息可见 https://github.com/scrapfly/fingerprint-generator。启用 fpgen 后激活 buvid 提供的指纹信息会采用 fpgen 生成的结果,请求时也会加上 fpgen 生成的请求头。

import json
from pprint import pprint

from bilibili_api import get_buvid, request_log, request_settings, select_client, sync


async def main() -> None:
    @request_log.on("REQUEST")
    def handle(desc: str, data: dict) -> None:
        if (
            data["url"]
            == "https://api.bilibili.com/x/internal/gaia-gateway/ExClimbWuzhi"
        ):
            payload = data["data"]
            pprint(json.loads(json.loads(payload)["payload"]))

    select_client("curl_cffi")
    request_settings.set_enable_fpgen(True)
    request_settings.set_fpgen_args(
        {
            "strict": True,
            "browser": "Firefox",
            "os": "Linux",
        }
    )
    await get_buvid()


sync(main())

可以发现激活 buvid 使用的 payload 会随着参数产生变化。

展开输出示例
{'03bf': 'https%3A%2F%2Fwww.bilibili.com%2F',
 '07a4': 'pl-PL',
 '3064': 1,
 '34f1': '',
 '39c8': '333.1007.fp.risk',
 '3c43': {'07a4': 'pl-PL',
          '097b': 0,
          '0bd0': 16,
          '13ab': 'VM0qCTq7dkX8Q5b+',
          '1c57': 'undefined',
          '2673': 0,
          '3b21': 1,
          '52cd': [0, 0, 0],
          '5766': 24,
          '641c': 0,
          '6527': 0,
          '6aa9': 'Asia/Shanghai',
          '6bc5': 'AMD~Radeon HD 3200 Graphics, or similar',
          '7003': 1,
          '72bd': 0,
          '748e': [1920, 1200],
          '75b8': 1,
          '807e': 1,
          '80c9': [['PDF Viewer',
                    'Portable Document Format',
                    [['application/pdf', 'pdf'], ['text/pdf', 'pdf']]],
                   ['Chrome PDF Viewer',
                    'Portable Document Format',
                    [['application/pdf', 'pdf'], ['text/pdf', 'pdf']]],
                   ['Chromium PDF Viewer',
                    'Portable Document Format',
                    [['application/pdf', 'pdf'], ['text/pdf', 'pdf']]],
                   ['Microsoft Edge PDF Viewer',
                    'Portable Document Format',
                    [['application/pdf', 'pdf'], ['text/pdf', 'pdf']]],
                   ['WebKit built-in PDF',
                    'Portable Document Format',
                    [['application/pdf', 'pdf'], ['text/pdf', 'pdf']]]],
          '8a1c': 0,
          'a3c1': ['extensions:ANGLE_instanced_arrays;EXT_blend_minmax;EXT_color_buffer_half_float;EXT_float_blend;EXT_frag_depth;EXT_shader_texture_lod;EXT_sRGB;EXT_texture_compression_bptc;EXT_texture_compression_rgtc;EXT_texture_filter_anisotropic;OES_element_index_uint;OES_fbo_render_mipmap;OES_standard_derivatives;OES_texture_float;OES_texture_float_linear;OES_texture_half_float;OES_texture_half_float_linear;OES_vertex_array_object;WEBGL_color_buffer_float;WEBGL_compressed_texture_astc;WEBGL_compressed_texture_etc;WEBGL_compressed_texture_s3tc;WEBGL_compressed_texture_s3tc_srgb;WEBGL_debug_renderer_info;WEBGL_debug_shaders;WEBGL_depth_texture;WEBGL_draw_buffers;WEBGL_lose_context',
                   'webgl aliased line width range:[1, 2048]',
                   'webgl aliased point size range:[0.125, 2048]',
                   'webgl alpha bits:8',
                   'webgl antialiasing:yes',
                   'webgl blue bits:8',
                   'webgl depth bits:24',
                   'webgl green bits:8',
                   'webgl max anisotropy:16',
                   'webgl max combined texture image units:192',
                   'webgl max cube map texture size:16384',
                   'webgl max fragment uniform vectors:4096',
                   'webgl max render buffer size:16384',
                   'webgl max texture image units:32',
                   'webgl max texture size:16384',
                   'webgl max varying vectors:32',
                   'webgl max vertex attribs:16',
                   'webgl max vertex texture image units:32',
                   'webgl max vertex uniform vectors:4096',
                   'webgl max viewport dims:[16384, 16384]',
                   'webgl red bits:8',
                   'webgl renderer:Radeon HD 3200 Graphics, or similar',
                   'webgl shading language version:WebGL GLSL ES 1.0',
                   'webgl stencil bits:0',
                   'webgl vendor:Mozilla',
                   'webgl version:WebGL 1.0',
                   'webgl unmasked vendor:AMD',
                   'webgl unmasked renderer:Radeon HD 3200 Graphics, or '
                   'similar',
                   'webgl vertex shader high float precision:23',
                   'webgl vertex shader high float precision rangeMin:127',
                   'webgl vertex shader high float precision rangeMax:127',
                   'webgl vertex shader medium float precision:23',
                   'webgl vertex shader medium float precision rangeMin:127',
                   'webgl vertex shader medium float precision rangeMax:127',
                   'webgl vertex shader low float precision:23',
                   'webgl vertex shader low float precision rangeMin:127',
                   'webgl vertex shader low float precision rangeMax:127',
                   'webgl fragment shader high float precision:23',
                   'webgl fragment shader high float precision rangeMin:127',
                   'webgl fragment shader high float precision rangeMax:127',
                   'webgl fragment shader medium float precision:23',
                   'webgl fragment shader medium float precision rangeMin:127',
                   'webgl fragment shader medium float precision rangeMax:127',
                   'webgl fragment shader low float precision:23',
                   'webgl fragment shader low float precision rangeMin:127',
                   'webgl fragment shader low float precision rangeMax:127',
                   'webgl vertex shader high int precision:0',
                   'webgl vertex shader high int precision rangeMin:24',
                   'webgl vertex shader high int precision rangeMax:24',
                   'webgl vertex shader medium int precision:0',
                   'webgl vertex shader medium int precision rangeMin:24',
                   'webgl vertex shader medium int precision rangeMax:24',
                   'webgl vertex shader low int precision:0',
                   'webgl vertex shader low int precision rangeMin:24',
                   'webgl vertex shader low int precision rangeMax:24',
                   'webgl fragment shader high int precision:0',
                   'webgl fragment shader high int precision rangeMin:24',
                   'webgl fragment shader high int precision rangeMax:24',
                   'webgl fragment shader medium int precision:0',
                   'webgl fragment shader medium int precision rangeMin:24',
                   'webgl fragment shader medium int precision rangeMax:24',
                   'webgl fragment shader low int precision:0',
                   'webgl fragment shader low int precision rangeMin:24',
                   'webgl fragment shader low int precision rangeMax:24'],
          'a658': ['Abyssinica SIL',
                   'Caladea',
                   'Cantarell',
                   'Cantarell Extra Bold',
                   'Cantarell Light',
                   'Cantarell Thin',
                   'Carlito',
                   'D050000L',
                   'DejaVu Sans',
                   'DejaVu Sans Condensed',
                   'DejaVu Sans Mono',
                   'DejaVu Serif',
                   'DejaVu Serif Condensed',
                   'Droid Sans',
                   'Jomolhari',
                   'Khmer OS Content',
                   'Khmer OS System',
                   'Liberation Mono',
                   'Liberation Sans',
                   'Liberation Serif',
                   'Lohit Assamese',
                   'Lohit Bengali',
                   'Lohit Devanagari',
                   'Lohit Gujarati',
                   'Lohit Gurmukhi',
                   'Lohit Kannada',
                   'Lohit Odia',
                   'Lohit Tamil',
                   'Lohit Telugu',
                   'Meera',
                   'Montserrat Black',
                   'Montserrat ExtraBold',
                   'Montserrat ExtraLight',
                   'Montserrat Light',
                   'Montserrat Medium',
                   'Montserrat SemiBold',
                   'Montserrat Thin',
                   'Noto Color Emoji',
                   'Noto Emoji',
                   'Nuosu SIL',
                   'OpenSymbol',
                   'PT Sans',
                   'PT Sans Bold',
                   'PT Sans Bold Italic',
                   'PT Sans Caption',
                   'PT Sans Caption Bold',
                   'PT Sans Italic',
                   'Padauk',
                   'PakType Naskh Basic',
                   'Rachana',
                   'STIX',
                   'Source Code Pro',
                   'Source Code Pro Black',
                   'Source Code Pro ExtraLight',
                   'Source Code Pro Light',
                   'Source Code Pro Medium',
                   'Source Cod...
Read more

v17.4.1 2025/12/20

20 Dec 10:59

Choose a tag to compare

What's Changed

  • feat: 视频上传支持水印
  • fix: live_area.get_list_by_area 重构了 initial_state webid 相关
  • feat: client.get_zone_live
  • fix(parser): isfunction return False for class method #724 by @phanen and @Drelf2018 in #987
  • fix!: BiliAPIClient 添加 download_close 函数 (此处更改不影响任何高层级 api 的使用)
  • fix: session.fetch_session_msgs #989
  • feat(ass): 新增 ass.AssSubtitleObject 增加字幕格式的输出 by @STHUDY in #990
  • feat: 添加充电问答相关api by @Cherrysaber in #993

New Contributors

Full Changelog: 17.4.0...17.4.1

v17.4.0

08 Oct 05:26

Choose a tag to compare

What's Changed

  • chore(deps): 删除模块所有依赖项的版本限制 from [#962]
  • feat(live): 直播间 INTERACT_WORD ONLINE_RANK_V3 返回 protobuf 数据解析
  • feat(Picture): 新增 to_json 函数,提供图片链接/长宽/大小
  • feat(emoji/dynamic/comment/Credential) by @sakmist in [#958]
    • 新增添加表情包功能
    • 优化 @ 提及功能
    • 新增发送评论附带图片功能
    • 可在 Credential 内携带代理
  • feat(video): 添加视频观看数据上报 相关接口 from [#974] in [#975] by @shenghuang147
  • feat(video): Video.get_download_url 新增 html5 参数,获取的媒体流无需鉴权即可访问
  • fix(live): RECALL_DANMU_MSG 事件的处理有疏漏 from [#965] in [#966] by @Alkaid-C
  • fix(session): session.get_at 函数的 last_uid 参数改为 last_idlast_uid 参数暂时保留,会在将来版本中删除。
  • fix(video): update get_all_followings api in [#977] by @GKarbon
  • fix(user): 获取用户 access_id 时带上 Credential in [#978] by @junyilou
  • fix(video / bangumi): Remove default voice_balance parameter to prevent it from being enabled by default in [#972] by @skbeh
  • docs: 登陆 -> 登录 by @LondonClass in [#967]

New Contributors

Full Changelog: 17.3.0...17.4.0

v17.3.0

30 Jun 13:20

Choose a tag to compare

v17.3.0 2025/06/30

  • feat: (取消)置顶动态
  • feat: 创作中心稿件相关
  • feat: 装扮/收藏集模块
  • fix: request_settings.set 设置非通用属性可能报错
  • fix: rank 相关接口风控
  • fix: 修复 CurlCFFIClient 高 CPU 占用 by @Shironobako in #946
  • fix: 更新投诉稿件 API by @CoderTCY in #947
  • fix: LiveDanmaku 中获取用户信息时添加报错日志/重试功能 by @Alkaid-C in #943
  • fix: LiveRoom start/stop 需鉴权 by @whille in #949
  • docs: User.get_dynamics(_new) typing

New Contributors

Full Changelog: 17.2.1...17.3.0

v17.2.1

30 May 14:34

Choose a tag to compare

v17.2.1 2025/05/30

  • chore: pyproject.toml
  • fix: LiveDanmaku.credential 后赋值导致无法连接 #936

v17.2.0

25 May 10:34

Choose a tag to compare

  • chore(deps): pycryptodomex from ~=3.21.0 to ~=3.23.0

  • chore(deps): qrcode from ~=8.0 to ~=8.2

  • chore(deps): lxml from ~=5.3.1 to ~=5.4.0

  • chore(deps): pillow from ~= 11.1.0 to ~=11.2.1

  • chore(deps): beautifulsoup4 from ~=4.13.3 to ~=4.13.4

  • chore(deps): yarl from ~=1.18.3 to ~=1.20.0

  • fix: live_area.get_list_by_area credential & wbi in #901 #907

  • fix: Credential.from_cookies in #906

  • fix: live.LiveDanmaku ws_close KeyError in #908

  • fix: homepage.get_videos 新接口 in #904

  • fix: PEP 621 影响 uv add 安裝软件包 in #919 #920 by @JaydenChao101

  • fix: live.LiveDanmaku 不明确的信息 in #913 following #913 (comment) by @rebasecontinue

  • fix: NetworkException 消失 in #929

  • fix: RankType 参数 in #928

  • fix: json 中的 http 链接 & allow_redirects 默认为 False in #932

  • fix(CurlCFFIClient): return BiliWsMsgType.CLOSED when CURLE_GOT_NOTHING

  • fix: ass 于 windows 上触发 gbk in #916

  • fix: 直播相关问题 #934

  • feat: Article.get_detail

  • feat: video.VideoQuality.AI_REPAIR

New Contributors

Full Changelog: 17.1.4...17.2.0

v17.1.4

16 Mar 14:50

Choose a tag to compare

v17.1.4 2025/03/16

  • feat: opus.Opus.get_images, opus.Opus.get_images_raw_info
  • feat: module activity
  • fix: favorite_list related in #898
  • feat: centered paragraph of opus

v17.1.3

01 Mar 12:47

Choose a tag to compare

  • [BREAKING CHANGE]: curl_cffi 不再默认模仿 chrome131,如需模仿浏览器需要手动设置(request_settings.set("impersonate", "xxx")
  • fix: 代码弹幕 mode8 in DmMode
  • feat: Credential 支持 buvid4
  • fix: w_webid related in #892
  • feat: bili_simple_download
  • feat: recalculate_wbi, refresh_bili_ticket, refresh_buvid
  • fix: session.send_msg (originally posted in #828)

v17.1.2

19 Feb 12:49

Choose a tag to compare

  • fix: pyinstaller hooks
  • fix: 移除 interactive_video 中对私有变量的使用
  • fix: user.User.get_dynamics_new 出现 wbi #890
  • feat: 新增 blackroom.get_jury_case_raw (-> dict), dynamic.get_dynamic_page_info (-> dict)
  • [BREAKING CHANGE] chore: 原 dynamic.get_dynamic_page_info (-> List[Dynamic]) 移至 dynamic.get_dynamic_page_list

17.1.1

11 Feb 06:00

Choose a tag to compare

What's Changed

  • fix: app.get_loading_images_special
  • fix: audio_uploader.upload_cover
  • fix: login_v2.LoginCheck 特殊情况
  • chore: update VideoAppealReasonType
  • [BREAKING CHANGE] fix: ass.make_ass_file_danmakus_protobuf 移除 credential 参数
  • [BREAKING CHANGE] refactor: remove class EpisodeTryMP4DownloadURL, HTML5MP4DownloadURL, add class MP4StreamDownloadURL 与相关返回值变动
  • [BREAKING CHANGE] refactor: remove video.VideoDownloadURLDataDetecter.check_flv_stream, video.VideoDownloadURLDataDetecter.check_html5_mp4_stream, video.VideoDownloadURLDataDetecter.check_episode_try_mp4_stream, add check_flv_mp4_stream
  • feat: user.User.get_opus
  • feat: parse_link 支持 opus
  • feat: 支持配置第三方请求库使用 HTTP2,支持设置 curl_cffi 伪装的目标浏览器。设置方法见相关文档。
  • chore(deps): update beautifulsoup4 requirement from ~=4.12.3 to ~=4.13.0 by @dependabot in #885
  • chore(deps): update beautifulsoup4 requirement from ~=4.13.0 to ~=4.13.3 by @dependabot in #888
  • chore(deps): update lxml requirement from ~=5.3.0 to ~=5.3.1 by @dependabot in #889

Full Changelog: 17.1.0...17.1.1