Skip to content

Commit

Permalink
feat(remove-redirect): 适配百度贴吧
Browse files Browse the repository at this point in the history
  • Loading branch information
maomao1996 committed Jun 23, 2024
1 parent cfcc62c commit 1293eb7
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 8 deletions.
5 changes: 5 additions & 0 deletions .changeset/rude-houses-sneeze.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'remove-redirect': minor
---

适配百度贴吧
2 changes: 1 addition & 1 deletion packages/remove-redirect/metablock.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": "",
Expand Down
41 changes: 34 additions & 7 deletions packages/remove-redirect/src/sites/baidu.com.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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

0 comments on commit 1293eb7

Please sign in to comment.