diff --git a/lib/v2/nga/radar.js b/lib/v2/nga/radar.js index f50a206e2..328ddf2bd 100644 --- a/lib/v2/nga/radar.js +++ b/lib/v2/nga/radar.js @@ -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}`; + } }, ], },