Add Galgame website mygalgame (#552)
* Add Galgame website mygalgame * fix file format * format file
This commit is contained in:
parent
3cc4919ef2
commit
dc72fc4cd9
|
|
@ -264,6 +264,8 @@ RSSHub 是一个轻量、易于扩展的 RSS 生成器,可以给任何奇奇
|
|||
- 全国气象预警
|
||||
- Gitlab
|
||||
- Explore
|
||||
- 忧郁的弟弟
|
||||
- 文章
|
||||
- 大连工业大学
|
||||
- 教务处新闻
|
||||
|
||||
|
|
|
|||
|
|
@ -2212,3 +2212,13 @@ type,分类
|
|||
| Trending | Most stars | All |
|
||||
| -------- | ---------- | --- |
|
||||
| trending | starred | all |
|
||||
|
||||
## 忧郁的弟弟
|
||||
|
||||
### 文章
|
||||
|
||||
举例: [https://rsshub.app/mygalgame](https://rsshub.app/mygalgame)
|
||||
|
||||
路由: `/mygalgame`
|
||||
|
||||
参数: 无
|
||||
|
|
|
|||
|
|
@ -467,6 +467,9 @@ router.get('/weatherAlarm', require('./routes/weatherAlarm'));
|
|||
// Gitlab
|
||||
router.get('/gitlab/explore/:type', require('./routes/gitlab/explore'));
|
||||
|
||||
// 忧郁的弟弟
|
||||
router.get('/mygalgame', require('./routes/galgame/mygalgame'));
|
||||
|
||||
// DPU
|
||||
router.get('/dpu/jiaowu/:type?', require('./routes/dpu/jiaowu'));
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,41 @@
|
|||
const axios = require('../../utils/axios');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const res = await axios({
|
||||
method: 'get',
|
||||
url: 'https://www.mygalgame.com/',
|
||||
header: {
|
||||
Referer: 'https://www.mygalgame.com/',
|
||||
},
|
||||
});
|
||||
|
||||
const data = res.data;
|
||||
|
||||
const $ = cheerio.load(data);
|
||||
const list = $('#article-list').find('.article');
|
||||
|
||||
ctx.state.data = {
|
||||
title: $('title').text(),
|
||||
link: 'https://www.mygalgame.com/',
|
||||
description: '忧郁的弟弟 - Galgame资源发布站',
|
||||
item:
|
||||
list &&
|
||||
list
|
||||
.slice(1)
|
||||
.map((index, item) => {
|
||||
item = $(item);
|
||||
const time = `${item.find('.month').text()}${item.find('.day').text()}日`;
|
||||
const date = new Date();
|
||||
const math = /(\d+)月(\d+)日/.exec(time);
|
||||
|
||||
return {
|
||||
title: item.find('h1').text(),
|
||||
description: `${item.find('.info p').text()}`,
|
||||
pubDate: new Date(date.getFullYear(), parseInt(math[1]) - 1, math[2]).toUTCString(),
|
||||
link: item.find('h1 a').attr('href'),
|
||||
};
|
||||
})
|
||||
.get(),
|
||||
};
|
||||
};
|
||||
Loading…
Reference in New Issue