{"id":13431946,"url":"https://github.com/cssxsh/bilibili-helper","last_synced_at":"2025-08-18T09:45:14.671Z","repository":{"id":41336924,"uuid":"307297394","full_name":"cssxsh/bilibili-helper","owner":"cssxsh","description":"Mirai Console 插件开发计划","archived":false,"fork":false,"pushed_at":"2024-07-19T20:18:18.000Z","size":1429,"stargazers_count":144,"open_issues_count":5,"forks_count":16,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-06-21T13:44:23.424Z","etag":null,"topics":["bilibili","mirai","mirai-console","mirai-plugin","qqbot"],"latest_commit_sha":null,"homepage":"https://github.com/users/cssxsh/projects/4","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cssxsh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-10-26T07:51:04.000Z","updated_at":"2025-05-16T06:43:28.000Z","dependencies_parsed_at":"2023-02-17T04:20:17.975Z","dependency_job_id":"c962c11d-491d-4fb9-974f-6903055de8f8","html_url":"https://github.com/cssxsh/bilibili-helper","commit_stats":null,"previous_names":[],"tags_count":75,"template":false,"template_full_name":"project-mirai/mirai-console-plugin-template","purl":"pkg:github/cssxsh/bilibili-helper","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cssxsh%2Fbilibili-helper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cssxsh%2Fbilibili-helper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cssxsh%2Fbilibili-helper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cssxsh%2Fbilibili-helper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cssxsh","download_url":"https://codeload.github.com/cssxsh/bilibili-helper/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cssxsh%2Fbilibili-helper/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270974809,"owners_count":24678250,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-18T02:00:08.743Z","response_time":89,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bilibili","mirai","mirai-console","mirai-plugin","qqbot"],"created_at":"2024-07-31T02:01:07.257Z","updated_at":"2025-08-18T09:45:14.599Z","avatar_url":"https://github.com/cssxsh.png","language":"Kotlin","funding_links":[],"categories":["监听与推送"],"sub_categories":["直播脚本"],"readme":"# [BiliBili Helper](https://github.com/cssxsh/bilibili-helper)\n\n\u003e 基于 [Mirai Console](https://github.com/mamoe/mirai-console) 的 [哔哩哔哩](https://www.bilibili.com/) 订阅插件\n\n[![Release](https://img.shields.io/github/v/release/cssxsh/bilibili-helper)](https://github.com/cssxsh/bilibili-helper/releases)\n[![Downloads](https://img.shields.io/github/downloads/cssxsh/bilibili-helper/total)](https://repo1.maven.org/maven2/xyz/cssxsh/bilibili-helper/)\n[![MiraiForum](https://img.shields.io/badge/post-on%20MiraiForum-yellow)](https://mirai.mamoe.net/topic/287)\n\n**使用前应该查阅的相关文档或项目**\n\n* [User Manual](https://github.com/mamoe/mirai/blob/dev/docs/UserManual.md)\n* [Permission Command](https://github.com/mamoe/mirai/blob/dev/mirai-console/docs/BuiltInCommands.md#permissioncommand)\n* [Chat Command](https://github.com/project-mirai/chat-command)\n\n从 1.2.5 版本开始 将截图部分功能的转移至 [mirai-selenium-plugin](https://github.com/cssxsh/mirai-selenium-plugin)  \n截图功能的启用需要其作为前置插件  \n关于截图支持的环境请浏览 [运行平台支持](https://github.com/cssxsh/mirai-selenium-plugin#%E8%BF%90%E8%A1%8C%E5%B9%B3%E5%8F%B0%E6%94%AF%E6%8C%81)  \n自动触发URL解析 详见 [信息解析](#信息解析指令) 指令  \n消息 [模板](#Template) 详见配置(自 1.4.0 起截图功能由模板内容来配置)  \n从 1.7.0 版本开始 提供 `/bili-login` 指令以登录个人账号，解决B站反爬问题\n\n## 指令\n\n注意: 使用前请确保可以 [在聊天环境执行指令](https://github.com/project-mirai/chat-command)  \n带括号的`/`前缀是可选的  \n`\u003c...\u003e`中的是指令名，由空格隔开表示或，选择其中任一名称都可执行例如`/B视频 添加 11783021`  \n`[...]`表示参数，当`[...]`后面带`?`时表示参数可选  \n`{...}`表示连续的多个参数\n\n本插件指令权限ID 格式为 `xyz.cssxsh.mirai.plugin.bilibili-helper:command.*`, `*` 是指令的第一指令名  \n例如 `/B动态 添加 496371957` 的权限ID为 `xyz.cssxsh.mirai.plugin.bilibili-helper:command.bili-dynamic`\n\n参数 `uid` 例如 `https://space.bilibili.com/508963009/` 的数字 `508963009`  \n参数 `contact` 为QQ号或者群号，可以省略，会从当前聊天环境获取，  \n比如群聊中会自动填充为当前群号, 但控制台中必须填充  \n\n子指令 `sleep/at` 的 `target` 是 [被许可人 ID](https://github.com/mamoe/mirai/blob/dev/mirai-console/docs/Permissions.md#%E8%A2%AB%E8%AE%B8%E5%8F%AF%E4%BA%BA-id)   \n处于休眠时间的订阅将不会推送  \n举例:  \n* `/bili-dynamic sleep g12345 00:00 06:00`, `00:00~06:00` 时间段内将不会推送  \n\n处于艾特时间的订阅将会添加艾特  \n举例:  \n* `/bili-live at g12345 19:00 23:00`, `19:00 23:00` 时间段内将会艾特全体\n* `/bili-live at u456789 19:00 23:00`, `19:00 23:00` 时间段内将会艾特用户456789\n\n子指令 `cron` 的 `cron` 参数是 CRON 表达式, 由 `秒 分钟 小时 日 月 周` 组成  \n举例：\n* `/bili-dynamic time 508963009 \"0 0 14 * * ?\"`, `0 0 14 * * ?` 表示每天 14:00 都执行一次  \n* `/bili-video time 508963009 \"0 0 18 ? * 2-6\"`, `0 0 18 ? * 2-6` 表示星期一至星期五 每天 18:00 执行一次\n可以使用在线编辑器生成 \u003chttps://www.bejson.com/othertools/cron/\u003e  \n为防止被 空格 分成多个参数，请使用 `\"` 包裹参数  \n\n### 动态订阅指令\n\n| 指令                                                      | 描述           |\n|:--------------------------------------------------------|:-------------|\n| `/\u003cbili-dynamic B动态\u003e \u003cadd 添加\u003e [uid] [contact]?`         | 添加一个b站动态订阅   |\n| `/\u003cbili-dynamic B动态\u003e \u003cstop 停止\u003e [uid] [contact]?`        | 停止一个b站动态订阅   |\n| `/\u003cbili-dynamic B动态\u003e \u003ctime 定时\u003e [uid] [cron]?`           | 设置任务的定时信息    |\n| `/\u003cbili-dynamic B动态\u003e \u003clist 列表\u003e [contact]?`              | 列出当前联系人的动态订阅 |\n| `/\u003cbili-dynamic B动态\u003e \u003cfilter 过滤\u003e [type] [add]?`         | 过滤特定类型的动态    |\n| `/\u003cbili-dynamic B动态\u003e \u003cforbid 屏蔽\u003e [pattern] [add]?`      | 添加一个动态正则屏蔽   |\n| `/\u003cbili-dynamic B动态\u003e \u003csleep 休眠\u003e [target] [start] [end]` | 添加一个休眠时间     |\n| `/\u003cbili-dynamic B动态\u003e \u003cat 艾特\u003e [target] [start] [end]`    | 添加一个艾特时间     |\n\n`/bili-dynamic forbid 转发抽奖` 添加一个正则屏蔽  \n`/bili-dynamic forbid 转发抽奖 false` 取消一个正则屏蔽  \n`/bili-dynamic filter 视频` 添加一个动态类型过滤  \n`/bili-dynamic filter 视频 false` 取消一个动态类型过滤  \n`type` 取值 `回复, 图片, 文本, 视频, 专栏, 音乐, 剧集, 删除, 番剧, 电视, 直播`\n\n### 直播订阅指令\n\n| 指令                                                   | 描述           |\n|:-----------------------------------------------------|:-------------|\n| `/\u003cbili-live B直播\u003e \u003cadd 添加\u003e [uid] [contact]?`         | 添加一个b站直播订阅   |\n| `/\u003cbili-live B直播\u003e \u003cstop 停止\u003e [uid] [contact]?`        | 停止一个b站直播订阅   |\n| `/\u003cbili-live B直播\u003e \u003ctime 定时\u003e [uid] [cron]?`           | 设置任务的定时信息    |\n| `/\u003cbili-live B直播\u003e \u003clist 列表\u003e [contact]?`              | 列出当前联系人的直播订阅 |\n| `/\u003cbili-live B直播\u003e \u003csleep 休眠\u003e [target] [start] [end]` | 添加一个休眠时间     |\n| `/\u003cbili-live B直播\u003e \u003cat 艾特\u003e [target] [start] [end]`    | 添加一个艾特时间     |\n\n### 视频订阅指令\n\n| 指令                                                    | 描述           |\n|:------------------------------------------------------|:-------------|\n| `/\u003cbili-video B视频\u003e \u003cadd 添加\u003e [uid] [contact]?`         | 添加一个b站视频订阅   |\n| `/\u003cbili-video B视频\u003e \u003cstop 停止\u003e [uid] [contact]?`        | 停止一个b站视频订阅   |\n| `/\u003cbili-video B视频\u003e \u003ctime 定时\u003e [uid] [cron]?`           | 设置任务的定时信息    |\n| `/\u003cbili-video B视频\u003e \u003clist 列表\u003e [contact]?`              | 列出当前联系人的视频订阅 |\n| `/\u003cbili-video B视频\u003e \u003cforbid 屏蔽\u003e [type] [add]?`         | 添加一个视频类型屏蔽   |\n| `/\u003cbili-video B视频\u003e \u003cfilter 过滤\u003e [tid] [add]?`          | 添加一个视频分区过滤   |\n| `/\u003cbili-video B视频\u003e \u003csleep 休眠\u003e [target] [start] [end]` | 添加一个休眠时间     |\n| `/\u003cbili-video B视频\u003e \u003cat 艾特\u003e [target] [start] [end]`    | 添加一个艾特时间     |\n\n`/bili-video forbid 付费` 添加一个类型屏蔽  \n`/bili-video forbid 付费 false` 取消一个类型屏蔽  \n`/bili-video filter 1` 添加一个分区过滤过滤  \n`/bili-video filter 1 false` 取消一个分区过滤过滤  \n`type` 取值 `付费, 联合, 回放`  \n`tid` 取值请参考 \u003chttps://github.com/SocialSisterYi/bilibili-API-collect/blob/master/video/video_zone.md\u003e\n\n视频订阅不宜过多，否则会触发b站反爬策略，导致IP被锁定 动态订阅一般会包含视频内容，推荐以此代替\n\n### 剧集订阅指令\n\n| 指令                                                     | 描述           |\n|:-------------------------------------------------------|:-------------|\n| `/\u003cbili-season B剧集\u003e \u003cadd 添加\u003e [sid] [contact]?`         | 添加一个b站剧集订阅   |\n| `/\u003cbili-season B剧集\u003e \u003cstop 停止\u003e [sid] [contact]?`        | 停止一个b站剧集频订阅  |\n| `/\u003cbili-season B剧集\u003e \u003ctime 定时\u003e [uid] [cron]?`           | 设置任务的定时信息    |\n| `/\u003cbili-season B剧集\u003e \u003clist 列表\u003e [contact]?`              | 列出当前联系人的剧集订阅 |\n| `/\u003cbili-season B剧集\u003e \u003csleep 休眠\u003e [target] [start] [end]` | 添加一个休眠时间     |\n| `/\u003cbili-season B剧集\u003e \u003cat 艾特\u003e [target] [start] [end]`    | 添加一个艾特时间     |\n\n剧集订阅需要 Season ID 例如 \u003chttps://www.bilibili.com/bangumi/play/ss38353\u003e 的 `38353`  \n可以通过 [搜索指令](#搜索指令) 搜索番剧 获得链接\n\n### 信息解析指令\n\n| 指令                                | 描述             |\n|:----------------------------------|:---------------|\n| `/\u003cbili-info B信息\u003e \u003caid\u003e [id]`     | 根据 avid 获取视频信息 |\n| `/\u003cbili-info B信息\u003e \u003cbvid\u003e [id]`    | 根据 bvid 获取视频信息 |\n| `/\u003cbili-info B信息\u003e \u003cdynamic\u003e [id]` | 根据 id 获取动态信息   |\n| `/\u003cbili-info B信息\u003e \u003clive\u003e [id]`    | 根据 id 获取直播信息   |\n| `/\u003cbili-info B信息\u003e \u003cuser\u003e [id]`    | 根据 id 获取用户信息   |\n\n因为返回结果包含图片，需要在聊天环境执行指令  \n消息中包含 `BV12v411G7dP` `av2` 等等 id 信息时会自动触发解析  \n目前会触发的正则表达式\n\n```regexp\n// Video\n\"\"\"(?i)(?\u003c!\\w)(?:av(\\d+)|(BV[0-9A-z]{10}))\"\"\"\n// Dynamic\n\"\"\"(?\u003c=t\\.bilibili\\.com/(?:h5/dynamic/detail/)?)(\\d+)\"\"\"\n// Live Room\n\"\"\"(?\u003c=live\\.bilibili\\.com/)(\\d+)\"\"\"\n// User Space\n\"\"\"(?\u003c=space\\.bilibili\\.com/|bilibili\\.com/space/)(\\d+)\"\"\"\n// Season\n\"\"\"(?i)(?\u003c!\\w)ss(\\d{4,10})\"\"\"\n// Episode\n\"\"\"(?i)(?\u003c!\\w)eq(\\d{4,10})\"\"\"\n// Media\n\"\"\"(?i)(?\u003c!\\w)md(\\d{4,10})\"\"\"\n// Article\n\"\"\"(?i)(?\u003c!\\w)cv(\\d{4,10})\"\"\"\n\"\"\"(?\u003c=bilibili\\.com/read/mobile\\?id=)(\\d+)\"\"\"\n// Short Link\n\"\"\"(?\u003c=b23\\.tv\\\\?/)[0-9A-z]+\"\"\"\n```\n\n### 搜索指令\n\n| 指令                                          | 描述   |\n|:--------------------------------------------|:-----|\n| `/\u003cbili-search B搜索\u003e \u003cuser 用户\u003e [keyword]`    | 搜索用户 |\n| `/\u003cbili-search B搜索\u003e \u003cbangumi 番剧\u003e [keyword]` | 搜索番剧 |\n| `/\u003cbili-search B搜索\u003e \u003cft 影视\u003e [keyword]`      | 搜索影视 |\n\n返回结果包含图片，需要在聊天环境执行指令\n\n### 任务列表指令\n\n| 指令                           | 描述   |\n|:-----------------------------|:-----|\n| `/\u003cbili-task B任务\u003e \u003call\u003e`     | 全部任务 |\n| `/\u003cbili-task B任务\u003e \u003cdynamic\u003e` | 动态任务 |\n| `/\u003cbili-task B任务\u003e \u003clive\u003e`    | 直播任务 |\n| `/\u003cbili-task B任务\u003e \u003cseason\u003e`  | 剧集任务 |\n| `/\u003cbili-task B任务\u003e \u003cvideo\u003e`   | 视频任务 |\n| `/\u003cbili-task B任务\u003e \u003cconfig\u003e`  | 屏蔽设置 |\n\n\n### 模板配置指令\n\n| 指令                                          | 描述   |\n|:--------------------------------------------|:-----|\n| `/\u003cbili-template B模板\u003e \u003cdatetime\u003e [pattern]` | 日期格式 |\n| `/\u003cbili-template B模板\u003e \u003creload\u003e`             | 重新加载 |\n\n`pattern` 的 取值为 [DateTimeFormatter](https://docs.oracle.com/javase/8/docs/api/java/time/format/DateTimeFormatter.html)  \n举例：\n  * `/B模板 datetime ISO_LOCAL_DATE_TIME`  \n  * `/B模板 datetime yyyy-MM-dd`\n\n### 登录指令\n\n| 指令                                     | 描述    |\n|:---------------------------------------|:------|\n| `/\u003cbili-login B登录\u003e`                    | 二维码登录 |\n\n## 设置\n\n位于`Mirai-Console`运行目录下的`config/xyz.cssxsh.mirai.plugin.bilibili-helper`文件夹下\n\n### BiliHelperSettings.yml\n\n* `cache` 图片缓存位置, 默认为 `ImageCache`\n* `limit` 动态 订阅 输出图片数量上限, 默认为 `16`\n* `api` API 访问间隔时间，单位秒, 默认为 `10`\n* `video` 视频 订阅 访问间隔时间，单位分钟, 默认为 `10`\n* `dynamic` 动态 订阅 访问间隔时间，单位分钟, 默认为 `10`\n* `live` 直播 订阅 访问间隔时间，单位分钟, 默认为 `30`\n* `season` 番剧 订阅 访问间隔时间，单位分钟, 默认为 `30`\n* `refresh` 启动时刷新 last，订阅最后推送将会重新开始记录，未推送内容将会因此丢弃\n* `selenium` ~~是否启用截图~~  此配置项废弃，通过 Template 文件内容来确定是否启用截图\n* `ban` 排除的自动解析内容，可以放一些不希望被解析的AV号之类的\n* `forward` 转发自动解析, 使用转发的形式发送自动解析结果\n* `max` 一次性推送的订阅内容上限, 超过这个上限将会尝试合并为转发消息\n\n### BiliCleanerConfig.yml\n\n* `interval` 图片清理的间隔时间，单位 小时\n* `expires` 图片缓存过期时间，单位 小时\n\n### SeleniumConfig.yml\n\n* `user_agent` 截图设备UA 网页识别设备类型，进而影响截图的效果  \n  iPad `Mozilla/5.0 (iPad; CPU OS 11_0 like Mac OS X) AppleWebKit/604.1.34 (KHTML, like Gecko) Version/11.0 Mobile/15A5341f Safari/604.1 MicroMessenger`  \n  iPhone `Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1 MicroMessenger`  \n  Mac `Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_8; en-us) AppleWebKit/534.50 (KHTML, like Gecko) Version/5.1 Safari/534.50 MicroMessenger`\n* `width` 截图宽度\n* `height` 截图高度\n* `pixel_ratio` ~~截图像素比~~ 此配置废除\n* `headless` 无头模式(后台模式)\n* `home` ~~浏览器会保持打开主页，以加快其他页面加载速度~~ 此配置废除\n* `hide` 隐藏的web组件(jQ选择器)  \n  添加 `\".international-header\", \".top-bar\", \".m-navbar\"` 可以屏蔽顶边栏\n\n### ~~LiveAtAll~~\n\n**此设置 1.5.0 废除**  \n此配置通过权限设置，权限ID为 `xyz.cssxsh.mirai.plugin.bilibili-helper:live.atall`  \n配置对象为群，即 `g*`, `g12345`  \n举例，`perm add g12345 xyz.cssxsh.mirai.plugin.bilibili-helper:live.atall`\n\n## Template\n\n位于 `config/xyz.cssxsh.mirai.plugin.bilibili-helper/Template` 目录下的 `template` 文件  \n文件名为对应的配置对象（类名），文件内容的 `#...` 是替换标记，将会替换为对应的值  \n值的名称请参考 [bilibili/data](src/main/kotlin/xyz/cssxsh/bilibili/data) 中的数据定义  \n`#images`, `#detail`, `#screenshot` 为特殊的替换标记，将会替换为特殊的处理结果  \n`#images` 将会替换为内容图片  \n在 `BiliRoomInfo` 中 `#detail` 将会替换为对应的 `Live`  \n在 `DynamicCard` 中 `#detail` 将会替换为对应的 `card` 解析结果    \n在 `DynamicInfo` 中 `#screenshot` 将会替换为截图（需要安装 `mirai-selenium-plugin`） \n在 `Article` 中 `#screenshot` 将会替换为截图（需要安装 `mirai-selenium-plugin`） \n例如可以将 `VideoStatus.template` 改为\n\n```\n👍 #like 💰 #coin ⭐ #favorite\n▶️ #view 💬 #reply 🔄 #share\n```\n\n## Cookies\n\n位于 `data/xyz.cssxsh.mirai.plugin.bilibili-helper/cookies.json`  \n导入 cookies文件 不是必须的，这是实验性功能，主要是防止b站反爬IP锁定  \n从 浏览器插件 [EditThisCookie](http://www.editthiscookie.com/) 导出Json 填入文件  \nEditThisCookie 安装地址\n[Chrome](https://chrome.google.com/webstore/detail/editthiscookie/fngmhnnpilhplaeedifhccceomclgfbg)\n[Firefox](https://addons.mozilla.org/firefox/downloads/file/3449327/editthiscookie2-1.5.0-fx.xpi)\n[Edge](https://microsoftedge.microsoft.com/addons/getproductdetailsbycrxid/ajfboaconbpkglpfanbmlfgojgndmhmc?hl=zh-CN\u0026gl=CN)\n\n现在你可以直接使用登录指令刷新 `cokies`\n\n## 安装\n\n### MCL 指令安装\n\n`./mcl --update-package xyz.cssxsh:bilibili-helper --channel maven-stable --type plugins`\n\n### 手动安装\n\n1. 从 [Releases](https://github.com/cssxsh/bilibili-helper/releases) 或者 [Maven](https://repo1.maven.org/maven2/xyz/cssxsh/bilibili-helper/) 下载 `mirai2.jar`\n2. 将其放入 `plugins` 文件夹中\n\n### 截图前置\n\n`./mcl --update-package xyz.cssxsh.mirai:mirai-selenium-plugin --channel maven-stable --type plugins`\n\n## TODO\n\n- [x] 完善剧集订阅\n- [x] 自动清理图片缓存\n\n## [爱发电](https://afdian.net/@cssxsh)\n\n![afdian](.github/afdian.jpg)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcssxsh%2Fbilibili-helper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcssxsh%2Fbilibili-helper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcssxsh%2Fbilibili-helper/lists"}