parent
60ec492874
commit
2bf781d389
|
|
@ -254,6 +254,8 @@ RSSHub 是一个轻量、易于扩展的 RSS 生成器,可以给任何奇奇
|
|||
- 笔趣阁
|
||||
- UU 看书
|
||||
- 文学迷
|
||||
- Gitlab
|
||||
- Explore
|
||||
|
||||
</details>
|
||||
|
||||
|
|
|
|||
|
|
@ -2077,3 +2077,19 @@ type,必选,目前支持两种,`hot` 代表热门游记,`latest` 代表
|
|||
参数: id1/id2,小说网站链接最后的数字,可在对应小说页 URL 中找到
|
||||
|
||||
举例网址:https://www.wenxuemi.com/files/article/html/6/6144/
|
||||
|
||||
## Gitlab
|
||||
|
||||
### Explore <Author uid="imlonghao"/>
|
||||
|
||||
举例: [https://rsshub.app/gitlab/explore/trending](https://rsshub.app/gitlab/explore/trending)
|
||||
|
||||
路由: `/gitlab/explore/:type`
|
||||
|
||||
参数:
|
||||
|
||||
type,分类
|
||||
|
||||
| Trending | Most stars | All |
|
||||
| -------- | ---------- | --- |
|
||||
| trending | starred | all |
|
||||
|
|
|
|||
|
|
@ -454,4 +454,7 @@ router.get('/novel/biquge/:id', require('./routes/novel/biquge'));
|
|||
router.get('/novel/uukanshu/:uid', require('./routes/novel/uukanshu'));
|
||||
router.get('/novel/wenxuemi/:id1/:id2', require('./routes/novel/wenxuemi'));
|
||||
|
||||
// Gitlab
|
||||
router.get('/gitlab/explore/:type', require('./routes/gitlab/explore'));
|
||||
|
||||
module.exports = router;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,36 @@
|
|||
const axios = require('../../utils/axios');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const type = ctx.params.type === 'all' ? '' : ctx.params.type;
|
||||
const typename = {
|
||||
trending: 'Trending',
|
||||
starred: 'Most stars',
|
||||
all: 'All',
|
||||
};
|
||||
|
||||
const res = await axios({
|
||||
method: 'get',
|
||||
url: `https://gitlab.com/explore/projects/${type}`,
|
||||
});
|
||||
const data = res.data;
|
||||
const $ = cheerio.load(data);
|
||||
const list = $('ul.projects-list').find('li');
|
||||
|
||||
ctx.state.data = {
|
||||
title: `${typename[ctx.params.type]} - Explore - Gitlab`,
|
||||
link: `https://gitlab.com/explore/projects/${type}`,
|
||||
item:
|
||||
list &&
|
||||
list
|
||||
.map((index, item) => {
|
||||
item = $(item);
|
||||
return {
|
||||
title: item.find('.project-full-name').text(),
|
||||
description: item.find('.description').text(),
|
||||
link: `https://gitlab.com${item.find('a.text-plain').attr('href')}`,
|
||||
};
|
||||
})
|
||||
.get(),
|
||||
};
|
||||
};
|
||||
Loading…
Reference in New Issue