mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-05 12:21:31 +08:00
增加Say花火 (#1984)
This commit is contained in:
@@ -26,6 +26,10 @@
|
||||
|
||||
<Route name="文章" author="DIYgod" example="/mmgal" path="/mmgal"/>
|
||||
|
||||
## say 花火
|
||||
|
||||
<Route name="文章" author="junfengP" example="/sayhuahuo" path="/sayhuahuo"/>
|
||||
|
||||
## 终点分享
|
||||
|
||||
<Route name="最新汉化" author="junfengP" example="/zdfx" path="/zdfx"/>
|
||||
|
||||
@@ -577,6 +577,9 @@ router.get('/gitlab/explore/:type', require('./routes/gitlab/explore'));
|
||||
router.get('/mygalgame', require('./routes/galgame/mmgal'));
|
||||
router.get('/mmgal', require('./routes/galgame/mmgal'));
|
||||
|
||||
// say花火
|
||||
router.get('/sayhuahuo', require('./routes/galgame/sayhuahuo'));
|
||||
|
||||
// 终点分享
|
||||
router.get('/zdfx', require('./routes/galgame/zdfx'));
|
||||
|
||||
|
||||
41
lib/routes/galgame/sayhuahuo.js
Normal file
41
lib/routes/galgame/sayhuahuo.js
Normal file
@@ -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://index.say-huahuo.com/',
|
||||
header: {
|
||||
Referer: 'https://index.say-huahuo.com/',
|
||||
},
|
||||
});
|
||||
|
||||
const data = res.data;
|
||||
|
||||
const $ = cheerio.load(data);
|
||||
const list = $('#article-list').find('.article');
|
||||
|
||||
ctx.state.data = {
|
||||
title: $('title').text(),
|
||||
link: 'https://index.say-huahuo.com/',
|
||||
description: '花火学园',
|
||||
item:
|
||||
list &&
|
||||
list
|
||||
.map((index, item) => {
|
||||
item = $(item);
|
||||
const time = `${item.find('.month').text()}${item.find('.day').text()}日`;
|
||||
const date = new Date();
|
||||
// 1-9月 实际抓取为:1 月
|
||||
const math = /(\d+)\s?月(\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