Skip to main content
logo

✨ Nonebot2 链接分享自动解析插件 ✨

license pypi python
ruff uv onebot
pre-commit

[!IMPORTANT] 收藏项目,你将从 GitHub 上无延迟地接收所有发布通知~⭐️

starify

📖 介绍

nonebot-plugin-resolver 重制版

平台 触发的消息形态 视频 图集 音频
B站 BV号/链接(包含短链,BV,av)/卡片/小程序 ✅​ ✅​ ✅​
抖音 链接(分享链接,兼容电脑端链接) ✅​ ✅​ ❌️
微博 链接(博文,视频,show) ✅​ ✅​ ❌️
小红书 链接(含短链)/卡片 ✅​ ✅​ ❌️
快手 链接(包含标准链接和短链) ✅​ ✅​ ❌️
acfun 链接 ✅​ ❌️ ❌️
youtube 链接(含短链) ✅​ ❌️ ✅​
tiktok 链接 ✅​ ❌️ ❌️
twitter 链接 ✅​ ✅​ ❌️

支持的链接,可参考 测试链接

💿 安装

[!Warning] 如果你已经在使用 nonebot-plugin-resolver,请在安装此插件前卸载

使用 nb-cli 安装/更新 在 nonebot2 项目的根目录下打开命令行, 输入以下指令即可安装
nb plugin install nonebot-plugin-resolver2 --upgrade

使用 pypi 源更新

nb plugin install nonebot-plugin-resolver2 --upgrade -i https://pypi.org/simple

安装仓库 dev 分支

uv pip install git+https://github.com/fllesser/nonebot-plugin-resolver2.git@dev
使用包管理器安装 在 nonebot2 项目的插件目录下, 打开命令行, 根据你使用的包管理器, 输入相应的安装命令
uv 使用 uv 安装
uv add nonebot-plugin-resolver2

安装仓库 dev 分支

uv add git+https://github.com/fllesser/nonebot-plugin-resolver2.git@master
pip
pip install --upgrade nonebot-plugin-resolver2
pdm
pdm add nonebot-plugin-resolver2
poetry
poetry add nonebot-plugin-resolver2

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

plugins = ["nonebot_plugin_resolver2"]
安装必要组件 大部分解析都依赖于 ffmpeg

ubuntu/debian

sudo apt-get install ffmpeg

其他 linux 参考(原项目推荐): https://gitee.com/baihu433/ffmpeg

Windows 参考(原项目推荐): https://www.jianshu.com/p/5015a477de3c

⚙️ 配置

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

配置项 必填 默认值 说明
NICKNAME 否 [""] nonebot2 内置配置,可作为解析结果消息的前缀
API_TIMEOUT 否 30.0 nonebot2 内置配置,若服务器上传带宽太低,建议调高,防止超时
r_xhs_ck 否 "" 小红书 cookie
r_bili_ck 否 "" B 站 cookie, 必须含有 SESSDATA 项,可附加 B 站 AI 总结功能, 如果需要长期使用此凭据则不应该在浏览器登录账户导致 cookie 被刷新,建议注册个小号获取, 也可以配置 ac_time_value 项,用于凭据的自动刷新,获取方式
r_bili_video_codes 否 '["avc", "av01", "hev"]' 允许的 B 站视频编码,越靠前的编码优先级越高,可选 "avc"(H.264,体积较大), "hev"(HEVC), "av01"(AV1), 后两项在不同设备可能有兼容性问题,如需完全避免,可只填一项,如 '["avc"]'
r_ytb_ck 否 "" Youtube cookie, Youtube 视频因人机检测下载失败,需填
r_proxy 否 None 仅作用于 youtube, tiktok 解析,推特解析会自动读取环境变量中的 http_proxy / https_proxy(代理软件通常会自动设置)
r_need_upload 否 False 音频解析,是否需要上传群文件
r_need_forward 否 True 不超过 4 条的解析消息是否需要合并转发,配置为 False ,超过4条的解析消息仍然会用合并转发包裹
r_use_base64 否 False 视频,图片,音频是否使用 base64 发送,注意:编解码和传输 base64 会占用更多的内存,性能和带宽, 甚至可能会使 websocket 连接崩溃,因此该配置项仅推荐 nonebot 和 协议端不在同一机器,或者使用 docker 懒得映射插件缓存目录的用户配置
r_video_duration_maximum 否 480 B站视频最大解析时长,单位:秒
r_max_size 否 100 音视频下载最大文件大小,单位 MB,超过该配置将阻断下载
r_disable_resolvers 否 [] 全局禁止的解析,示例 r_disable_resolvers=["bilibili", "douyin"] 表示禁止了哔哩哔哩和抖, 请根据自己需求填写["bilibili", "douyin", "kuaishou", "twitter", "ytb", "acfun", "tiktok", "weibo", "xiaohongshu"]

🎉 使用

指令表

指令 权限 需要@ 范围 说明
开启解析 SUPERUSER/OWNER/ADMIN 是 群聊 开启解析
关闭解析 SUPERUSER/OWNER/ADMIN 是 群聊 关闭解析
开启所有解析 SUPERUSER 否 私聊 开启所有群的解析
关闭所有解析 SUPERUSER 否 私聊 关闭所有群的解析
查看关闭解析 SUPERUSER 否 - 获取已经关闭解析的群聊
bm BV... USER 否 - 下载 b站 音乐

致谢

nonebot-plugin-resolver parse-video-py

Metadata

Release files for nonebot-plugin-resolver2 1.13.1

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-resolver2 1.13.1
File Size Uploaded Provenance Actions
nonebot_plugin_resolver2-1.13.1.tar.gz 34.7 kB Without provenance Details for nonebot_plugin_resolver2-1.13.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for nonebot-plugin-resolver2 1.13.1
File Interpreter ABI Platform Actions
nonebot_plugin_resolver2-1.13.1-py3-none-any.whl Python 3 none any Details for nonebot_plugin_resolver2-1.13.1-py3-none-any.whl

Total release size: 85.1 kB

Release files / nonebot_plugin_resolver2-1.13.1.tar.gz

Download URL nonebot_plugin_resolver2-1.13.1.tar.gz
Size 34.7 kB
Tags Source
SHA-256 checksum
How to use checksums
901fc50a34ca6fb5cf63fafb17c27ad62e931a92e8b70616f99a3ee1548a7780
BLAKE2b-256 checksum
How to use checksums
55476db8fcf1a998c076d89ddeeb9b6349c6e368d1028668b8a6830615c431c3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / nonebot_plugin_resolver2-1.13.1-py3-none-any.whl

Download URL nonebot_plugin_resolver2-1.13.1-py3-none-any.whl
Size 50.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9a2bed9847a8683d82568784d2212fa31431be3c662a8ed859ef59258886275f
BLAKE2b-256 checksum
How to use checksums
9e41ac454dfe8d34fe4296bc67ea52a3331db740cdfc989ea0390acc4fd74e88
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Security for nonebot-plugin-resolver2 1.13.1

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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.13.1 This release

2 release files No provenance

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