Hide recommendations, disable autoplay, and redirect distracting entry pages on YouTube and Bilibili.
隐藏 YouTube 和 Bilibili 的推荐,关闭自动连播,并重定向干扰性入口页面。
Ad blocking has moved to the companion script AntiAds. Install both for the full experience.
去广告功能已拆分到配套脚本 AntiAds,可同时安装两者获得完整体验。
| English | 中文 | |
|---|---|---|
| 🚫 | Hide sidebar recommendations | 隐藏侧边栏推荐 |
| 🎬 | Hide in-player end-screen recommendations | 隐藏播放器内结束页推荐 |
| ⏸️ | Hide pause overlay suggestions (YouTube) | 隐藏暂停时的推荐浮层(YouTube) |
| 🔁 | Disable autoplay / auto-advance | 关闭自动播放 / 自动连播 |
| 🔀 | Redirect distracting homepage & search URLs | 重定向干扰性首页与搜索 URL |
| ⚡ | Inject CSS at document-start — no flicker |
在页面加载前注入 CSS,无闪烁 |
| 👁️ | MutationObserver for SPA dynamic content | 监听 SPA 动态内容,持续生效 |
| Site / 站点 | Pages / 页面 | Sidebar / 侧边栏 | End Screen / 结束页 | Autoplay / 自动连播 | Redirects / 重定向 |
|---|---|---|---|---|---|
| YouTube (Desktop) | 首页、搜索、视频页 | ✅ | ✅ | ✅ | ✅ |
| YouTube (Mobile) | 视频页 | ✅ | ✅ | ✅ | — |
| Bilibili | 首页、搜索、视频、番剧 | ✅ | ✅ | ✅ | ✅ |
脚本会自动将以下页面重定向到更「干净」的入口:
| From / 原页面 | To / 跳转到 |
|---|---|
https://www.youtube.com/ |
https://www.youtube.com/feed/playlists |
| YouTube 搜索「超级搜索」(含乱码变体) | https://www.youtube.com/feed/playlists |
https://www.bilibili.com/ |
https://search.bilibili.com/all |
https://www.bilibili.com/index.html |
https://search.bilibili.com/all |
| Bilibili 搜索「超级搜索」(含乱码变体) | https://search.bilibili.com/all |
重定向在
document-start执行,并持续监听 SPA 内导航(如 YouTube 站内搜索)。Redirects run at
document-startand also watch for in-page SPA navigation.
| Browser / 浏览器 | Recommended / 推荐 | Download / 下载 |
|---|---|---|
| Chrome | Tampermonkey | Chrome Web Store |
| Microsoft Edge | Tampermonkey | Edge Add-ons |
| Firefox | Tampermonkey or Violentmonkey | Firefox Add-ons |
| Safari (macOS / iOS) | Userscripts | App Store(免费开源 / free & open-source) |
| Brave / Opera / Vivaldi | Tampermonkey | 官网选择对应浏览器 / pick your browser on the site |
Safari 用户注意: Userscripts 是 Safari 上最常用的脚本管理器,需在系统设置中授予扩展权限后才能在网页上运行脚本。
Safari note: Userscripts is the most common manager on Safari. Grant the extension permission in System Settings before scripts can run on web pages.
- 确保已安装并启用上面的脚本管理器 / Make sure your userscript manager is installed and enabled.
- 打开安装页 / Open the install page:
- 点击 Install / 安装,在弹窗中确认 / confirm in the popup.
git clone https://github.com/RyanStarFox/AntiRecommend.gitTampermonkey / Violentmonkey:
- 点击浏览器工具栏中的扩展图标 → Dashboard / 管理面板
- 点击 + 或 Create a new script / 新建脚本
- 删除默认内容,粘贴
anti-recommend.user.js的全部内容 - 保存(
Cmd+S/Ctrl+S)
Safari — Userscripts:
- 打开 Userscripts App → Settings / 设置 → 启用 Safari 扩展
- 在 Safari 中打开 Settings → Extensions → Userscripts,允许在目标网站运行
- 将
anti-recommend.user.js导入 Userscripts(可通过 iCloud 同步或本地文件导入) - 在 Userscripts 中为
youtube.com和bilibili.com启用该脚本
安装完成后无需额外配置,脚本会在匹配的页面自动生效:
Once installed, the script runs automatically on matching pages — no extra setup needed.
-
打开目标网站 / Open a supported site
- YouTube:
https://www.youtube.com - Bilibili:
https://www.bilibili.com
- YouTube:
-
确认脚本已启用 / Confirm the script is active
- Tampermonkey:点击扩展图标,确认脚本为 Enabled / 已启用
- Userscripts:在 Safari 扩展菜单中确认脚本对当前站点已开启
-
刷新页面 / Refresh the page
- 首次安装或更新后,建议硬刷新:
Cmd+Shift+R(macOS)或Ctrl+Shift+R(Windows / Linux) - After installing or updating, do a hard refresh to load the latest script
- 首次安装或更新后,建议硬刷新:
-
验证效果 / Verify it works
- YouTube:首页跳转到播放列表;侧边栏推荐消失;视频结束后不再弹出推荐网格
- Bilibili:首页跳转到搜索页;右侧推荐消失;“自动开播”“自动连播”会被关闭,播放方式设为“播完暂停”
-
更新脚本 / Update the script
- Tampermonkey 默认会自动检查更新;也可在 Dashboard 中手动点击 Check for userscript updates
- Userscripts 需重新导入新版本,或通过 iCloud 同步更新
当前最新版本 / Latest version: v1.6.2
Anti-Recommend uses a layered approach to keep video pages clean without breaking playback:
Anti-Recommend 采用多层策略清理页面,同时不影响正常播放:
-
Early CSS injection — Styles are injected at
document-start, hiding elements before the first paint. 早期 CSS 注入 — 在document-start阶段注入样式,首屏渲染前即隐藏目标元素。 -
Shadow DOM support — YouTube's player lives inside Shadow DOM; the script injects styles there too. Shadow DOM 支持 — YouTube 播放器位于 Shadow DOM 内,脚本会同步注入样式。
-
MutationObserver — Watches for dynamically added nodes and re-applies hiding instantly. DOM 监听 — 监听动态插入的节点,实时重新隐藏。
-
Autoplay toggle — Automatically clicks off the autoplay switch when detected. 自动连播关闭 — 检测到自动播放开关时自动关闭。
-
History interception — Blocks programmatic navigation triggered by playlist auto-advance after a video ends. 历史记录拦截 — 阻止视频结束后播放列表触发的自动跳转。
-
URL redirects — Rewrites distracting homepage and blocked-search URLs at load time and during SPA navigation. URL 重定向 — 在页面加载及 SPA 导航时,将干扰性首页与特定搜索 URL 重定向到更干净的页面。
Q: Recommendations still appear after updating? 问:更新后推荐仍然出现?
Hard-refresh the page (Cmd+Shift+R / Ctrl+Shift+R) and confirm your userscript manager shows the latest version (currently v1.6.2).
硬刷新页面(Cmd+Shift+R / Ctrl+Shift+R),并确认脚本管理器中版本为最新(当前 v1.6.2)。
Q: Does this affect video playback or the progress bar? 问:会影响视频播放或进度条吗?
No. The script only targets recommendation containers, not the player itself. If you encounter issues, please open an Issue.
不会。脚本只针对推荐相关容器,不会隐藏播放器本体。 如遇异常,请在 Issues 反馈。
Q: Where did ad blocking go? 问:去广告功能去哪了?
Ad blocking was split into AntiAds in v1.6.0. Install it alongside AntiRecommend for the same ad-hiding behavior as before.
v1.6.0 起去广告功能已拆分到 AntiAds,与 AntiRecommend 同时安装即可恢复原有去广告效果。
Q: Homepage redirects don't work? 问:首页重定向不生效?
Make sure the script is enabled for the site (e.g. www.bilibili.com, www.youtube.com) and hard-refresh. Tampermonkey must have permission to run on those domains.
确认脚本已对对应域名启用(如 www.bilibili.com、www.youtube.com)并硬刷新。Tampermonkey 需获得在这些域名上运行的权限。
Issues and pull requests are welcome!
欢迎提交 Issue 和 Pull Request。
本开源项目已链接并认可 LINUX DO 社区。
