Skip to content

Commit 3271560

Browse files
committed
fix(remove-redirect): 修复 Google 搜索赞助商广告链接转换
1 parent 7e7f2ef commit 3271560

2 files changed

Lines changed: 14 additions & 1 deletion

File tree

.changeset/tiny-yaks-search.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'remove-redirect': patch
3+
---
4+
5+
修复 Google 搜索赞助商广告链接转换

packages/remove-redirect/src/sites/google.com.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ const sites = [
66
** Google 搜索
77
** - https://www.google.com/search?q=mmPlayer
88
** - https://www.google.com/search?q=茂茂物语
9+
** - https://www.google.com/search?q=1password
910
**
1011
** Google 重定向页
1112
** - https://www.google.com/url?q=https%3A%2F%2Fgithub.com%2Fmaomao1996%2Ftampermonkey-scripts&sa=D&source=docs
@@ -18,10 +19,17 @@ const sites = [
1819
{
1920
transform: {
2021
// selector: 'a[href^="/url?"][href*="url="]',
21-
selector: ['a[jsname][href][data-jsarwt]', 'a[jsname][href][ping]'].join(','),
22+
selector: [
23+
// Google 搜索结果
24+
'a[jsname][href][data-jsarwt]',
25+
'a[jsname][href][ping]',
26+
// 赞助商广告
27+
'[data-rw][data-al]',
28+
].join(','),
2229
customTransform(node) {
2330
node.setAttribute('data-jrwt', '1')
2431
node.removeAttribute('ping')
32+
node.removeAttribute('data-rw')
2533

2634
const match = (node.getAttribute('href') || '').match(/\?(.*)/)
2735
if (match) {

0 commit comments

Comments
 (0)