-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e0bcc0d
commit 2efc17b
Showing
5 changed files
with
54 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'remove-redirect': minor | ||
--- | ||
|
||
适配搜狗搜索 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import { validateUrl } from '@femm/shared-utils' | ||
import { defineSite } from 'src/utils' | ||
|
||
/****************************************************************************** | ||
** 搜狗搜索 | ||
** - https://sogou.com/web?query=mmPlayer | ||
** - https://sogou.com/web?query=武林外传 | ||
** | ||
** - https://m.sogou.com/web/searchList.jsp?keyword=mmPlayer | ||
******************************************************************************/ | ||
const sites = [ | ||
defineSite<HTMLDivElement>([ | ||
'搜狗搜索', | ||
'sogou.com', | ||
{ | ||
transform: { | ||
selector: '.results .vrwrap', | ||
customTransform(node) { | ||
const dataNode = node.querySelector<HTMLDivElement>('[data-url]') | ||
if (dataNode) { | ||
const originUrl = dataNode.dataset.url! | ||
if (validateUrl(originUrl)) { | ||
node | ||
.querySelectorAll<HTMLAnchorElement>('a[href*="/link?url="]') | ||
.forEach((a) => a.setAttribute('href', originUrl)) | ||
} | ||
} | ||
}, | ||
}, | ||
}, | ||
]), | ||
defineSite([ | ||
, | ||
'm.sogou.com', | ||
{ | ||
transform: { | ||
selector: 'a[href^="./id="]', | ||
queryName: 'url', | ||
}, | ||
}, | ||
]), | ||
] | ||
|
||
export default sites |