diff --git a/docs/anime.md b/docs/anime.md index 4deca406c6..faaf8a95cd 100644 --- a/docs/anime.md +++ b/docs/anime.md @@ -26,6 +26,10 @@ +## say 花火 + + + ## 终点分享 diff --git a/lib/router.js b/lib/router.js index 50d17f75b6..39f39c67cc 100755 --- a/lib/router.js +++ b/lib/router.js @@ -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')); diff --git a/lib/routes/galgame/sayhuahuo.js b/lib/routes/galgame/sayhuahuo.js new file mode 100644 index 0000000000..f17a2919f3 --- /dev/null +++ b/lib/routes/galgame/sayhuahuo.js @@ -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(), + }; +};