diff --git a/lib/v2/nga/post.js b/lib/v2/nga/post.js
index ad30520a5..13beca177 100644
--- a/lib/v2/nga/post.js
+++ b/lib/v2/nga/post.js
@@ -49,6 +49,9 @@ module.exports = async (ctx) => {
.replace(/\[font=(.+?)\](.+?)\[\/font\]/g, '$2')
.replace(/\[size=(.+?)\](.+?)\[\/size\]/g, '$2')
.replace(/\[align=(.+?)\](.+?)\[\/align\]/g, '$2');
+ // 列表
+ str = deepReplace(str, /\[\*\](.+?)(?=\[\*\]|\[\/list\])/g, '
$1');
+ str = deepReplace(str, /\[list\](.+?)\[\/list\]/g, '');
// 图片
str = str.replace(/\[img\](.+?)\[\/img\]/g, (m, src) => `
`);
// 折叠
@@ -58,7 +61,7 @@ module.exports = async (ctx) => {
.replace(/\[@(.+?)\]/g, '@$1')
.replace(/\[uid=(\d+)\](.+?)\[\/uid\]/g, '@$2')
.replace(/\[tid=(\d+)\](.+?)\[\/tid\]/g, '$2')
- .replace(/\[pid=(\d+),(\d+),(\d+)\](.+?)\[\/pid\]/g, (m, tid, pid, page, str) => {
+ .replace(/\[pid=(\d+),(\d+),(\d+)\](.+?)\[\/pid\]/g, (m, pid, tid, page, str) => {
const url = `https://nga.178.com/read.php?tid=${tid}&page=${page}#pid${pid}Anchor`;
return `${str}`;
});
@@ -91,7 +94,7 @@ module.exports = async (ctx) => {
.find('.posterinfo a')
.first()
.attr('href')
- .match(/&uid=(\d+)/)[1];
+ .match(/&uid=(-?\d+)$/)[1];
const poster = authorName || posterMap[posterId].username;
const content = post.find('.postcontent').first();
const description = formatContent(content.html());
diff --git a/lib/v2/nga/radar.js b/lib/v2/nga/radar.js
index 602ee34aa..fa9269980 100644
--- a/lib/v2/nga/radar.js
+++ b/lib/v2/nga/radar.js
@@ -1,56 +1,39 @@
+const rules = [
+ {
+ title: '分区帖子',
+ 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-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}`;
+ },
+ },
+];
+
module.exports = {
'nga.cn': {
_name: 'NGA',
- bbs: [
- {
- title: '分区帖子',
- 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-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}`;
- },
- },
- ],
+ bbs: rules,
},
'178.com': {
_name: 'NGA',
- nga: [
- {
- title: '分区帖子',
- 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-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}`;
- },
- },
- ],
+ nga: rules,
+ },
+ 'ngabbs.com': {
+ _name: 'NGA',
+ '.': rules,
},
};