Skip to main content

在指定群内将B站小程序/分享链接解析转MP4后发送的NoneBot2插件

Project description

NoneBotPluginLogo

NoneBotPluginText

nonebot-plugin-bili2mp4

✨ NoneBot2 插件,自动将B站视频转换为MP4并分享 ✨

license pypi python

这是一个用于 NoneBot2 的插件,可以在指定的QQ群中自动检测B站分享链接和小程序卡片,并将这些B站视频自动下载并转换为MP4格式后发送到群中。

📖 介绍

nonebot-plugin-bili2mp4 是一个用于 NoneBot2 的插件,主要功能包括:

  • 自动检测群聊中的B站视频分享链接和小程序卡片识别并转换为MP4格式发到群里
  • 支持识别B站短链接
  • 支持控制开启的群
  • 支持自定义视频清晰度、大小限制等参数
  • 支持设置B站Cookie以获取更高清晰度或者大会员限定视频

💿 安装

使用 nb-cli 安装

在 nonebot2 项目的根目录下打开命令行,输入以下指令:

nb plugin install nonebot-plugin-bili2mp4
使用包管理器安装

在 nonebot2 项目的根目录下,打开命令行,根据你使用的包管理器,输入相应的安装命令

pip
pip install nonebot-plugin-bili2mp4

打开 nonebot2 项目根目录下的 pyproject.toml 文件, 在 [tool.nonebot] 部分追加写入

plugins = ["nonebot_plugin_bili2mp4"]

📦 依赖

yt-dlp

如果创建项目时使用了虚拟环境请在虚拟环境内安装依赖

pip install yt-dlp
ffmpeg

插件依赖FFmpeg进行视频格式转换,需要手动安装:

Windows:

  1. 访问 FFmpeg官网 下载Windows版本
  2. 解压下载的压缩包到任意目录(如 C:\ffmpeg) (若不加到PATH中,需要在.env中指定路径,参考配置中的ffmpeg_path)
  3. ffmpeg.exe 所在目录添加到系统环境变量PATH中
  4. 在命令行中运行 ffmpeg -version 验证安装是否成功 可参考教程 https://www.jianshu.com/p/5015a477de3c

Linux :

sudo apt update
sudo apt install ffmpeg

macOS:

brew install ffmpeg

若不加到PATH中,需要在.env中指定路径,比如:

Windows:

ffmpeg_path = "C:/ffmpeg/bin"

Linux / macOS:

ffmpeg_path = "/usr/local/bin"

⚙️ 配置

在 nonebot2 项目的.env文件中添加下表中的必填配置

配置项 必填 默认值 说明
super_admins [] 管理员QQ号列表
ffmpeg_path [] FFmpeg的路径,如果为空则自动从PATH中查找

🎉 使用

指令表

指令 说明
fhelp 显示所有管理员可用命令的帮助信息
转换 <群号> 开启指定群的B站视频转换功能
停止转换 <群号> 停止指定群的B站视频转换功能
设置B站COOKIE <cookie字符串> 设置B站Cookie
清除B站COOKIE 清除已设置的B站Cookie
设置清晰度 <数字> 设置视频清晰度
设置最大大小 <数字>MB 设置视频大小限制
查看参数 查看当前配置参数
查看转换列表 查看已开启转换功能的群列表

: 以上指令均需管理员私聊bot

Cookie为必需,至少需要包含SESSDATA、bili_jct、DedeUserID和buvid3/buvid4四个字段

设置大会员账号的cookie可以获取更高清晰度或者大会员限定视频

效果图

Project details


Download files

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

Source Distribution

nonebot_plugin_bili2mp4-0.1.9.tar.gz (13.4 kB view details)

Uploaded Source

Built Distribution

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

nonebot_plugin_bili2mp4-0.1.9-py3-none-any.whl (12.0 kB view details)

Uploaded Python 3

File details

Details for the file nonebot_plugin_bili2mp4-0.1.9.tar.gz.

File metadata

  • Download URL: nonebot_plugin_bili2mp4-0.1.9.tar.gz
  • Upload date:
  • Size: 13.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.7

File hashes

Hashes for nonebot_plugin_bili2mp4-0.1.9.tar.gz
Algorithm Hash digest
SHA256 78e8eadbe3264c655c2e82fcce6b561f7b1add7146d6add8c77991712b118546
MD5 fca5d0cf821f9ca72c55cbd37174c2ce
BLAKE2b-256 8b14a3cabaf1dbeff9e56fbff191ebcf76fd6d569d5c0b44b0a5b5a15d07cb60

See more details on using hashes here.

File details

Details for the file nonebot_plugin_bili2mp4-0.1.9-py3-none-any.whl.

File metadata

File hashes

Hashes for nonebot_plugin_bili2mp4-0.1.9-py3-none-any.whl
Algorithm Hash digest
SHA256 8b3d0c83ce7a0b9142be7d399bc590c63303535800da5e6572ca8c6d2c4bc70e
MD5 c6bcf322bcbe3f103e8cdd6a7d941517
BLAKE2b-256 4ebeaa2266163dc3f6dc68018e18dd407b8b5a1079e726f63586f7b2eccb18cc

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 Pingdom Monitoring Sentry Error logging StatusPage Status page