rss: add rsshub rss
This commit is contained in:
parent
005670acee
commit
8076c648cf
|
|
@ -13,6 +13,8 @@ RSSHub 是一个轻量、易于扩展的 RSS 生成器,可以给任何奇奇
|
|||
|
||||
当前支持列表:
|
||||
|
||||
* RSSHub
|
||||
* 支持的 RSS
|
||||
* bilibili
|
||||
* 番剧
|
||||
* UP 主投稿
|
||||
|
|
|
|||
|
|
@ -27,6 +27,16 @@ RSSHub 是一个轻量、易于扩展的 RSS 生成器,可以给任何奇奇
|
|||
|
||||
举例: [https://rsshub.app/bilibili/user/coin/2267573?filter=微小微|赤九玖|暴走大事件](https://rsshub.app/bilibili/user/coin/2267573?filter=微小微|赤九玖|暴走大事件)
|
||||
|
||||
## RSSHub
|
||||
|
||||
### 支持的 RSS
|
||||
|
||||
举例: [https://rsshub.app/rsshub/rss](https://rsshub.app/rsshub/rss)
|
||||
|
||||
路由: `/rsshub/rss`
|
||||
|
||||
参数: 无
|
||||
|
||||
## bilibili
|
||||
|
||||
### 番剧
|
||||
|
|
|
|||
|
|
@ -71,6 +71,9 @@ router.get('/', async (ctx) => {
|
|||
});
|
||||
});
|
||||
|
||||
// RSSHub
|
||||
router.get('/rsshub/rss', require('./routes/rsshub/rss'));
|
||||
|
||||
// bilibili
|
||||
router.get('/bilibili/user/video/:uid', require('./routes/bilibili/video'));
|
||||
router.get('/bilibili/user/fav/:uid', require('./routes/bilibili/fav'));
|
||||
|
|
|
|||
|
|
@ -0,0 +1,40 @@
|
|||
const axios = require('axios');
|
||||
const cheerio = require('cheerio');
|
||||
const config = require('../../config');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const response = await axios({
|
||||
method: 'get',
|
||||
url: 'https://github.com/DIYgod/RSSHub/releases.atom',
|
||||
headers: {
|
||||
'User-Agent': config.ua,
|
||||
Referer: 'https://github.com/DIYgod/RSSHub',
|
||||
},
|
||||
});
|
||||
|
||||
const data = response.data;
|
||||
|
||||
const $ = cheerio.load(data, {
|
||||
xmlMode: true,
|
||||
});
|
||||
const list = $('entry');
|
||||
|
||||
ctx.state.data = {
|
||||
title: 'RSSHub 有新的 RSS 支持',
|
||||
link: 'https://github.com/DIYgod/RSSHub',
|
||||
description: '使用 RSS 连接全世界',
|
||||
item:
|
||||
list &&
|
||||
list
|
||||
.map((index, item) => {
|
||||
item = $(item);
|
||||
return {
|
||||
title: item.find('title').text(),
|
||||
description: item.find('content').text(),
|
||||
pubDate: item.find('updated').text(),
|
||||
link: item.find('link').attr('href'),
|
||||
};
|
||||
})
|
||||
.get(),
|
||||
};
|
||||
};
|
||||
Loading…
Reference in New Issue