Skip to main content

nonebot-plugin-bilidownloader-woju

✨ 从B站视频下载音频/视频/封面的 NoneBot2 插件 ✨

功能

  • /mp3 视频链接/BV号 → 发送音频文件(M4A,自动选择最高音质)
  • /mp4 视频链接/BV号 → 发送视频文件(MP4)
  • /封面图 视频链接/BV号 → 发送封面图片

安装

nb plugin install nonebot-plugin-bilidownloader-woju
pip install nonebot-plugin-bilidownloader-woju

使用

在群聊或私聊中输入命令即可:

/mp3 BV1xx411c7mD
/mp4 https://www.bilibili.com/video/BV1xx411c7mD
/封面图 BV1xx411c7mD

/mp3、/mp4 通过群文件/私聊文件接口上传,需要协议端(Lagrange、NapCat 等)支持文件上传 API。

关于 /mp4 的画质

B站 DASH 视频流的画面与声音是分离的:

  • 装有 ffmpeg(推荐):插件自动下载最高画质视频轨与音轨并无损合并,得到有声高清 MP4
  • 未装 ffmpeg:回退到自带音轨的流畅画质(360P 左右)MP4

配置

默认即装即用,可选配置项(写入 .env 文件):

bilibili_downloader_max_file_mb=500
bilibili_downloader_ffmpeg_path=
  • bilibili_downloader_max_file_mb:单文件下载大小上限(MB),超过则拒绝下载,默认 500
  • bilibili_downloader_ffmpeg_path:ffmpeg 可执行文件路径,留空自动从 PATH 查找

0.3.0 更新日志

修复了导致插件完全不可用的多处缺陷:

  • 修复致命 bug:CommandArg() 参数注解错误导致 /mp3 /mp4 /封面图 在新版 nonebot2(2.4+ / pydantic v2)下完全无响应
  • 修复 get_download_url() 缺少必填 page_index 参数(bilibili-api-python 17 起要求),此前每次下载必然报错
  • 修复 DASH 解析路径错误(data.dash → 顶层 dash),此前永远提示“没有可用的音频流”
  • 修复 MessageSegment.file 在 OneBot v11 中不存在导致发送文件必然报错,改用 upload_group_file / upload_private_file 接口
  • 修复 /mp4 发送无声视频:装有 ffmpeg 时自动合并音视频轨;未装时回退为带声音的流畅画质
  • 修复 下载缺少 Referer/User-Agent 头导致部分 CDN 镜像 403
  • 下载改为流式写盘,不再把整个文件读进内存;新增文件大小上限配置
  • 临时文件改用随机文件名,避免并发冲突;异常路径统一清理临时文件
  • 音频扩展名从 .mp3 修正为 .m4a(DASH 音频流实际格式)
  • 修复 requires-python 与依赖冲突(Python 3.9 无法安装),现要求 Python ≥ 3.10
  • 新增测试套件(nonebug + pytest)

开发

pip install -e ".[test]"
pytest

开源协议

MIT

Metadata

Release files for nonebot-plugin-bilidownloader-woju 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nonebot-plugin-bilidownloader-woju 0.3.0
File Size Uploaded Provenance
nonebot_plugin_bilidownloader_woju-0.3.0.tar.gz 11.6 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for nonebot-plugin-bilidownloader-woju 0.3.0
File Interpreter ABI Platform
nonebot_plugin_bilidownloader_woju-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 20.8 kB

Release files / nonebot_plugin_bilidownloader_woju-0.3.0.tar.gz

Download URL nonebot_plugin_bilidownloader_woju-0.3.0.tar.gz
Size 11.6 kB
Tags Source
SHA-256 checksum
How to use checksums
2f73bcf8413f3059bc943b13cede77a8db79d87b57ea50d3dab2eda642dea014
BLAKE2b-256 checksum
How to use checksums
a976bb5fefad1e5d7e6a6ec9d737c037617850708f4486be609b4d0ae9ffa1b0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.6

Release files / nonebot_plugin_bilidownloader_woju-0.3.0-py3-none-any.whl

Download URL nonebot_plugin_bilidownloader_woju-0.3.0-py3-none-any.whl
Size 9.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b50aa6e60a5b710a846aabafc10d80c1c250ff274d304ae2778c3bed95c2d847
BLAKE2b-256 checksum
How to use checksums
3e3e445bc82de074ea6d47b410cec639a944ae37854d221f724f347d86c88e75
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.6

Security for nonebot-plugin-bilidownloader-woju 0.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page