Skip to main content
BiliFM Logo

BiliFM

PyPI PyPI - Python Version PyPI - License PDM-managed GitCode-managed
📻 Best BiliBili Audio Downloader

👋 Intro

An script to download all audios of the Bilibili uploader you love. 轻松下载指定up主全部或指定的视频音频。

📦 Install

pip install BiliFM --upgrade

或在本地使用并安装依赖

pip install -r requirements.txt

🔨 Usage

使用实例:

uid 模式

bilifm uid 261485584
uid = "261485584" # uid 为 UP 主的 uid

bv 模式

Note bv 模式现已支持多 P 下载,使用方式和普通 bv 模式相同 同理,其他模式的下载也支持分 P 视频

bilifm bv BV1k341187
bvid = "BV1k341187" # bvid 是要下载的音频的视频 bv 号

多 P 下载时,播放地址请求之间默认间隔 2 秒,以减少触发 B 站风控的概率。可通过 --interval 调整:

bilifm bv BV1k341187 --interval 3

fav 模式

bilifm fav 69361944 cookies.json
media_id = "69361954" # media_id 是收藏夹的 media_id,注意不要和 uid/fid 弄混
cookies_path = "cookies.json" # cookies 是保存 cookies 的文件路径,注意需要转换为 json

media_id 的获取:

media_id

cookies 的获取:

season 模式

下载视频合集

bilifm season $uid $sid [OPTIONS]
  • uid, sid 的获取: 打开视频合集网页, 从 URL 中获取

https://space.bilibili.com/23263470/channel/collectiondetail?sid=1855309

例如上面链接, uid 为 23263470, sid 为 1855309 (目前 uid 可以随意填写)

bilifm season 23263470 1855309
  • Options:
    • -o, --directory 选择音频保存地址

series 模式

下载视频列表

bilifm series $uid $sid [OPTIONS]
  • uid, sid 的获取: 打开用户空间中的合集和列表, 找到列表点击更多, 然后从URL中获取

https://space.bilibili.com/488978908/channel/seriesdetail?sid=888434

例如上面链接, uid 为 488978908, sid 为 888434. 使用下面命令

bilifm series 488978908 888434
  • Options:
    • -o, --directory 选择音频保存地址

📅 Features

  • python 版本限制未知

    • 在函数定义时使用了类型注解,故不建议使用 3.10 以下版本
  • 接口简洁方便调用

@app.command()
def bv(bv: str):
    audio = Audio(bv)
    audio.download()


@app.command()
def uid(uid: str):
    user = User(uid)

    for video in user.videos:
        bv = video["bvid"]
        audio = Audio(bv)
        audio.download()

    typer.echo("Download complete")

⚠️ Issues

  • 获取 UP 主视频列表时会出现 UnicodeDecodeError,原因未知
    • 初步判断是网络不稳定所致,在稳定的网络环境下没有出现此问题
    • 暂时采用 try-except 跳过这一过程
  • 在使用前需关闭代理

🔖 Licence

  • bilibiliaudioDownloader 的作者没有选取许可证,暂时选择 MIT License
  • bilibiliAudioDownloader 的作者已添加 GPL-3.0 License,故本项目亦修改为 GPL-3.0

🙏 Thanks

感谢以下产品对 BiliFM 的赞助:

JetBrains Logo

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bilifm-0.2.10.tar.gz (27.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bilifm-0.2.10-py3-none-any.whl (29.2 kB view details)

Uploaded Python 3

File details

Details for the file bilifm-0.2.10.tar.gz.

File metadata

  • Download URL: bilifm-0.2.10.tar.gz
  • Upload date:
  • Size: 27.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: pdm/2.28.0 CPython/3.10.20 Linux/6.17.0-1018-azure

File hashes

Hashes for bilifm-0.2.10.tar.gz
Algorithm Hash digest
SHA256 34a3ce6df39f31d05882400ea069d40f19a7938d1d767e7a447e7054cc7a7d9c
MD5 b5958c1887d65f5c15e3578e7b47e3fb
BLAKE2b-256 355d67bc66a8e3a5f0e79fd3743514c89efa27d405032c7b4aea2c0ce8572732

See more details on using hashes here.

File details

Details for the file bilifm-0.2.10-py3-none-any.whl.

File metadata

  • Download URL: bilifm-0.2.10-py3-none-any.whl
  • Upload date:
  • Size: 29.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: pdm/2.28.0 CPython/3.10.20 Linux/6.17.0-1018-azure

File hashes

Hashes for bilifm-0.2.10-py3-none-any.whl
Algorithm Hash digest
SHA256 5be4e845497df1e1791bb4b85113a5aae865db5b018fe935b6445eb0a5b9da70
MD5 7e3144b7a93a2f50ff03d780762abfac
BLAKE2b-256 35e330671dc38d465d1fd6a9d27ce466bbe9d23dd95b6e61f63fd0f6a32331c9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page