<div align="center">
<a href="https://v2.nonebot.dev/store"><img src="https://s2.loli.net/2024/08/13/ZlwxWz3Sh2i1bNU.png" width="180" height="180" alt="NoneBotPluginLogo"></a>
<br>
<p><img src="https://github.com/A-kirami/nonebot-plugin-template/blob/resources/NoneBotPlugin.svg" width="240" alt="NoneBotPluginText"></p>
</div>
<div align="center">
# nonebot-plugin-resolver
_✨ NoneBot2 链接分享解析器插件 ✨_
<a href="./LICENSE">
<img src="https://img.shields.io/github/license/owner/nonebot-plugin-resolver.svg" alt="license">
</a>
<a href="https://pypi.org/project/nonebot-plugin-resolver">
<img src="https://img.shields.io/pypi/v/nonebot-plugin-resolver.svg" alt="pypi">
</a>
<img src="https://img.shields.io/badge/python-3.9+-blue.svg" alt="python">
</div>
## 📖 介绍
适用于NoneBot2的解析视频、图片链接/小程序插件,tiktok、bilibili、twitter等实时发送!
## 💿 安装
1. 使用 nb-cli 安装,不需要手动添加入口,更新使用 pip
```sh
nb plugin install nonebot-plugin-resolver
```
2. 使用 pip 安装和更新,初次安装需要手动添加入口
```sh
pip install --upgrade nonebot-plugin-resolver
```
3. 🚀【高级 / 进阶 / 推荐】使用脚本进行安装,**优点就是及时更新** | ⚠️在可以执行`nb run`那个目录执行即可
```shell
curl -fsSL https://raw.gitmirror.com/zhiyu1998/nonebot-plugin-resolver/master/npr_install.sh > npr_install.sh && chmod 755 npr_install.sh && ./npr_install.sh
```
4. 【必要】安装必要组件 FFmpeg
```shell
# ubuntu
sudo apt-get install ffmpeg
# 其他linux参考(群友推荐):https://gitee.com/baihu433/ffmpeg
# Windows 参考:https://www.jianshu.com/p/5015a477de3c
```
> [!IMPORTANT]
> 推荐两个ffmpeg全编译版本:
> - https://github.com/yt-dlp/FFmpeg-Builds
> - https://github.com/BtbN/FFmpeg-Builds
5. 【可选】安装`TikTok`&`YouTube`解析必要依赖 不建议直接使用`apt`不是最新版
```shell
pip install yt-dlp
```
## ⚙️ 配置
在 nonebot2 项目的`.env`文件中添加下表中的可选配置
```
XHS_CK='' #xhs cookie
DOUYIN_CK='' # douyin's cookie, 格式:odin_tt=xxx;passport_fe_beating_status=xxx;sid_guard=xxx;uid_tt=xxx;uid_tt_ss=xxx;sid_tt=xxx;sessionid=xxx;sessionid_ss=xxx;sid_ucp_v1=xxx;ssid_ucp_v1=xxx;passport_assist_user=xxx;ttwid=xxx;
IS_OVERSEA=False # 是否是海外服务器部署
RESOLVER_PROXY = "http://127.0.0.1:7890" # 代理
R_GLOBAL_NICKNAME="" # 解析前缀名
BILI_SESSDATA='' # bilibili sessdata 填写后可附加: 总结等功能
VIDEO_DURATION_MAXIMUM=480 # 视频最大解析长度,默认480s为8分钟,计算公式为480s/60s=8mins
GLOBAL_RESOLVE_CONTROLLER="" # 全局禁止的解析,示例 GLOBAL_RESOLVE_CONTROLLER="bilibili,dy" 表示禁止了哔哩哔哩和抖,GLOBAL_RESOLVE_CONTROLLER=""说明都不禁止,(大部分是缩写)请严格遵守选项: bilibili,dy,tiktok,ac,twitter,xiaohongshu,youtube.netease,kugou,wb
```
## 🕹️ 开启 & 关闭解析
使用以下命令可以控制对当前群是否开启/关闭解析:
```shell
@机器人 开启解析
@机器人 关闭解析
查看关闭解析
```
## 🤳🏿 在线观看如何获取 Cookie
> 由群友 `@麦满分` 提供
https://github.com/user-attachments/assets/7ead6d62-a36c-4e8d-bb5d-6666749dfb26
## youtube 解析可能存在的问题
- 网络问题, 自行解决
- 解析失败可能是因为人机检测,建议先自行使用 `yt-dlp` 测试,确定后将 youtube 的 cookies 以 **Netscape** 的格式导出为 `ytb_cookies.txt`,放到 nonebot 工作目录
## 🎉 使用 & 效果图
<img src="https://s2.loli.net/2024/08/12/l8ISa1Gv76OHuML.webp" width="50%" height="50%">
<img src="https://s2.loli.net/2024/08/12/Ojlh6Nr9SiRmvuB.webp" width="50%" height="50%">
<img src="https://s2.loli.net/2024/08/12/MF4xyhESYZBzcwL.webp" width="50%" height="50%">
<img src="https://s2.loli.net/2024/08/12/nDpB6Y9yHvmtKjU.webp" width="50%" height="50%">
<img src="https://s2.loli.net/2024/08/12/I5VWuASNFTmakw1.webp" width="50%" height="50%">
## 开发 && 发版
发版 Action:
```shell
git tag <tag_name>
git push origin --tags
```
## 贡献
同时感谢以下开发者对 `Nonebot - R插件` 作出的贡献:
<a href="https://github.com/zhiyu1998/nonebot-plugin-resolver/graphs/contributors">
<img src="https://contrib.rocks/image?repo=zhiyu1998/nonebot-plugin-resolver&max=1000" />
</a>
Raw data
{
"_id": null,
"home_page": "https://github.com/zhiyu1998/nonebot-plugin-resolver",
"name": "nonebot-plugin-resolver",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": "nonebot, nonebot2, resolver",
"author": "zhiyu1998",
"author_email": "renzhiyu0416@qq.com",
"download_url": "https://files.pythonhosted.org/packages/92/37/32fd1a8e32056677e454685cff4d2b9431448d66ab8eaf98a0d774d17b80/nonebot_plugin_resolver-1.2.29.tar.gz",
"platform": null,
"description": "<div align=\"center\">\n <a href=\"https://v2.nonebot.dev/store\"><img src=\"https://s2.loli.net/2024/08/13/ZlwxWz3Sh2i1bNU.png\" width=\"180\" height=\"180\" alt=\"NoneBotPluginLogo\"></a>\n <br>\n <p><img src=\"https://github.com/A-kirami/nonebot-plugin-template/blob/resources/NoneBotPlugin.svg\" width=\"240\" alt=\"NoneBotPluginText\"></p>\n</div>\n\n<div align=\"center\">\n\n# nonebot-plugin-resolver\n\n_\u2728 NoneBot2 \u94fe\u63a5\u5206\u4eab\u89e3\u6790\u5668\u63d2\u4ef6 \u2728_\n\n\n<a href=\"./LICENSE\">\n <img src=\"https://img.shields.io/github/license/owner/nonebot-plugin-resolver.svg\" alt=\"license\">\n</a>\n<a href=\"https://pypi.org/project/nonebot-plugin-resolver\">\n <img src=\"https://img.shields.io/pypi/v/nonebot-plugin-resolver.svg\" alt=\"pypi\">\n</a>\n<img src=\"https://img.shields.io/badge/python-3.9+-blue.svg\" alt=\"python\">\n\n</div>\n\n## \ud83d\udcd6 \u4ecb\u7ecd\n\n\u9002\u7528\u4e8eNoneBot2\u7684\u89e3\u6790\u89c6\u9891\u3001\u56fe\u7247\u94fe\u63a5/\u5c0f\u7a0b\u5e8f\u63d2\u4ef6\uff0ctiktok\u3001bilibili\u3001twitter\u7b49\u5b9e\u65f6\u53d1\u9001\uff01\n## \ud83d\udcbf \u5b89\u88c5\n\n1. \u4f7f\u7528 nb-cli \u5b89\u88c5\uff0c\u4e0d\u9700\u8981\u624b\u52a8\u6dfb\u52a0\u5165\u53e3\uff0c\u66f4\u65b0\u4f7f\u7528 pip\n\n```sh\nnb plugin install nonebot-plugin-resolver\n```\n\n2. \u4f7f\u7528 pip \u5b89\u88c5\u548c\u66f4\u65b0\uff0c\u521d\u6b21\u5b89\u88c5\u9700\u8981\u624b\u52a8\u6dfb\u52a0\u5165\u53e3\n\n```sh\npip install --upgrade nonebot-plugin-resolver\n```\n3. \ud83d\ude80\u3010\u9ad8\u7ea7 / \u8fdb\u9636 / \u63a8\u8350\u3011\u4f7f\u7528\u811a\u672c\u8fdb\u884c\u5b89\u88c5\uff0c**\u4f18\u70b9\u5c31\u662f\u53ca\u65f6\u66f4\u65b0** | \u26a0\ufe0f\u5728\u53ef\u4ee5\u6267\u884c`nb run`\u90a3\u4e2a\u76ee\u5f55\u6267\u884c\u5373\u53ef\n\n```shell\ncurl -fsSL https://raw.gitmirror.com/zhiyu1998/nonebot-plugin-resolver/master/npr_install.sh > npr_install.sh && chmod 755 npr_install.sh && ./npr_install.sh\n```\n\n4. \u3010\u5fc5\u8981\u3011\u5b89\u88c5\u5fc5\u8981\u7ec4\u4ef6 FFmpeg\n\n```shell\n# ubuntu\nsudo apt-get install ffmpeg\n# \u5176\u4ed6linux\u53c2\u8003\uff08\u7fa4\u53cb\u63a8\u8350\uff09\uff1ahttps://gitee.com/baihu433/ffmpeg\n# Windows \u53c2\u8003\uff1ahttps://www.jianshu.com/p/5015a477de3c\n```\n> [!IMPORTANT]\n> \u63a8\u8350\u4e24\u4e2affmpeg\u5168\u7f16\u8bd1\u7248\u672c\uff1a\n> - https://github.com/yt-dlp/FFmpeg-Builds\n> - https://github.com/BtbN/FFmpeg-Builds\n\n5. \u3010\u53ef\u9009\u3011\u5b89\u88c5`TikTok`&`YouTube`\u89e3\u6790\u5fc5\u8981\u4f9d\u8d56 \u4e0d\u5efa\u8bae\u76f4\u63a5\u4f7f\u7528`apt`\u4e0d\u662f\u6700\u65b0\u7248\n\n```shell\npip install yt-dlp\n```\n## \u2699\ufe0f \u914d\u7f6e\n\n\u5728 nonebot2 \u9879\u76ee\u7684`.env`\u6587\u4ef6\u4e2d\u6dfb\u52a0\u4e0b\u8868\u4e2d\u7684\u53ef\u9009\u914d\u7f6e\n\n```\nXHS_CK='' #xhs cookie\nDOUYIN_CK='' # douyin's cookie, \u683c\u5f0f\uff1aodin_tt=xxx;passport_fe_beating_status=xxx;sid_guard=xxx;uid_tt=xxx;uid_tt_ss=xxx;sid_tt=xxx;sessionid=xxx;sessionid_ss=xxx;sid_ucp_v1=xxx;ssid_ucp_v1=xxx;passport_assist_user=xxx;ttwid=xxx;\nIS_OVERSEA=False # \u662f\u5426\u662f\u6d77\u5916\u670d\u52a1\u5668\u90e8\u7f72\nRESOLVER_PROXY = \"http://127.0.0.1:7890\" # \u4ee3\u7406\nR_GLOBAL_NICKNAME=\"\" # \u89e3\u6790\u524d\u7f00\u540d\nBILI_SESSDATA='' # bilibili sessdata \u586b\u5199\u540e\u53ef\u9644\u52a0: \u603b\u7ed3\u7b49\u529f\u80fd\nVIDEO_DURATION_MAXIMUM=480 # \u89c6\u9891\u6700\u5927\u89e3\u6790\u957f\u5ea6\uff0c\u9ed8\u8ba4480s\u4e3a8\u5206\u949f\uff0c\u8ba1\u7b97\u516c\u5f0f\u4e3a480s/60s=8mins\nGLOBAL_RESOLVE_CONTROLLER=\"\" # \u5168\u5c40\u7981\u6b62\u7684\u89e3\u6790\uff0c\u793a\u4f8b GLOBAL_RESOLVE_CONTROLLER=\"bilibili,dy\" \u8868\u793a\u7981\u6b62\u4e86\u54d4\u54e9\u54d4\u54e9\u548c\u6296\uff0cGLOBAL_RESOLVE_CONTROLLER=\"\"\u8bf4\u660e\u90fd\u4e0d\u7981\u6b62\uff0c\uff08\u5927\u90e8\u5206\u662f\u7f29\u5199\uff09\u8bf7\u4e25\u683c\u9075\u5b88\u9009\u9879: bilibili,dy,tiktok,ac,twitter,xiaohongshu,youtube.netease,kugou,wb\n```\n\n## \ud83d\udd79\ufe0f \u5f00\u542f & \u5173\u95ed\u89e3\u6790\n\n\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u53ef\u4ee5\u63a7\u5236\u5bf9\u5f53\u524d\u7fa4\u662f\u5426\u5f00\u542f/\u5173\u95ed\u89e3\u6790\uff1a\n```shell\n@\u673a\u5668\u4eba \u5f00\u542f\u89e3\u6790\n@\u673a\u5668\u4eba \u5173\u95ed\u89e3\u6790\n\u67e5\u770b\u5173\u95ed\u89e3\u6790\n```\n\n## \ud83e\udd33\ud83c\udfff \u5728\u7ebf\u89c2\u770b\u5982\u4f55\u83b7\u53d6 Cookie\n\n> \u7531\u7fa4\u53cb `@\u9ea6\u6ee1\u5206` \u63d0\u4f9b\n\nhttps://github.com/user-attachments/assets/7ead6d62-a36c-4e8d-bb5d-6666749dfb26\n\n## youtube \u89e3\u6790\u53ef\u80fd\u5b58\u5728\u7684\u95ee\u9898\n- \u7f51\u7edc\u95ee\u9898, \u81ea\u884c\u89e3\u51b3\n- \u89e3\u6790\u5931\u8d25\u53ef\u80fd\u662f\u56e0\u4e3a\u4eba\u673a\u68c0\u6d4b\uff0c\u5efa\u8bae\u5148\u81ea\u884c\u4f7f\u7528 `yt-dlp` \u6d4b\u8bd5\uff0c\u786e\u5b9a\u540e\u5c06 youtube \u7684 cookies \u4ee5 **Netscape** \u7684\u683c\u5f0f\u5bfc\u51fa\u4e3a `ytb_cookies.txt`\uff0c\u653e\u5230 nonebot \u5de5\u4f5c\u76ee\u5f55\n\n## \ud83c\udf89 \u4f7f\u7528 & \u6548\u679c\u56fe\n<img src=\"https://s2.loli.net/2024/08/12/l8ISa1Gv76OHuML.webp\" width=\"50%\" height=\"50%\">\n<img src=\"https://s2.loli.net/2024/08/12/Ojlh6Nr9SiRmvuB.webp\" width=\"50%\" height=\"50%\">\n<img src=\"https://s2.loli.net/2024/08/12/MF4xyhESYZBzcwL.webp\" width=\"50%\" height=\"50%\">\n<img src=\"https://s2.loli.net/2024/08/12/nDpB6Y9yHvmtKjU.webp\" width=\"50%\" height=\"50%\">\n<img src=\"https://s2.loli.net/2024/08/12/I5VWuASNFTmakw1.webp\" width=\"50%\" height=\"50%\">\n\n## \u5f00\u53d1 && \u53d1\u7248\n\n\u53d1\u7248 Action:\n```shell\ngit tag <tag_name>\n\ngit push origin --tags\n```\n\n## \u8d21\u732e\n\n\u540c\u65f6\u611f\u8c22\u4ee5\u4e0b\u5f00\u53d1\u8005\u5bf9 `Nonebot - R\u63d2\u4ef6` \u4f5c\u51fa\u7684\u8d21\u732e\uff1a\n\n<a href=\"https://github.com/zhiyu1998/nonebot-plugin-resolver/graphs/contributors\">\n <img src=\"https://contrib.rocks/image?repo=zhiyu1998/nonebot-plugin-resolver&max=1000\" />\n</a>\n\n",
"bugtrack_url": null,
"license": null,
"summary": "NoneBot2\u94fe\u63a5\u5206\u4eab\u89e3\u6790\u5668\u63d2\u4ef6\u3002\u89e3\u6790\u89c6\u9891\u3001\u56fe\u7247\u94fe\u63a5/\u5c0f\u7a0b\u5e8f\u63d2\u4ef6\uff0ctiktok\u3001bilibili\u3001twitter\u7b49\u5b9e\u65f6\u53d1\u9001\uff01",
"version": "1.2.29",
"project_urls": {
"Homepage": "https://github.com/zhiyu1998/nonebot-plugin-resolver",
"Repository": "https://github.com/zhiyu1998/nonebot-plugin-resolver"
},
"split_keywords": [
"nonebot",
" nonebot2",
" resolver"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "4ab429a198d82c10b9d1271a4723200d64952b51973166c45e94caf2b7f819fb",
"md5": "56fefa518a8537b6d132a535ff0d0633",
"sha256": "1bac42fc485925a6b03704bc71a2751c5dd378ca82bc4df6e1462e72aab9eb43"
},
"downloads": -1,
"filename": "nonebot_plugin_resolver-1.2.29-py3-none-any.whl",
"has_sig": false,
"md5_digest": "56fefa518a8537b6d132a535ff0d0633",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 38270,
"upload_time": "2024-12-05T04:07:43",
"upload_time_iso_8601": "2024-12-05T04:07:43.510553Z",
"url": "https://files.pythonhosted.org/packages/4a/b4/29a198d82c10b9d1271a4723200d64952b51973166c45e94caf2b7f819fb/nonebot_plugin_resolver-1.2.29-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "923732fd1a8e32056677e454685cff4d2b9431448d66ab8eaf98a0d774d17b80",
"md5": "8738cac7ff10541f0d36d7c1d5a004bc",
"sha256": "30fbf2f131d2c5aa03404c2311d7ea75018e59af4e9a940550fae5ee646b4c88"
},
"downloads": -1,
"filename": "nonebot_plugin_resolver-1.2.29.tar.gz",
"has_sig": false,
"md5_digest": "8738cac7ff10541f0d36d7c1d5a004bc",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 34385,
"upload_time": "2024-12-05T04:07:45",
"upload_time_iso_8601": "2024-12-05T04:07:45.865806Z",
"url": "https://files.pythonhosted.org/packages/92/37/32fd1a8e32056677e454685cff4d2b9431448d66ab8eaf98a0d774d17b80/nonebot_plugin_resolver-1.2.29.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-05 04:07:45",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "zhiyu1998",
"github_project": "nonebot-plugin-resolver",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "nonebot-plugin-resolver"
}