optimize directory structure

This commit is contained in:
DIYgod
2018-12-26 18:35:10 +08:00
parent c68251e461
commit 38a90e29b0
475 changed files with 52 additions and 52 deletions

38
lib/routes/rsshub/rss.js Normal file
View File

@@ -0,0 +1,38 @@
const axios = require('../../utils/axios');
const cheerio = require('cheerio');
module.exports = async (ctx) => {
const response = await axios({
method: 'get',
url: 'https://github.com/DIYgod/RSSHub/releases.atom',
headers: {
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(),
};
};