diff --git a/docs/README.md b/docs/README.md index efd1a4e47..29ca92164 100644 --- a/docs/README.md +++ b/docs/README.md @@ -2016,9 +2016,9 @@ IATA 国际航空运输协会机场代码, 参见[维基百科 国际航空运 -| 热门话题 | 科技动态 | 开发者资讯 | 区块链快讯 | -| -------- | -------- | ---------- | ---------- | -| topic | news | technews | blockchain | +| 热门话题 | 科技动态 | 开发者资讯 | 区块链快讯 | 每日早报 | +| -------- | -------- | ---------- | ---------- | -------- | +| topic | news | technews | blockchain | daily | diff --git a/routes/readhub/category.js b/routes/readhub/category.js index bd0eadfc4..65aa7cfd6 100644 --- a/routes/readhub/category.js +++ b/routes/readhub/category.js @@ -4,6 +4,7 @@ module.exports = async (ctx) => { const category = ctx.params.category; let title; + let path = category; switch (category) { case 'topic': title = '热门话题'; @@ -17,13 +18,20 @@ module.exports = async (ctx) => { case 'blockchain': title = '区块链快讯'; break; + case 'daily': + title = '每日早报'; + break; default: break; } + if (path === 'daily') { + path = 'topic/daily'; + } + const response = await axios({ method: 'get', - url: `https://api.readhub.cn/${category}`, + url: `https://api.readhub.cn/${path}`, }); const data = response.data; @@ -33,10 +41,10 @@ module.exports = async (ctx) => { link: 'https://readhub.cn', item: data.data.map((item) => ({ title: item.title, - pubDate: new Date(item.publishDate).toUTCString(), - description: item.summary, - guid: item.id, - link: item.url || item.newsArray[0].url, + pubDate: new Date(item.publishDate || Date.now()).toUTCString(), + description: item.summary || item.title, + guid: `/${category}/${item.id}`, + link: category === 'daily' ? `https://readhub.cn/topic/${item.id}` : item.url || item.newsArray[0].url, })), }; };