From 5de618fc88df0fdbc8403a6d708ee549383de77c Mon Sep 17 00:00:00 2001
From: junfengP <840282629@qq.com>
Date: Thu, 25 Apr 2019 12:06:46 +0800
Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0Say=E8=8A=B1=E7=81=AB=20(#198?=
=?UTF-8?q?4)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
docs/anime.md | 4 ++++
lib/router.js | 3 +++
lib/routes/galgame/sayhuahuo.js | 41 +++++++++++++++++++++++++++++++++
3 files changed, 48 insertions(+)
create mode 100644 lib/routes/galgame/sayhuahuo.js
diff --git a/docs/anime.md b/docs/anime.md
index 4deca406c..faaf8a95c 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 50d17f75b..39f39c67c 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 000000000..f17a2919f
--- /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(),
+ };
+};