mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-09 23:00:48 +08:00
fix: mmgal move to hhgal (#4312)
This commit is contained in:
@@ -288,7 +288,7 @@ pageClass: routes
|
||||
|
||||
### 文章
|
||||
|
||||
<Route author="DIYgod" example="/mmgal" path="/mmgal"/>
|
||||
<Route author="DIYgod kotoyuuko" example="/hhgal" path="/hhgal"/>
|
||||
|
||||
## 终点分享
|
||||
|
||||
|
||||
@@ -530,8 +530,9 @@ router.get('/weatheralarm', require('./routes/weatheralarm'));
|
||||
router.get('/gitlab/explore/:type', require('./routes/gitlab/explore'));
|
||||
|
||||
// 忧郁的loli
|
||||
router.get('/mygalgame', require('./routes/galgame/mmgal')); // 废弃
|
||||
router.get('/mmgal', require('./routes/galgame/mmgal'));
|
||||
router.get('/mygalgame', require('./routes/galgame/hhgal')); // 废弃
|
||||
router.get('/mmgal', require('./routes/galgame/hhgal')); // 废弃
|
||||
router.get('/hhgal', require('./routes/galgame/hhgal'));
|
||||
|
||||
// say花火
|
||||
router.get('/sayhuahuo', require('./routes/galgame/sayhuahuo'));
|
||||
|
||||
37
lib/routes/galgame/hhgal.js
Normal file
37
lib/routes/galgame/hhgal.js
Normal file
@@ -0,0 +1,37 @@
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const browser = await require('@/utils/puppeteer')();
|
||||
const page = await browser.newPage();
|
||||
await page.goto('https://www.hhgal.com/');
|
||||
const htmlHandle = await page.$('html');
|
||||
const html = await page.evaluate((html) => html.innerHTML, htmlHandle);
|
||||
browser.close();
|
||||
|
||||
const $ = cheerio.load(html);
|
||||
const list = $('#article-list').find('.article');
|
||||
|
||||
ctx.state.data = {
|
||||
title: $('title').text(),
|
||||
link: 'https://www.hhgal.com/',
|
||||
description: '忧郁的loli - Galgame资源发布站',
|
||||
item:
|
||||
list &&
|
||||
list
|
||||
.slice(1)
|
||||
.map((index, item) => {
|
||||
item = $(item);
|
||||
const time = `${item.find('.tag-article .label.label-zan').text()}`;
|
||||
const math = /\d{4}-\d{2}-\d{2}/.exec(time);
|
||||
const pubdate = new Date(math[0]);
|
||||
|
||||
return {
|
||||
title: item.find('h1').text(),
|
||||
description: `${item.find('.info p').text()}`,
|
||||
pubDate: pubdate,
|
||||
link: item.find('h1 a').attr('href'),
|
||||
};
|
||||
})
|
||||
.get(),
|
||||
};
|
||||
};
|
||||
@@ -1,42 +0,0 @@
|
||||
const got = require('@/utils/got');
|
||||
const cheerio = require('cheerio');
|
||||
|
||||
module.exports = async (ctx) => {
|
||||
const res = await got({
|
||||
method: 'get',
|
||||
url: 'https://www.mmgal.com/',
|
||||
header: {
|
||||
Referer: 'https://www.mmgal.com/',
|
||||
},
|
||||
});
|
||||
|
||||
const data = res.data;
|
||||
|
||||
const $ = cheerio.load(data);
|
||||
const list = $('#article-list').find('.article');
|
||||
|
||||
ctx.state.data = {
|
||||
title: $('title').text(),
|
||||
link: 'https://www.mmgal.com/',
|
||||
description: '忧郁的loli - 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);
|
||||
const pubdate = new Date(date.getFullYear(), parseInt(math[1]) - 1, math[2]);
|
||||
|
||||
return {
|
||||
title: item.find('h1').text(),
|
||||
description: `${item.find('.info p').text()}`,
|
||||
pubDate: pubdate > date ? new Date(date.getFullYear() - 1, parseInt(math[1]) - 1, math[2]).toUTCString() : pubdate.toUTCString(),
|
||||
link: item.find('h1 a').attr('href'),
|
||||
};
|
||||
})
|
||||
.get(),
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user