diff --git a/routes/infzm/news.js b/routes/infzm/news.js
index 2ea2343f0..fbb56252a 100644
--- a/routes/infzm/news.js
+++ b/routes/infzm/news.js
@@ -17,30 +17,55 @@ module.exports = async (ctx) => {
const data = response.data;
const $ = cheerio.load(data);
const list = $('article');
+ const resultItem = await Promise.all(
+ list
+ .map(async (item, index) => {
+ item = $(index);
+ const info = item
+ .find('div.clearfix>div>p.articleInfo')
+ .text()
+ .trim()
+ .split(/\s+/);
+ const date = new Date(`${info.slice(-2)[0]}T${info.slice(-1)[0]}`);
+ const link = item.find('a').attr('href');
+ const id = link.match(/content\/(\d+)/)[1];
+ let description;
+
+ if (id) {
+ const key = `infzm: ${link}`;
+ const value = await ctx.cache.get(key);
+
+ if (value) {
+ description = value;
+ } else {
+ const response = await axios({
+ method: 'get',
+ url: `http://api.infzm.com/mobile/contents/${id}`,
+ });
+
+ description = response.data.data.content.fulltext;
+ ctx.cache.set(key, description, 24 * 60 * 60);
+ }
+ } else {
+ description = `${item.find('div.clearfix>div>p.intro').text()}
`;
+ }
+
+ return {
+ title: item.find('div.articleTitle>h>a').text(),
+ description,
+ pubDate: date.toUTCString(),
+ link,
+ };
+ })
+ .get()
+ );
+
ctx.state.data = {
title: `${$('title').text()}-${$('#sortName')
.find('a')
.text()}`,
link: url,
description: $('meta[name="description"]').attr('content'),
- item:
- list &&
- list
- .map((item, index) => {
- item = $(index);
- const info = item
- .find('div.clearfix>div>p.articleInfo')
- .text()
- .trim()
- .split(/\s+/);
- const date = new Date(`${info.slice(-2)[0]}T${info.slice(-1)[0]}`);
- return {
- title: item.find('div.articleTitle>h>a').text(),
- description: `${item.find('div.clearfix>div>p.intro').text()}
`,
- pubDate: date.toUTCString(),
- link: item.find('a').attr('href'),
- };
- })
- .get(),
+ item: resultItem,
};
};