remove github, close #14

This commit is contained in:
DIYgod
2018-04-27 15:19:22 +08:00
parent b520275bf9
commit 84794f64aa
4 changed files with 0 additions and 67 deletions

View File

@@ -56,8 +56,6 @@ RSSHub 是一个轻量、易于扩展的 RSS 生成器,可以给任何奇奇
- 北美票房榜
- 煎蛋
- 无聊图
- GitHub
- Releases
## 参与我们

View File

@@ -439,20 +439,6 @@ city: 城市的中文名,可选,默认北京
参数: 无
### GitHub
#### Releases
举例: https://rss.now.sh/github/release/MoePlayer/APlayer
路由: `/github/release/:owner/:repo`
参数
owner: 用户名或组织名
repo: 仓库名
## 搭建
环境:需要 Node.js v7.6.0 或更高版本,若启用 Redis 缓存需要先启动 Redis

View File

@@ -71,7 +71,4 @@ router.get('/douban/movie/ustop', require('./routes/douban/ustop'));
// 煎蛋
router.get('/jandan/pic', require('./routes/jandan/pic'));
// GitHub
router.get('/github/release/:owner/:repo', require('./routes/github/release'));
module.exports = router;

View File

@@ -1,48 +0,0 @@
const axios = require('axios');
const art = require('art-template');
const path = require('path');
const config = require('../../config');
module.exports = async (ctx) => {
const owner = ctx.params.owner;
const repo = ctx.params.repo;
const response = await axios({
method: 'get',
url: `https://api.github.com/repos/${owner}/${repo}/releases`,
headers: {
'User-Agent': config.ua,
}
});
const data = await Promise.all(response.data.map(async (item) => {
let text = item.body;
if (text) {
// render github flavoured markdown
const resp = await axios({
method: 'post',
url: 'https://api.github.com/markdown',
data: {
text,
mode: 'gfm',
context: `${owner}/${repo}`,
},
});
text = resp.data;
}
return {
title: `${item.name || item.tag_name}`,
description: text,
pubDate: new Date(item.published_at).toUTCString(),
link: item.html_url,
};
}));
ctx.body = art(path.resolve(__dirname, '../../views/rss.art'), {
title: `${owner}/${repo} 的 Releases`,
link: `https://github.com/${owner}/${repo}/releases`,
description: `${owner}/${repo} 的 Releases`,
lastBuildDate: new Date().toUTCString(),
item: data,
});
};