diff --git a/lib/routes/v2ex/topics.js b/lib/routes/v2ex/topics.js index 71ad120a98..db3097d9c1 100644 --- a/lib/routes/v2ex/topics.js +++ b/lib/routes/v2ex/topics.js @@ -1,14 +1,10 @@ const got = require('@/utils/got'); +const { parseDate } = require('@/utils/parse-date'); module.exports = async (ctx) => { const type = ctx.params.type; - const response = await got({ - method: 'get', - url: `https://www.v2ex.com/api/topics/${type}.json`, - }); - - const data = response.data; + const { data } = await got(`https://www.v2ex.com/api/topics/${type}.json`); let title; if (type === 'hot') { @@ -25,10 +21,10 @@ module.exports = async (ctx) => { title: item.title, description: `${item.member.username}: ${item.content_rendered}`, content: { text: item.content, html: item.content_rendered }, - pubDate: new Date(item.created * 1000).toUTCString(), - guid: item.id, + pubDate: parseDate(item.created, 'X'), link: item.url, author: item.member.username, + comments: item.replies, })), }; };