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
  3. ffmpeg.exe 所在目录添加到系统环境变量PATH中
  4. 在命令行中运行 ffmpeg -version 验证安装是否成功

Linux :

sudo apt update
sudo apt install ffmpeg

macOS:

brew install ffmpeg

⚙️ 配置

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

配置项 必填 默认值 说明
super_admins [] 管理员QQ号列表

🎉 使用

指令表

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

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

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

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

效果图

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.3.tar.gz (174.2 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.3-py3-none-any.whl (171.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: nonebot_plugin_bili2mp4-0.1.3.tar.gz
  • Upload date:
  • Size: 174.2 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.3.tar.gz
Algorithm Hash digest
SHA256 707b8cc80ac4dbeee3d56c6b2643d58d10be7230fdbbffdc6d41974480e56777
MD5 a6f054719b90a24786d0539fe457985f
BLAKE2b-256 596b6cca2aada0afbca79c1da892631a406fb9762e82d95e6121c13f765064e9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nonebot_plugin_bili2mp4-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 624739b8dd5d77af65b137dc6643936356fc690df160ec7a8c09db1c7cac726a
MD5 273f839372390dafa410385fd41850a8
BLAKE2b-256 d69e20208e2ed3bb8f385a78a0a8cf1e662cd0d675f2ca65a9c3dcdcc5bb6b98

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