{"id":29426359,"url":"https://github.com/Snoopy1866/bilibili-danmu-block-list","last_synced_at":"2025-07-12T11:02:55.340Z","repository":{"id":269317569,"uuid":"906963324","full_name":"Snoopy1866/bilibili-danmu-block-list","owner":"Snoopy1866","description":"哔哩哔哩弹幕屏蔽规则列表","archived":false,"fork":false,"pushed_at":"2025-07-04T06:14:02.000Z","size":4141,"stargazers_count":11,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-04T07:25:04.739Z","etag":null,"topics":["bilibili","block-list","danmu"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Snoopy1866.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,"zenodo":null}},"created_at":"2024-12-22T12:40:52.000Z","updated_at":"2025-07-04T06:14:04.000Z","dependencies_parsed_at":"2025-01-09T12:21:58.523Z","dependency_job_id":"9db823be-fe87-4b5b-aa78-0b5d26088032","html_url":"https://github.com/Snoopy1866/bilibili-danmu-block-list","commit_stats":null,"previous_names":["snoopy1866/bilibili-danmu-block-list"],"tags_count":20,"template":false,"template_full_name":null,"purl":"pkg:github/Snoopy1866/bilibili-danmu-block-list","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Snoopy1866%2Fbilibili-danmu-block-list","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Snoopy1866%2Fbilibili-danmu-block-list/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Snoopy1866%2Fbilibili-danmu-block-list/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Snoopy1866%2Fbilibili-danmu-block-list/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Snoopy1866","download_url":"https://codeload.github.com/Snoopy1866/bilibili-danmu-block-list/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Snoopy1866%2Fbilibili-danmu-block-list/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264979764,"owners_count":23692492,"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","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","block-list","danmu"],"created_at":"2025-07-12T11:01:43.607Z","updated_at":"2025-07-12T11:02:55.334Z","avatar_url":"https://github.com/Snoopy1866.png","language":"Python","funding_links":[],"categories":["其他"],"sub_categories":["直播脚本"],"readme":"# bilibili-danmu-block-list\n\n[![uv](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/uv/main/assets/badge/v0.json)](https://github.com/astral-sh/uv)\n![GitHub License](https://img.shields.io/github/license/Snoopy1866/bilibili-danmu-block-list)\n![GitHub Downloads (all assets, all releases)](https://img.shields.io/github/downloads/Snoopy1866/bilibili-danmu-block-list/total)\n![GitHub Release](https://img.shields.io/github/v/release/Snoopy1866/bilibili-danmu-block-list)\n\n本仓库收集哔哩哔哩弹幕屏蔽规则。\n\n查看 [规则清单.md](rules.md) | [规则清单.json](bilibili-danmu-blocklist.json)\n\n## 使用说明\n\n### 如何导入规则\n\n\u003e [!NOTE]\n\u003e\n\u003e 你只能在 web 端导入规则。\n\n1. 前往 [Release](https://github.com/Snoopy1866/bilibili-danmu-block-list/releases/latest) 下载名为 `bilibili-danmu-blocklist-output.json` 的最新版规则文件。\n\n2. 进入任意哔哩哔哩视频页面，点击 `弹幕列表` 右侧的 ⠇，选择 `屏蔽设定`：\n   ![step1](res/how-to-use-step-1.png)\n\n3. 在内容空白处右键，选择 `导入json文件`：\n   ![step2](res/how-to-use-step-2.png)\n\n4. 在弹出的窗口中，找到在步骤 1 中下载的 json 文件，点击 `打开` 即可。\n\n### 如何清空规则\n\n分别切换到 `屏蔽文本`、`屏蔽正则` 标签，按 `F12` 打开开发者工具，在 `控制台` 中执行以下代码：\n\n```javascript\ndocument\n  .querySelectorAll(\"span.bpx-player-block-list-delete\")\n  .forEach((button) =\u003e {\n    button.click();\n  });\n```\n\n### 如何同步规则\n\n分别切换到 `屏蔽文本`、`屏蔽正则` 标签，按 `F12` 打开开发者工具，在 `控制台` 中执行以下代码：\n\n```javascript\ndocument\n  .querySelectorAll(\"span.bpx-player-block-list-sync\")\n  .forEach((button) =\u003e {\n    button.click();\n  });\n```\n\n如果出现下图中部分规则未上传的情况，请尝试重复执行上述代码，大部分规则均可以上传成功。\n\n![block list sync not completed](res/block-list-sync-not-completed.png)\n\n\u003e [!TIP]\n\u003e\n\u003e 上传成功后，可以在移动端 app 内打开任意视频，进入全屏，点击左下角 `弹幕设置`，进入 `更多工具` -\u003e `添加屏蔽词`，点击右上角 `同步`，即可将 web 端设置的屏蔽规则同步到 app 端，具体操作步骤如下：\n\u003e\n\u003e ![step1](res/block-list-sync-app-step-1.jpg)\n\u003e\n\u003e ![step2](res/block-list-sync-app-step-2.jpg)\n\u003e\n\u003e ![step3](res/block-list-sync-app-step-3.jpg)\n\n\u003e [!WARNING]\n\u003e\n\u003e 存在少数无法上传的规则，原因未知，这些规则只能单独在 web 端使用，例如：\n\u003e\n\u003e - `(?\u003c!乾)坤`\n\u003e - `(没|难)?((?\u003c!鹬)蚌|崩|绷)(埠|不)?(住)?(了)?`\n\n\u003e [!WARNING]\n\u003e\n\u003e 尽管通过上述方式可以将 web 端的规则同步到移动端，但实际上仍然存在部分规则无法在移动端生效的情况，原因未知。\n\n## 其他说明\n\n- 如果你需要配合 [pakku.js](https://github.com/xmcp/pakku.js) 使用，建议关闭弹幕数量标记显示，否则部分规则可能无法生效。\n  ![other-pakku.js](res/other-pakku-js.png)\n\n## 贡献指南\n\n推荐使用 [VSCode](https://code.visualstudio.com/Download) 编辑规则文件。\n\n前置要求\n\n- [Python](https://www.python.org/downloads) \u003e= 3.12\n- [Git](https://git-scm.com/downloads) \u003e= 2.45\n- [uv](https://docs.astral.sh/uv/getting-started/installation) \u003e= 0.5.9\n\n1. 克隆本仓库\n\n   ```bash\n   git clone https://github.com/Snoopy1866/bilibili-danmu-block-list.git\n   ```\n\n2. 初始化项目\n\n   ```bash\n   uv sync\n   ```\n\n3. 新建一个分支，名称任意（例如：`feat`）\n\n   ```bash\n   git checkout -b feat\n   ```\n\n4. 修改 `bilibili-danmu-blocklist.json`\n\n5. 提交更改并推送\n\n   ```bash\n   git add .\n   git commit -m \"feat: update rules\"\n   git push origin feat\n   ```\n\n6. 发起 Pull Request\n\n### `bilibili-danmu-blocklist.json` 字段解释\n\n#### 哔哩哔哩识别的字段：\n\n| 名称   | 含义           | 类型      | 必要性     | 取值          |\n| ------ | -------------- | --------- | ---------- | ------------- |\n| type   | 规则类型       | _int_     | _required_ | [0,1,2]       |\n| filter | 规则内容       | _string_  | _required_ | _Any_         |\n| opened | 规则是否启用   | _boolean_ | _required_ | true \\| false |\n| id     | 规则唯一标识符 | _int_     | _optional_ | _Any_         |\n\n\u003e [!NOTE]\n\u003e\n\u003e `id` 字段本应作为规则的唯一标识符，以便在更新规则文件时相同 `id` 的规则可以被正确覆盖，\n\u003e 但实际上导入规则文件后，哔哩哔哩会重新生成一个新的 `id` 值，这使得规则的原地更新无法实现。\n\u003e\n\u003e 尽管如此，本仓库仍然保留 `id` 字段，以便在发布 Release 时能够正确识别发生变更的规则。\n\n#### 本仓库添加的字段：\n\n| 名称            | 含义         | 类型            | 必要性     | 可选值 |\n| --------------- | ------------ | --------------- | ---------- | ------ |\n| description     | 规则描述     | _string_        | _optional_ | _Any_  |\n| examples        | 规则匹配示例 | _Array[string]_ | _optional_ | _Any_  |\n| excludeExamples | 规则排除示例 | _Array[string]_ | _optional_ | _Any_  |\n\n\u003e [!NOTE]\n\u003e\n\u003e 1. `excludeExamples` 字段用于辅助正则表达式的编写，尽可能避免错杀正常弹幕。\n\u003e 2. `description` 字段暂未启用，后续可能会移除。\n\n\u003e [!IMPORTANT]\n\u003e\n\u003e 1. 请不要添加 `type=2` 的规则，这类规则用于屏蔽指定 UID 的用户发出的弹幕，你应该自行添加这类规则，而不是在公共仓库中添加。\n\u003e 2. 请不要添加 `id` 字段，该字段会在你提交 PR 后根据当前时间戳（精确到纳秒）自动生成。\n\u003e 3. 添加或修改 `屏蔽正则` 类型的规则需注意：\n\u003e    - 使用 `\\\\` 代替 `\\`，例如：使用 `\\\\d+` 代替 `\\d+`，这是因为 json 字符串本身需要对字符 `\\` 进行转义\n\u003e    - 不要使用类似 `(阿巴)*` 这样的正则表达式，在缺少定位符 `^` 或 `$` 的情况下使用 `*` 会导致所有弹幕都被屏蔽\n\n## 相关链接\n\n- [正则表达式指南](https://docs.python.org/zh-cn/3.13/howto/regex.html)\n- [正则表达式可视化](https://jianyu.io/regulex)\n- [正则表达式测试](https://www.jyshare.com/front-end/854)\n\n## 类似的仓库\n\n- https://github.com/jnxyp/Bilibili-Block-List\n- https://github.com/zornlemma/bilibili_RE_block_list\n- https://github.com/fang2hou/Bilibili-block-list\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FSnoopy1866%2Fbilibili-danmu-block-list","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FSnoopy1866%2Fbilibili-danmu-block-list","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FSnoopy1866%2Fbilibili-danmu-block-list/lists"}