feat: add route for wolley.io (#4023)

This commit is contained in:
umm233
2020-02-19 22:52:38 +08:00
committed by GitHub
parent bf56ef1dad
commit 1467d5df9f
3 changed files with 35 additions and 0 deletions

View File

@@ -306,6 +306,10 @@ GitHub 官方也提供了一些 RSS:
</Route> </Route>
## wolley
<Route author="umm233" example="/wolley" path="/wolley/index"/>
## 阿里云 ## 阿里云
### 数据库内核月报 ### 数据库内核月报

View File

@@ -2262,4 +2262,7 @@ router.get('/neu/news/:type', require('./routes/universities/neu/news'));
// 稻草人书屋 // 稻草人书屋
router.get('/dcrsw/:name/:count?', require('./routes/novel/dcrsw')); router.get('/dcrsw/:name/:count?', require('./routes/novel/dcrsw'));
// wolley
router.get('/wolley', require('./routes/wolley/index'));
module.exports = router; module.exports = router;

View File

@@ -0,0 +1,28 @@
const got = require('@/utils/got');
module.exports = async (ctx) => {
const link = 'https://wolley.io/';
const response = await got({
method: 'get',
url: `https://wolley.io/api/submissions/list?page=1&limit=30`,
headers: {
Referer: link,
},
});
const data = response.data.data;
ctx.state.data = {
title: `wolley`,
link,
description: '',
item: data.map((item) => ({
title: item.title,
description: `post by <a href=https://wolley.io/user/${item.user.handler}>${item.user.handler}</a>`,
pubDate: item.createdAt,
link: item.url,
})),
};
};