Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merge dev to main, v3.6.3 #77

Merged
merged 7 commits into from
May 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions .github/workflows/dev-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,10 @@ jobs:
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
# https://github.com/pnpm/action-setup/issues/99#issuecomment-1918361558
- run: corepack enable
- name: install node and pnpm
uses: actions/setup-node@v4
uses: pnpm/action-setup@v4
with:
node-version: 20
cache: "pnpm"
version: 8

- name: install
run: pnpm install
Expand Down
6 changes: 2 additions & 4 deletions .github/workflows/main-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,10 @@ jobs:
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
- run: corepack enable
- name: install node and pnpm
uses: actions/setup-node@v4
uses: pnpm/action-setup@v4
with:
node-version: 20
cache: "pnpm"
version: 8

- name: Install dependencies
run: pnpm install
Expand Down
89 changes: 43 additions & 46 deletions .github/workflows/main-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,53 +11,50 @@ jobs:
permissions:
contents: write
steps:
# environment
- name: checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
# https://github.com/pnpm/action-setup/issues/99#issuecomment-1918361558
- run: corepack enable
- name: install node and pnpm
uses: actions/setup-node@v4
with:
node-version: 20
cache: "pnpm"
# environment
- name: checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
- name: install node and pnpm
uses: pnpm/action-setup@v4
with:
version: 8

# prepare
- run: pnpm install
- run: pnpm run lint
- run: pnpm run format
# prepare
- run: pnpm install
- run: pnpm run lint
- run: pnpm run format

# build normal and minify version, save to folder
- name: build minify
run: pnpm run build:minify
- name: mkdir
run: mkdir build-release
- name: move and rename file
run: mv dist/bilibili-cleaner.user.js build-release/bilibili-cleaner.min.user.js
- name: build default
run: pnpm run build
- name: copy file
run: cp dist/bilibili-cleaner.user.js build-release/
- name: list files
run: ls -lah build-release/
# build normal and minify version, save to folder
- name: build minify
run: pnpm run build:minify
- name: mkdir
run: mkdir build-release
- name: move and rename file
run: mv dist/bilibili-cleaner.user.js build-release/bilibili-cleaner.min.user.js
- name: build default
run: pnpm run build
- name: copy file
run: cp dist/bilibili-cleaner.user.js build-release/
- name: list files
run: ls -lah build-release/

# release
- name: get version num
id: get_vernum
run: |
version=${{ github.ref_name }}
vernum=$( echo $version | sed 's/[^0-9]//g')
echo "New version: $vernum"
echo "VERSION_NUM=$vernum" >> "$GITHUB_OUTPUT"
# release
- name: get version num
id: get_vernum
run: |
version=${{ github.ref_name }}
vernum=$( echo $version | sed 's/[^0-9]//g')
echo "New version: $vernum"
echo "VERSION_NUM=$vernum" >> "$GITHUB_OUTPUT"

- name: release action
uses: ncipollo/release-action@v1
with:
artifacts: 'build-release/*.js'
allowUpdates: true
replacesArtifacts: true
generateReleaseNotes: true
body: '## [更新日志](https://github.com/festoney8/bilibili-cleaner/blob/main/CHANGELOG.md#${{ steps.get_vernum.outputs.VERSION_NUM }})'
token: ${{ secrets.GITHUB_TOKEN }}
- name: release action
uses: ncipollo/release-action@v1
with:
artifacts: 'build-release/*.js'
allowUpdates: true
replacesArtifacts: true
generateReleaseNotes: true
body: '## [更新日志](https://github.com/festoney8/bilibili-cleaner/blob/main/CHANGELOG.md#${{ steps.get_vernum.outputs.VERSION_NUM }})'
token: ${{ secrets.GITHUB_TOKEN }}
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# CHANGELOG

## 3.6.3

- 新增:修复字体支持动态详情页
- 新增:直播页隐藏头像饰品
- 新增:隐藏视频清晰度
- 更新:收录更多AI机器人
- 优化:功能细节

## 3.6.2

- 新增:稍后再看列表页,双列布局
Expand Down
21 changes: 10 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@
- 适用于净化新版 bilibili 网页,不适配老版本页面,默认用户已登录,大会员体验最佳
- 混搭各种功能,调节浏览器缩放比例,可得到满意的页面效果
- 「影视番剧播放页」多数功能与「播放页」一致且同步,「动态页」评论区功能与「播放页」一致且同步
- 已知bug:给 UP 主充电时,若出现 **充电窗口载入失败 (报错NaN)**,请关闭通用项「URL参数净化」,刷新页面再充电
- 已知bug:特殊活动直播,调节脚本设置后需刷新页面才生效,弹幕净化不生效
- 已知问题:给 UP 主充电时,若出现 **充电窗口载入失败 (报错NaN)**,请关闭通用项「URL参数净化」,刷新页面再充电
- 已知问题:特殊活动直播,调节脚本设置后需刷新页面才生效,弹幕净化不生效

### 2. 视频过滤

Expand All @@ -63,16 +63,17 @@
> - **如果屏蔽了大量内容,请定时备份,更换电脑或浏览器务必备份,[备份方法](#数据导入与导出)**
> - 如果你在意推送质量,不要点开不喜欢的视频,不要点开不喜欢的 UP 主的个人页,请在无痕浏览打开

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

> [!NOTE]
>
> - **时长过滤不宜过长**,会错过优质视频,推荐设定 60~90 秒
> - **关键词不宜过于简单**,可能造成误伤
> - **编写正则要慎重**,可能造成大量视频屏蔽和频繁载入
> - **编写白名单注意影响范围**,白名单权限高,可能会让不喜欢的视频出现
> - **屏蔽后,如果视频没有消失,很可能命中了白名单**
Expand All @@ -83,7 +84,6 @@

### 3. 评论过滤

- 评论过滤支持「用户名、关键词」两种模式
- 启用用户名过滤后,在评论区右键单击用户名即可屏蔽
- 关键词黑名单大小写不敏感。支持正则,语法:`/abc|\d+/`,无需flag(一律默认`iv`模式,大小写不敏感)
- **白名单权限高于黑名单,命中白名单的评论不会被隐藏**
Expand Down Expand Up @@ -124,7 +124,7 @@

- **[Violentmonkey](https://violentmonkey.github.io/)(暴力猴):支持,部分测试**

- [Greasemonkey](https://www.greasespot.net/) 和 [ScriptCat](https://docs.scriptcat.org/) 未进行测试
- [Greasemonkey](https://www.greasespot.net/) 和 [ScriptCat](https://docs.scriptcat.org/) 未测试

## 净化效果对比

Expand Down Expand Up @@ -189,8 +189,6 @@

- 绝大多数功能兼容,小部分功能重复,均不会产生崩坏

- 本脚本中的 通用项「隐藏-顶栏相关」对 Evolved 的自定义顶栏无效

- **隐藏首页banner**

- 使用「Evolved 夜间模式」时,开启 Evolved 的「隐藏顶部横幅」,关闭本脚本的「隐藏 banner」
Expand All @@ -199,12 +197,11 @@

- **清爽首页、极简首页** 会接管首页布局,本脚本对其无效

- 可能存在其他未测试到的不兼容情况

### 2. 与 [bilibili-app-recommend](https://greasyfork.org/zh-CN/scripts/443530) 的兼容性

- **兼容**,提供 **隐藏 视频tag / 隐藏 弹幕数 / 隐藏 点赞数** 功能,在首页功能菜单末尾
- bilibili-app-recommend 自带 UP 主黑名单,无需使用本插件的视频过滤
- 标题关键词过滤、BV 号过滤暂不支持该插件的推荐列表

### 3. 与 [Bilibili 旧播放页](https://github.com/MotooriKashin/Bilibili-Old) 的兼容性

Expand All @@ -220,6 +217,8 @@

## 数据导入与导出

- 更换电脑或浏览器时,需全选油猴插件内所有脚本,一并导出数据,在另一设备恢复

<details>
<summary><b>导出数据</b></summary>

Expand Down
2 changes: 2 additions & 0 deletions src/filters/videoFilter/pages/video.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,8 @@ if (isPageVideo() || isPagePlaylist()) {
const title = video.querySelector('.bpx-player-ending-related-item-title')?.textContent?.trim()
if (title && blacklistVideoTitle.has(title)) {
hideEle(video)
} else {
showEle(video)
}
})
clearInterval(endingInterval)
Expand Down
14 changes: 12 additions & 2 deletions src/rules/bangumi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,12 @@ if (isPageBangumi()) {
description: '隐藏 Hi-Res无损',
itemCSS: `.bpx-player-ctrl-flac {display: none !important;}`,
}),
// 隐藏 清晰度
new CheckboxItem({
itemID: 'video-page-hide-bpx-player-ctrl-quality',
description: '隐藏 清晰度',
itemCSS: `.bpx-player-ctrl-quality {display: none !important;}`,
}),
// 隐藏 选集
new CheckboxItem({
itemID: 'video-page-hide-bpx-player-ctrl-eplist',
Expand Down Expand Up @@ -671,6 +677,7 @@ if (isPageBangumi()) {
// 393788832 @Juice_AI
// 91394217 @AI全文总结
// 473018527 @AI视频总结
// 3546639035795567 @AI总结视频
`.reply-item:has(.jump-link.user[data-user-id="8455326"]),
.reply-item:has(.jump-link.user[data-user-id="234978716"]),
.reply-item:has(.jump-link.user[data-user-id="1141159409"]),
Expand All @@ -688,7 +695,8 @@ if (isPageBangumi()) {
.reply-item:has(.jump-link.user[data-user-id="358243654"]),
.reply-item:has(.jump-link.user[data-user-id="393788832"]),
.reply-item:has(.jump-link.user[data-user-id="91394217"]),
.reply-item:has(.jump-link.user[data-user-id="473018527"]) {
.reply-item:has(.jump-link.user[data-user-id="473018527"]),
.reply-item:has(.jump-link.user[data-user-id="3546639035795567"]) {
display: none !important;
}`,
}),
Expand Down Expand Up @@ -716,6 +724,7 @@ if (isPageBangumi()) {
// 393788832 @Juice_AI
// 91394217 @AI全文总结
// 473018527 @AI视频总结
// 3546639035795567 @AI总结视频
`.reply-item:has(.root-reply-container .user-name[data-user-id="8455326"]),
.reply-item:has(.root-reply-container .user-name[data-user-id="234978716"]),
.reply-item:has(.root-reply-container .user-name[data-user-id="1141159409"]),
Expand All @@ -733,7 +742,8 @@ if (isPageBangumi()) {
.reply-item:has(.root-reply-container .user-name[data-user-id="358243654"]),
.reply-item:has(.root-reply-container .user-name[data-user-id="393788832"]),
.reply-item:has(.root-reply-container .user-name[data-user-id="91394217"]),
.reply-item:has(.root-reply-container .user-name[data-user-id="473018527"]) {
.reply-item:has(.root-reply-container .user-name[data-user-id="473018527"]),
.reply-item:has(.root-reply-container .user-name[data-user-id="3546639035795567"]) {
display: none !important;
}`,
}),
Expand Down
53 changes: 51 additions & 2 deletions src/rules/dynamic.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Group } from '../components/group'
import { CheckboxItem } from '../components/item'
import { isPageDynamic } from '../utils/page-type'
import settings from '../settings'

// 自动展开 相同UP主被折叠的动态
const dynamicUnfold = () => {
Expand All @@ -24,6 +25,32 @@ const dynamicGroupList: Group[] = []
* 评论区规则适配2种动态详情页(t.bilibili.com/12121212和bilibili.com/opus/12121212)
*/
if (isPageDynamic()) {
let fontPatchCSS = ''
if (location.href.match(/www\.bilibili\.com\/opus\/\d+/)) {
fontPatchCSS = `
${settings.fontFaceRegular}
${settings.fontFaceMedium}
.reply-item .root-reply-container .content-warp .user-info .user-name {
font-family: PingFang SC,HarmonyOS_Medium,Helvetica Neue,Microsoft YaHei,sans-serif !important;
font-weight: 500 !important;
font-size: 14px !important;
}`
} else if (location.href.match(/t\.bilibili\.com\/\d+/)) {
fontPatchCSS = `
${settings.fontFaceRegular}
body {
font-family: PingFang SC, HarmonyOS_Regular, Helvetica Neue, Microsoft YaHei, sans-serif !important;
font-weight: 400;
}`
} else if (location.href.includes('www.bilibili.com/v/topic/detail/')) {
fontPatchCSS = `
${settings.fontFaceRegular}
body {
font-family: PingFang SC, HarmonyOS_Regular, Helvetica Neue, Microsoft YaHei, sans-serif !important;
font-weight: 400;
}`
}

// 基本功能
const basicItems = [
// 顶栏 不再吸附顶部
Expand All @@ -44,6 +71,12 @@ if (isPageDynamic()) {
aside.right {order: 1; margin-right: 12px !important;}
.bili-dyn-sidebar {order: 4;}`,
}),
// 修复字体
new CheckboxItem({
itemID: 'font-patch',
description: '修复字体 (实验功能)',
itemCSS: fontPatchCSS,
}),
]
dynamicGroupList.push(new Group('dynamic-basic', '动态页 基本功能', basicItems))

Expand Down Expand Up @@ -429,6 +462,10 @@ if (isPageDynamic()) {
// 1835753760 @AI识片酱
// 9868463 @AI头脑风暴
// 358243654 @GPT_5
// 393788832 @Juice_AI
// 91394217 @AI全文总结
// 473018527 @AI视频总结
// 3546639035795567 @AI总结视频
`.reply-item:has(.jump-link.user[data-user-id="8455326"]),
.reply-item:has(.jump-link.user[data-user-id="234978716"]),
.reply-item:has(.jump-link.user[data-user-id="1141159409"]),
Expand All @@ -443,7 +480,11 @@ if (isPageDynamic()) {
.reply-item:has(.jump-link.user[data-user-id="3546376048741135"]),
.reply-item:has(.jump-link.user[data-user-id="1835753760"]),
.reply-item:has(.jump-link.user[data-user-id="9868463"]),
.reply-item:has(.jump-link.user[data-user-id="358243654"]) {
.reply-item:has(.jump-link.user[data-user-id="358243654"]),
.reply-item:has(.jump-link.user[data-user-id="393788832"]),
.reply-item:has(.jump-link.user[data-user-id="91394217"]),
.reply-item:has(.jump-link.user[data-user-id="473018527"]),
.reply-item:has(.jump-link.user[data-user-id="3546639035795567"]) {
display: none !important;
}`,
}),
Expand All @@ -468,6 +509,10 @@ if (isPageDynamic()) {
// 1835753760 @AI识片酱
// 9868463 @AI头脑风暴
// 358243654 @GPT_5
// 393788832 @Juice_AI
// 91394217 @AI全文总结
// 473018527 @AI视频总结
// 3546639035795567 @AI总结视频
`.reply-item:has(.root-reply-container .user-name[data-user-id="8455326"]),
.reply-item:has(.root-reply-container .user-name[data-user-id="234978716"]),
.reply-item:has(.root-reply-container .user-name[data-user-id="1141159409"]),
Expand All @@ -482,7 +527,11 @@ if (isPageDynamic()) {
.reply-item:has(.root-reply-container .user-name[data-user-id="3546376048741135"]),
.reply-item:has(.root-reply-container .user-name[data-user-id="1835753760"]),
.reply-item:has(.root-reply-container .user-name[data-user-id="9868463"]),
.reply-item:has(.root-reply-container .user-name[data-user-id="358243654"]) {
.reply-item:has(.root-reply-container .user-name[data-user-id="358243654"]),
.reply-item:has(.root-reply-container .user-name[data-user-id="393788832"]),
.reply-item:has(.root-reply-container .user-name[data-user-id="91394217"]),
.reply-item:has(.root-reply-container .user-name[data-user-id="473018527"]),
.reply-item:has(.root-reply-container .user-name[data-user-id="3546639035795567"]) {
display: none !important;
}`,
}),
Expand Down
3 changes: 1 addition & 2 deletions src/rules/homepage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -390,13 +390,12 @@ if (isPageHomepage()) {
description: '隐藏 广告',
defaultStatus: true,
itemCSS: `
:is(.feed-card, .bili-video-card.is-rcmd):has(.bili-video-card__info--ad, [href*="cm.bilibili.com"]) {
:is(.feed-card, .bili-video-card.is-rcmd):has(.bili-video-card__info--ad, [href*="cm.bilibili.com"], .bili-video-card__info--creative-ad) {
display: none !important;
}
:is(.feed-card, .bili-video-card.is-rcmd):not(:has(.bili-video-card__wrap, .bili-video-card__skeleton)) {
display: none !important;
}

/* 布局调整 */
.recommended-container_floor-aside .container>*:nth-of-type(5) {
margin-top: 0 !important;
Expand Down
Loading