观止 Rss (#865)

This commit is contained in:
Andie 2018-10-12 01:11:51 +08:00 committed by DIYgod
parent e4deda826b
commit 005c498af8
3 changed files with 30 additions and 0 deletions

View File

@ -1825,3 +1825,7 @@ IATA 国际航空运输协会机场代码, 参见[维基百科 国际航空运
通过提取文章全文, 以提供比官方源更佳的阅读体验.
</route>
### 观止(每日一文)
<route name="观止" author="Andiedie" example="/guanzhi" path="/guanzhi"/>

View File

@ -621,4 +621,7 @@ router.get('/verge', require('./routes/verge/index'));
// 看雪
router.get('/pediy/topic/:category?/:type?', require('./routes/pediy/topic'));
// 观止(每日一文)
router.get('/guanzhi', require('./routes/guanzhi/guanzhi'));
module.exports = router;

23
routes/guanzhi/guanzhi.js Normal file
View File

@ -0,0 +1,23 @@
const axios = require('../../utils/axios');
module.exports = async (ctx) => {
const {
data: { data },
} = await axios.get('https://interface.meiriyiwen.com/article/today');
ctx.state.data = {
title: '观止',
link: 'https://meiriyiwen.com/',
description: '每天一篇精选优质短篇',
item: [
{
title: data.title,
description: data.content,
author: data.author,
pubDate: new Date(`${data.date.curr.substr(0, 4)}-${data.date.curr.substr(4, 2)}-${data.date.curr.substr(6)} 00:00:01`).toUTCString(),
guid: data.date.curr,
link: 'https://meiriyiwen.com/',
},
],
};
};