diff --git a/docs/game.md b/docs/game.md
index 10dad24e2..9ac14e389 100644
--- a/docs/game.md
+++ b/docs/game.md
@@ -269,16 +269,37 @@ pageClass: routes
-### 新闻 - 游戏资讯
+### 节点
-
-### 数折-折扣信息推送
+
+
+| 站务 | 活动 | 旅记 | 折扣 | 会免 |
+| ---- | ----- | ------ | ---- | ---- |
+| p9 | event | travel | off | plus |
+
+| 新闻 | 攻略 | 测评 | 心得 | 开箱 |
+| ---- | ----- | ------ | ---- | ------- |
+| news | guide | review | exp | openbox |
+
+| 游列 | 游计 | Ps4 | Ps5 |
+| -------- | -------- | --- | --- |
+| gamelist | planlist | ps4 | ps5 |
+
+| 发米通 | Ign | Ucg |
+| ------- | --- | --- |
+| famitsu | ign | ucg |
+
+
+
+### 数折 - 折扣信息推送
-### 闲游-二手盘信息
+
+### 闲游 - 二手盘信息
-### 游戏-新游戏奖杯信息
+
+### 游戏 - 新游戏奖杯信息
diff --git a/lib/router.js b/lib/router.js
index 26bc4126f..2da2ee3d3 100644
--- a/lib/router.js
+++ b/lib/router.js
@@ -1554,7 +1554,8 @@ router.get('/psnine/index', require('./routes/psnine/index'));
router.get('/psnine/shuzhe', require('./routes/psnine/shuzhe'));
router.get('/psnine/trade', require('./routes/psnine/trade'));
router.get('/psnine/game', require('./routes/psnine/game'));
-router.get('/psnine/news', require('./routes/psnine/news'));
+router.get('/psnine/news/:order?', require('./routes/psnine/news'));
+router.get('/psnine/node/:id?/:order?', require('./routes/psnine/node'));
// 浙江大学
router.get('/zju/list/:type', require('./routes/universities/zju/list'));
diff --git a/lib/routes/psnine/news.js b/lib/routes/psnine/news.js
index e6aeb099b..25fb5d06e 100644
--- a/lib/routes/psnine/news.js
+++ b/lib/routes/psnine/news.js
@@ -1,32 +1,54 @@
const got = require('@/utils/got');
const cheerio = require('cheerio');
-const date = require('@/utils/date');
module.exports = async (ctx) => {
- const url = 'https://www.psnine.com/news';
+ const order = ctx.params.order || 'obdate';
+
+ const rootUrl = 'https://www.psnine.com';
+ const currentUrl = `${rootUrl}/node/news?ob=${order}`;
const response = await got({
method: 'get',
- url: url,
+ url: currentUrl,
});
- const data = response.data;
- const $ = cheerio.load(data);
+ const $ = cheerio.load(response.data);
- const out = $('.box li')
- .map(function () {
- const info = {
- title: $(this).find('.content').text(),
- link: $(this).find('.touch').attr('href'),
- pubDate: date($(this).find('.meta').text()),
- author: $(this).find('.meta a').text(),
+ $('.psnnode, .node').remove();
+
+ const list = $('.title a')
+ .map((_, item) => {
+ item = $(item);
+ const date = item.parent().next().text().trim();
+
+ return {
+ title: item.text(),
+ link: item.attr('href'),
+ pubDate: new Date(date.length === 11 ? `${new Date().getFullYear()}-${date}` : date).toUTCString(),
};
- return info;
})
.get();
+ const items = await Promise.all(
+ list.map(
+ async (item) =>
+ await ctx.cache.tryGet(item.link, async () => {
+ const detailResponse = await got({
+ method: 'get',
+ url: item.link,
+ });
+ const content = cheerio.load(detailResponse.data);
+
+ item.author = content('a[itemprop="author"]').eq(0).text();
+ item.description = content('div[itemprop="articleBody"]').html();
+
+ return item;
+ })
+ )
+ );
+
ctx.state.data = {
- title: 'psnine-' + $('title').text(),
- link: 'https://www.psnine.com/',
- item: out,
+ title: `${$('title').text()} - PSN中文站`,
+ link: currentUrl,
+ item: items,
};
};
diff --git a/lib/routes/psnine/node.js b/lib/routes/psnine/node.js
new file mode 100644
index 000000000..a7b5f722a
--- /dev/null
+++ b/lib/routes/psnine/node.js
@@ -0,0 +1,55 @@
+const got = require('@/utils/got');
+const cheerio = require('cheerio');
+
+module.exports = async (ctx) => {
+ const id = ctx.params.id || 'news';
+ const order = ctx.params.order || 'obdate';
+
+ const rootUrl = 'https://www.psnine.com';
+ const currentUrl = `${rootUrl}/node/${id}?ob=${order}`;
+ const response = await got({
+ method: 'get',
+ url: currentUrl,
+ });
+
+ const $ = cheerio.load(response.data);
+
+ $('.psnnode, .node').remove();
+
+ const list = $('.title a')
+ .map((_, item) => {
+ item = $(item);
+ const date = item.parent().next().text().trim();
+
+ return {
+ title: item.text(),
+ link: item.attr('href'),
+ pubDate: new Date(date.length === 11 ? `${new Date().getFullYear()}-${date}` : date).toUTCString(),
+ };
+ })
+ .get();
+
+ const items = await Promise.all(
+ list.map(
+ async (item) =>
+ await ctx.cache.tryGet(item.link, async () => {
+ const detailResponse = await got({
+ method: 'get',
+ url: item.link,
+ });
+ const content = cheerio.load(detailResponse.data);
+
+ item.author = content('a[itemprop="author"]').eq(0).text();
+ item.description = content('div[itemprop="articleBody"]').html();
+
+ return item;
+ })
+ )
+ );
+
+ ctx.state.data = {
+ title: `${$('title').text()} - PSN中文站`,
+ link: currentUrl,
+ item: items,
+ };
+};