diff --git a/docs/install/README.md b/docs/install/README.md
index ebcfb91806..21219d3904 100644
--- a/docs/install/README.md
+++ b/docs/install/README.md
@@ -566,3 +566,7 @@ RSSHub 支持使用访问密钥 / 码,白名单和黑名单三种方式进行
- 喜马拉雅
- `XIMALAYA_TOKEN`: 对应 cookie 中的 `1&_token`,获取方式:1. 登陆喜马拉雅网页版 2. 查找名称为`1&_token`的`cookie`,其内容即为`XIMALAYA_TOKEN`的值(即在`cookie` 中查找 `1&_token=***;`,并设置 `XIMALAYA_TOKEN = ***`)
+
+- 4399 论坛
+
+ - `GAME_4399`: 对应登录后的 cookie 值,获取方式:1. 在 4399 首页登录. 2. 打开开发者工具,切换到 Network 面板. 3. 刷新 4. 查找`www.4399.com`的访问请求,点击请求,在右侧 Headers 中找到 Cookie.
diff --git a/docs/other.md b/docs/other.md
index b7970b6e95..cf61c7d6b2 100644
--- a/docs/other.md
+++ b/docs/other.md
@@ -858,3 +858,13 @@ type 为 all 时,category 参数不支持 cost 和 free
### はてな匿名ダイアリー - 人気記事アーカイブ
+
+### 4399 论坛
+
+
+::: warning 注意
+
+需要用户 cookie 值,详情见部署页面的配置模块。
+
+:::
+
diff --git a/lib/config.js b/lib/config.js
index 64b3ea77ca..c9759849be 100644
--- a/lib/config.js
+++ b/lib/config.js
@@ -167,6 +167,9 @@ const calculateValue = () => {
ximalaya: {
token: envs.XIMALAYA_TOKEN,
},
+ game4399: {
+ cookie: envs.GAME_4399,
+ },
};
};
calculateValue();
diff --git a/lib/router.js b/lib/router.js
index 0127825fdf..d8c5717681 100644
--- a/lib/router.js
+++ b/lib/router.js
@@ -3353,6 +3353,9 @@ router.get('/yuanshen/:location?/:category?', require('./routes/yuanshen/index')
// World Trade Organization
router.get('/wto/dispute-settlement/:year?', require('./routes/wto/dispute-settlement'));
+// 4399论坛
+router.get('/forum4399/:mtag', require('./routes/game4399/forum'));
+
// 国防科技大学
router.get('/nudt/yjszs/:id?', require('./routes/universities/nudt/yjszs'));
diff --git a/lib/routes/game4399/forum.js b/lib/routes/game4399/forum.js
new file mode 100644
index 0000000000..a02d78f8c0
--- /dev/null
+++ b/lib/routes/game4399/forum.js
@@ -0,0 +1,45 @@
+const got = require('@/utils/got');
+const cheerio = require('cheerio');
+const config = require('@/config').value;
+
+module.exports = async (ctx) => {
+ const mtag = ctx.params.mtag;
+ const cookie = config.game4399.cookie;
+ const response = await got({
+ method: 'get',
+ url: `http://my.4399.com/forums/${mtag}`,
+ headers: {
+ Cookie: cookie,
+ },
+ });
+ const data = response.data;
+ const dex = cheerio.load(data);
+ const list = dex('li div.listtitle')
+ .map((index, item) => {
+ item = dex(item);
+ const author = item.parent().find('.author').text();
+ const link = 'http://my.4399.com' + item.parent().find('.thread_link').attr('href');
+ const title = item.parent().find('div.title').text() + ' ---------------最后回复->' + item.parent().find('.rtime span').text().trim() + ':' + item.parent().find('.rtime a').text().trim();
+ return {
+ title: title,
+ link: link,
+ author: author,
+ };
+ })
+ .get();
+ const items = await Promise.all(
+ list.map(async (item) => {
+ const res = await got({ method: 'get', url: item.link, headers: { Cookie: cookie } });
+ const content = cheerio.load(res.data);
+ content('div.host_content.j-thread-content img').not('.post_emoji').remove();
+ item.description = content('div.host_content.j-thread-content').html();
+ return item;
+ })
+ );
+
+ ctx.state.data = {
+ title: '论坛首页---4399',
+ link: 'http://my.4399.com/forums',
+ item: items,
+ };
+};