Skip to content

Commit

Permalink
merge dev to main, v4.0.10 (#175)
Browse files Browse the repository at this point in the history
  • Loading branch information
festoney8 authored Nov 19, 2024
2 parents e5989a6 + 20f5506 commit e9eaaf0
Show file tree
Hide file tree
Showing 17 changed files with 197 additions and 147 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# CHANGELOG

## 4.0.10

- 新增:评论区过滤 过滤@其他用户的无回复评论
- 更新:收录更多AI机器人
- 更新:部分功能细节

## 4.0.9

- 新增:搜索页 隐藏搜索结果中的直播
Expand Down
14 changes: 6 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@

### 稳定版:[前往 Greasyfork 安装](https://greasyfork.org/zh-CN/scripts/479861)

- **Firefox** 浏览器请查看 [**浏览器适配**](#浏览器适配)
- 请查看 [**浏览器适配**](#浏览器适配)
- Chromium 系浏览器,建议在浏览器扩展管理页启用开发者模式
- 稳定版持续在 Greasyfork 发布,油猴插件会定期检查,自动更新

### 测试版:[Release 安装](https://github.com/festoney8/bilibili-cleaner/releases/)
Expand Down Expand Up @@ -63,18 +64,18 @@
- 混搭各种功能,调节浏览器缩放比例,可得到满意的页面效果
- 不做老版本页面适配,不做未登录状态适配
- **已知问题:**
- 部分功能不支持 Firefox 浏览器
- 特殊活动直播,调节脚本设置后需刷新页面才生效,弹幕净化不生效
- 给 UP 主充电时,若出现 **充电窗口载入失败 (报错NaN)**,请关闭通用项「URL参数净化」,刷新页面再充电
- 特殊活动直播,调节脚本设置后需刷新页面才生效,弹幕净化不生效

### 2. 视频过滤

- **每个页面有独立的功能开关,但黑名单、白名单全站共用一份**
- **白名单权限高于黑名单,命中白名单的视频不会被隐藏**
- 启用 UP 主过滤后,右键单击 UP 主即可屏蔽
- 启用 BV 号过滤后,右键单击视频标题即可屏蔽
- 「标题关键词过滤」和「标题关键词白名单」大小写不敏感。均支持正则,正则用 `/ ... /` 括起来,如:`/abc|\d+/`,无需flag(一律默认`iu`模式,大小写不敏感)
- 已知问题:视频过滤在带 `index.html` 后缀的首页不生效,请使用无后缀首页 https://www.bilibili.com/
- 「标题关键词过滤」和「标题关键词白名单」大小写不敏感,均支持正则
- 正则用 `/ ... /` 括起来,如:`/abc|\d+/`,无需flag(一律默认`iu`模式,大小写不敏感)
- 视频过滤在带 `index.html` 后缀的首页不生效,请使用无后缀首页 https://www.bilibili.com/

> [!NOTE]
>
Expand Down Expand Up @@ -102,9 +103,6 @@

- **要求 Chromium 内核版本 >= 105**,内核版本过低会导致大量功能失效,如:无法净化顶栏

> - 鉴于 Google 在推行 [Manifest V3](https://developer.chrome.com/docs/extensions/migrating/checklist),影响油猴插件,建议启用浏览器开发者模式。
> - Chrome 和 Edge 均可在插件管理页找到开发者模式开关。
### Firefox

- **Firefox 103~120,按如下步骤开启高级设定**
Expand Down
8 changes: 4 additions & 4 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 23 additions & 0 deletions src/modules/filters/variety/comment/extra/bots.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
export const bots = [
'机器工具人', // 8455326
'有趣的程序员', // 234978716
'AI视频小助理', // 1141159409
'AI视频小助理总结一下', // 437175450
'AI笔记侠', // 1692825065
'AI视频助手', // 690155730
'哔哩哔理点赞姬', // 689670224
'课代表猫', // 3494380876859618
'AI课代表呀', // 1168527940
'木几萌Moe', // 439438614
'星崽丨StarZai', // 1358327273
'AI沈阳美食家', // 3546376048741135
'AI头脑风暴', // 9868463
'GPT_5', // 358243654
'Juice_AI', // 393788832
'AI全文总结', // 91394217
'AI视频总结', // 473018527
'AI总结视频', // 3546639035795567
'AI工具集', // 605801219
'Ai的评论', // 3546740500204293
'AI识片酱', // 1835753760
]
107 changes: 63 additions & 44 deletions src/modules/filters/variety/comment/pages/dynamic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,14 @@ import ShadowInstance from '../../../../../utils/shadow'
import { BiliCleanerStorage } from '../../../../../utils/storage'
import { orderedUniq, showEle } from '../../../../../utils/tool'
import { coreCheck } from '../../../core/core'
import { bots } from '../extra/bots'
import {
CommentBotFilter,
CommentCallBotFilter,
CommentCallUserFilter,
CommentCallUserNoReplyFilter,
CommentCallUserOnlyFilter,
CommentCallUserOnlyNoReplyFilter,
CommentContentFilter,
CommentLevelFilter,
CommentUsernameFilter,
Expand Down Expand Up @@ -48,9 +51,15 @@ const GM_KEYS = {
callUser: {
statusKey: 'dynamic-comment-call-user-filter-status',
},
callUserNoReply: {
statusKey: 'dynamic-comment-call-user-noreply-filter-status',
},
callUserOnly: {
statusKey: 'dynamic-comment-call-user-only-filter-status',
},
callUserOnlyNoReply: {
statusKey: 'dynamic-comment-call-user-only-noreply-filter-status',
},
isAD: {
statusKey: 'dynamic-comment-ad-filter-status',
},
Expand Down Expand Up @@ -89,9 +98,21 @@ const selectorFns = {
callUser: (comment: HTMLElement): SelectorResult => {
return (comment as any).__data?.content?.members[0]?.uname
},
callUserNoReply: (comment: HTMLElement): SelectorResult => {
if ((comment as any).__data?.rcount !== 0) {
return undefined
}
return (comment as any).__data?.content?.members[0]?.uname
},
callUserOnly: (comment: HTMLElement): SelectorResult => {
return (comment as any).__data?.content?.message?.replace(/@[^@\s]+/g, ' ').trim() === ''
},
callUserOnlyNoReply: (comment: HTMLElement): SelectorResult => {
if ((comment as any).__data?.rcount !== 0) {
return undefined
}
return (comment as any).__data?.content?.message?.replace(/@[^@\s]+/g, ' ').trim() === ''
},
level: (comment: HTMLElement): SelectorResult => {
return (comment as any).__data?.member?.level_info?.current_level
},
Expand Down Expand Up @@ -181,7 +202,9 @@ class CommentFilterDynamic implements IMainFilter {
commentBotFilter = new CommentBotFilter()
commentCallBotFilter = new CommentCallBotFilter()
commentCallUserFilter = new CommentCallUserFilter()
commentCallUserNoReplyFilter = new CommentCallUserNoReplyFilter()
commentCallUserOnlyFilter = new CommentCallUserOnlyFilter()
commentCallUserOnlyNoReplyFilter = new CommentCallUserOnlyNoReplyFilter()
// 白名单
commentIsUpFilter = new CommentIsUpFilter()
commentIsPinFilter = new CommentIsPinFilter()
Expand All @@ -190,53 +213,13 @@ class CommentFilterDynamic implements IMainFilter {

init() {
// 黑名单
const bots = [
// 8455326 @机器工具人
// 234978716 @有趣的程序员
// 1141159409 @AI视频小助理
// 437175450 @AI视频小助理总结一下 (误伤)
// 1692825065 @AI笔记侠
// 690155730 @AI视频助手
// 689670224 @哔哩哔理点赞姬
// 3494380876859618 @课代表猫
// 1168527940 @AI课代表呀
// 439438614 @木几萌Moe
// 1358327273 @星崽丨StarZai
// 3546376048741135 @AI沈阳美食家
// 1835753760 @AI识片酱 // 听歌识曲,免除过滤
// 9868463 @AI头脑风暴
// 358243654 @GPT_5
// 393788832 @Juice_AI
// 91394217 @AI全文总结
// 473018527 @AI视频总结
// 3546639035795567 @AI总结视频
// 605801219 @AI工具集
'机器工具人',
'有趣的程序员',
'AI视频小助理',
'AI视频小助理总结一下',
'AI笔记侠',
'AI视频助手',
'哔哩哔理点赞姬',
'课代表猫',
'AI课代表呀',
'木几萌Moe',
'星崽丨StarZai',
'AI沈阳美食家',
'AI头脑风暴',
'GPT_5',
'Juice_AI',
'AI全文总结',
'AI视频总结',
'AI总结视频',
'AI工具集',
]
this.commentUsernameFilter.setParam(BiliCleanerStorage.get(GM_KEYS.black.username.valueKey, []))
this.commentContentFilter.setParam(BiliCleanerStorage.get(GM_KEYS.black.content.valueKey, []))
this.commentLevelFilter.setParam(BiliCleanerStorage.get(GM_KEYS.black.level.valueKey, 0))
this.commentBotFilter.setParam(bots)
this.commentCallBotFilter.setParam(bots)
this.commentCallUserFilter.setParam([`/./`])
this.commentCallUserNoReplyFilter.setParam([`/./`])
}

/**
Expand All @@ -255,7 +238,9 @@ class CommentFilterDynamic implements IMainFilter {
this.commentBotFilter.isEnable ||
this.commentCallBotFilter.isEnable ||
this.commentCallUserFilter.isEnable ||
this.commentCallUserOnlyFilter.isEnable
this.commentCallUserNoReplyFilter.isEnable ||
this.commentCallUserOnlyFilter.isEnable ||
this.commentCallUserOnlyNoReplyFilter.isEnable
)
) {
revertAll = true
Expand All @@ -282,7 +267,9 @@ class CommentFilterDynamic implements IMainFilter {
`username: ${selectorFns.root.username(v)}`,
`content: ${selectorFns.root.content(v)}`,
`callUser: ${selectorFns.root.callUser(v)}`,
`callUserNoReply: ${selectorFns.root.callUserNoReply(v)}`,
`callUserOnly: ${selectorFns.root.callUserOnly(v)}`,
`callUserOnlyNoReply: ${selectorFns.root.callUserOnlyNoReply(v)}`,
`level: ${selectorFns.root.level(v)}`,
`isUp: ${selectorFns.root.isUp(v)}`,
`isPin: ${selectorFns.root.isPin(v)}`,
Expand All @@ -305,8 +292,12 @@ class CommentFilterDynamic implements IMainFilter {
this.commentBotFilter.isEnable && blackPairs.push([this.commentBotFilter, selectorFns.root.username])
this.commentCallBotFilter.isEnable && blackPairs.push([this.commentCallBotFilter, selectorFns.root.callUser])
this.commentCallUserFilter.isEnable && blackPairs.push([this.commentCallUserFilter, selectorFns.root.callUser])
this.commentCallUserNoReplyFilter.isEnable &&
blackPairs.push([this.commentCallUserNoReplyFilter, selectorFns.root.callUserNoReply])
this.commentCallUserOnlyFilter.isEnable &&
blackPairs.push([this.commentCallUserOnlyFilter, selectorFns.root.callUserOnly])
this.commentCallUserOnlyNoReplyFilter.isEnable &&
blackPairs.push([this.commentCallUserOnlyNoReplyFilter, selectorFns.root.callUserOnlyNoReply])

const whitePairs: SubFilterPair[] = []
this.commentIsUpFilter.isEnable && whitePairs.push([this.commentIsUpFilter, selectorFns.root.isUp])
Expand Down Expand Up @@ -593,7 +584,7 @@ export const commentFilterDynamicGroups: Group[] = [
{
type: 'switch',
id: GM_KEYS.black.callUserOnly.statusKey,
name: '过滤 只含 @其他用户 的评论',
name: '过滤 只含 @其他用户 的全部评论',
noStyle: true,
enableFn: () => {
mainFilter.commentCallUserOnlyFilter.enable()
Expand All @@ -604,10 +595,24 @@ export const commentFilterDynamicGroups: Group[] = [
mainFilter.check('full')
},
},
{
type: 'switch',
id: GM_KEYS.black.callUserOnlyNoReply.statusKey,
name: '过滤 只含 @其他用户 的无回复评论',
noStyle: true,
enableFn: () => {
mainFilter.commentCallUserOnlyNoReplyFilter.enable()
mainFilter.check('full')
},
disableFn: () => {
mainFilter.commentCallUserOnlyNoReplyFilter.disable()
mainFilter.check('full')
},
},
{
type: 'switch',
id: GM_KEYS.black.callUser.statusKey,
name: '过滤 包含 @其他用户 的评论',
name: '过滤 包含 @其他用户 的全部评论',
noStyle: true,
enableFn: () => {
mainFilter.commentCallUserFilter.enable()
Expand All @@ -618,6 +623,20 @@ export const commentFilterDynamicGroups: Group[] = [
mainFilter.check('full')
},
},
{
type: 'switch',
id: GM_KEYS.black.callUserNoReply.statusKey,
name: '过滤 包含 @其他用户 的无回复评论',
noStyle: true,
enableFn: () => {
mainFilter.commentCallUserNoReplyFilter.enable()
mainFilter.check('full')
},
disableFn: () => {
mainFilter.commentCallUserNoReplyFilter.disable()
mainFilter.check('full')
},
},
],
},
{
Expand Down
42 changes: 1 addition & 41 deletions src/modules/filters/variety/comment/pages/space.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { isPageSpace } from '../../../../../utils/pageType'
import { BiliCleanerStorage } from '../../../../../utils/storage'
import { orderedUniq, showEle, waitForEle } from '../../../../../utils/tool'
import { coreCheck } from '../../../core/core'
import { bots } from '../extra/bots'
import {
CommentBotFilter,
CommentCallBotFilter,
Expand Down Expand Up @@ -188,47 +189,6 @@ class CommentFilterSpace implements IMainFilter {

init() {
// 黑名单
const bots = [
// 8455326 @机器工具人
// 234978716 @有趣的程序员
// 1141159409 @AI视频小助理
// 437175450 @AI视频小助理总结一下 (误伤)
// 1692825065 @AI笔记侠
// 690155730 @AI视频助手
// 689670224 @哔哩哔理点赞姬
// 3494380876859618 @课代表猫
// 1168527940 @AI课代表呀
// 439438614 @木几萌Moe
// 1358327273 @星崽丨StarZai
// 3546376048741135 @AI沈阳美食家
// 1835753760 @AI识片酱 // 听歌识曲,免除过滤
// 9868463 @AI头脑风暴
// 358243654 @GPT_5
// 393788832 @Juice_AI
// 91394217 @AI全文总结
// 473018527 @AI视频总结
// 3546639035795567 @AI总结视频
// 605801219 @AI工具集
'机器工具人',
'有趣的程序员',
'AI视频小助理',
'AI视频小助理总结一下',
'AI笔记侠',
'AI视频助手',
'哔哩哔理点赞姬',
'课代表猫',
'AI课代表呀',
'木几萌Moe',
'星崽丨StarZai',
'AI沈阳美食家',
'AI头脑风暴',
'GPT_5',
'Juice_AI',
'AI全文总结',
'AI视频总结',
'AI总结视频',
'AI工具集',
]
this.commentUsernameFilter.setParam(BiliCleanerStorage.get(GM_KEYS.black.username.valueKey, []))
this.commentContentFilter.setParam(BiliCleanerStorage.get(GM_KEYS.black.content.valueKey, []))
this.commentLevelFilter.setParam(BiliCleanerStorage.get(GM_KEYS.black.level.valueKey, 0))
Expand Down
Loading

0 comments on commit e9eaaf0

Please sign in to comment.