feat(radar): NGA track the poster (#10268)

* refactor

* feat(radar): track the poster

* change regex
This commit is contained in:
syrinka 2022-07-20 19:02:24 +08:00 committed by GitHub
parent 57a3a3f2af
commit d4c8fa049b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 25 additions and 11 deletions

View File

@ -4,16 +4,26 @@ module.exports = {
bbs: [
{
title: '分区帖子',
docs: 'https://docs.rsshub.app/bbs.html#nga',
docs: 'https://docs.rsshub.app/bbs.html#nga-fen-qu-tie-zi',
source: '/thread.php',
target: (params, url) => new URL(url).searchParams.get('fid') && `/nga/forum/${new URL(url).searchParams.get('fid')}`,
},
{
title: '帖子',
docs: 'https://docs.rsshub.app/bbs.html#nga',
docs: 'https://docs.rsshub.app/bbs.html#nga-tie-zi',
source: '/read.php',
target: (params, url) => new URL(url).searchParams.get('tid') && `/nga/post/${new URL(url).searchParams.get('tid')}`,
},
{
title: '帖子 - 只看作者',
docs: 'https://docs.rsshub.app/bbs.html#nga-tie-zi',
source: '/read.php',
target: (params, url, document) => {
const tid = new URL(url).searchParams.get('tid');
const authorId = document.documentElement.innerHTML.match(/commonui\.userInfo\.setAll\(\s{3}{"(\d+)"/)[1];
return `/nga/post/${tid}/${authorId}`;
}
},
],
},
'178.com': {
@ -22,20 +32,24 @@ module.exports = {
{
title: '分区帖子',
docs: 'https://docs.rsshub.app/bbs.html#nga-fen-qu-tie-zi',
source: ['/thread.php'],
target: (params, url) => {
const fid = new URL(url).searchParams.get('fid');
return `/nga/forum/${fid}`;
},
source: '/thread.php',
target: (params, url) => new URL(url).searchParams.get('fid') && `/nga/forum/${new URL(url).searchParams.get('fid')}`,
},
{
title: '帖子',
docs: 'https://docs.rsshub.app/bbs.html#nga-tie-zi',
source: ['/read.php'],
target: (params, url) => {
source: '/read.php',
target: (params, url) => new URL(url).searchParams.get('tid') && `/nga/post/${new URL(url).searchParams.get('tid')}`,
},
{
title: '帖子 - 只看作者',
docs: 'https://docs.rsshub.app/bbs.html#nga-tie-zi',
source: '/read.php',
target: (params, url, document) => {
const tid = new URL(url).searchParams.get('tid');
return `/nga/post/${tid}`;
},
const authorId = document.documentElement.innerHTML.match(/commonui\.userInfo\.setAll\(\s{3}{"(\d+)"/)[1];
return `/nga/post/${tid}/${authorId}`;
}
},
],
},