From 1293eb7ced0ae5c081b69259233af82b8b1b8bd0 Mon Sep 17 00:00:00 2001 From: maomao <1714487678@qq.com> Date: Sun, 23 Jun 2024 21:02:41 +0800 Subject: [PATCH] =?UTF-8?q?feat(remove-redirect):=20=E9=80=82=E9=85=8D?= =?UTF-8?q?=E7=99=BE=E5=BA=A6=E8=B4=B4=E5=90=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .changeset/rude-houses-sneeze.md | 5 +++ packages/remove-redirect/metablock.json | 2 +- .../remove-redirect/src/sites/baidu.com.ts | 41 +++++++++++++++---- 3 files changed, 40 insertions(+), 8 deletions(-) create mode 100644 .changeset/rude-houses-sneeze.md diff --git a/.changeset/rude-houses-sneeze.md b/.changeset/rude-houses-sneeze.md new file mode 100644 index 0000000..7651c0b --- /dev/null +++ b/.changeset/rude-houses-sneeze.md @@ -0,0 +1,5 @@ +--- +'remove-redirect': minor +--- + +适配百度贴吧 diff --git a/packages/remove-redirect/metablock.json b/packages/remove-redirect/metablock.json index c066072..63f2ef3 100644 --- a/packages/remove-redirect/metablock.json +++ b/packages/remove-redirect/metablock.json @@ -5,7 +5,7 @@ "name:en": "Remove Redirect", "namespace": "maomao1996.remove-redirect", "version": "1.12.0", - "description": "修复跳转链接为站外直链(移除重定向),免去拦截页面点击步骤可直达站外;拦截页面自动跳转;已适配爱发电、百度搜索、CSDN、豆瓣、Facebook、码云、Google 搜索、Google 重定向页、花瓣网、InfoQ、Instagram、简书、掘金、金山文档、链滴、力扣(Leetcode)、51CTO 博客、NGA 玩家社区、牛客网、开源中国、pixiv、微信、微信开放社区、QQ 邮箱、PC 版 QQ、腾讯文档、腾讯兔小巢、360 搜索、少数派、腾讯云开发者社区、推特(Twitter)、微博、YouTube、语雀、知乎、知乎专栏", + "description": "修复跳转链接为站外直链(移除重定向),免去拦截页面点击步骤可直达站外;拦截页面自动跳转;已适配爱发电、百度搜索、百度贴吧、CSDN、豆瓣、Facebook、码云、Google 搜索、Google 重定向页、花瓣网、InfoQ、Instagram、简书、掘金、金山文档、链滴、力扣(Leetcode)、51CTO 博客、NGA 玩家社区、牛客网、开源中国、pixiv、微信、微信开放社区、QQ 邮箱、PC 版 QQ、腾讯文档、腾讯兔小巢、360 搜索、少数派、腾讯云开发者社区、推特(Twitter)、微博、YouTube、语雀、知乎、知乎专栏", "author": "", "homepage": "", "supportURL": "", diff --git a/packages/remove-redirect/src/sites/baidu.com.ts b/packages/remove-redirect/src/sites/baidu.com.ts index 5bb7116..9db14a9 100644 --- a/packages/remove-redirect/src/sites/baidu.com.ts +++ b/packages/remove-redirect/src/sites/baidu.com.ts @@ -2,14 +2,14 @@ import { validateUrl } from '@femm/shared-utils' const BAIDU_RE = /^http:\/\/[^.]+\.[^.]+\.baidu\.com/ -/****************************************************************************** - ** 百度搜索 - ** - https://www.baidu.com/s?wd=mmPlayer - ** - https://www.baidu.com/s?wd=es6 - ** - https://www.baidu.com/s?wd=武林外传 - ** - https://www.baidu.com/s?wd=实现简单的实时渲染器 - ******************************************************************************/ const sites: SiteModule = [ + /****************************************************************************** + ** 百度搜索 + ** - https://www.baidu.com/s?wd=mmPlayer + ** - https://www.baidu.com/s?wd=es6 + ** - https://www.baidu.com/s?wd=武林外传 + ** - https://www.baidu.com/s?wd=实现简单的实时渲染器 + ******************************************************************************/ [ '百度搜索', 'baidu.com', @@ -33,6 +33,33 @@ const sites: SiteModule = [ }, }, ], + /****************************************************************************** + ** 百度贴吧 + ** - https://tieba.baidu.com/p/8863884278 + ** - https://tieba.baidu.com/mo/q/checkurl?url=https%3A%2F%2Fgithub.com%2Fmaomao1996%2Ftampermonkey-scripts + ******************************************************************************/ + [ + '百度贴吧', + /^(jump|jump2)\.bdimg\.com$/, + { + autojump: { + validator: ({ pathname }) => pathname === '/safecheck/index', + queryName: 'url', + selector: 'a.btn.btn-next[href]', + }, + }, + ], + [ + , + 'tieba.baidu.com', + { + autojump: { + validator: ({ pathname }) => pathname === '/mo/q/checkurl', + queryName: 'url', + selector: '.btns span.j_next', + }, + }, + ], ] export default sites