feat: add route of 'front-end-rss.now.sh'
This commit is contained in:
parent
10d16bd30a
commit
5f98e1cdc1
|
|
@ -660,6 +660,11 @@ GitHub 官方也提供了一些 RSS:
|
|||
<Route author="hellodword" example="/galaxylab" path="/galaxylab">
|
||||
</Route>
|
||||
|
||||
## 前端技术文章
|
||||
|
||||
<Route author="laampui" example="/frontend" path="/frontend" :paramsDesc="['分类']">
|
||||
</Route>
|
||||
|
||||
## 前端艺术家 && 飞冰早报
|
||||
|
||||
### 列表
|
||||
|
|
|
|||
|
|
@ -2058,6 +2058,9 @@ router.get('/szse/rule', require('./routes/szse/rule'));
|
|||
// 前端艺术家每日整理&&飞冰早报
|
||||
router.get('/jskou/:type?', require('./routes/jskou/index'));
|
||||
|
||||
// 前端
|
||||
router.get('/frontend', require('./routes/frontend/index'));
|
||||
|
||||
// 国家应急广播
|
||||
router.get('/cneb/yjxx', require('./routes/cneb/yjxx'));
|
||||
router.get('/cneb/guoneinews', require('./routes/cneb/guoneinews'));
|
||||
|
|
|
|||
|
|
@ -0,0 +1,25 @@
|
|||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const response = await got.get(`https://front-end-rss.now.sh/`);
|
||||
const $ = cheerio.load(response.data);
|
||||
const fn = Function($($('script')[1]).html() + 'return Array.isArray(LINKS_DATA) ? LINKS_DATA : []');
|
||||
const items = fn().reduce(
|
||||
(acc, category) => [
|
||||
...acc,
|
||||
...category.items.map((item) => ({
|
||||
link: item.link,
|
||||
pubDate: item.date,
|
||||
title: item.title,
|
||||
})),
|
||||
],
|
||||
[]
|
||||
);
|
||||
|
||||
ctx.state.data = {
|
||||
title: '前端技术文章',
|
||||
link: 'https://front-end-rss.now.sh/',
|
||||
item: items,
|
||||
};
|
||||
};
|
||||
Loading…
Reference in New Issue