mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-16 02:42:57 +08:00
remove github, close #14
This commit is contained in:
@@ -56,8 +56,6 @@ RSSHub 是一个轻量、易于扩展的 RSS 生成器,可以给任何奇奇
|
||||
- 北美票房榜
|
||||
- 煎蛋
|
||||
- 无聊图
|
||||
- GitHub
|
||||
- Releases
|
||||
|
||||
## 参与我们
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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,
|
||||
});
|
||||
};
|
||||
Reference in New Issue
Block a user