From 3fa57ec74d2be4fa33b42b5a2d5c72e496198047 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=87=89=E5=87=89?= Date: Sat, 3 Nov 2018 10:55:24 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=EF=BC=9A=E6=90=9C=E7=8B=97?= =?UTF-8?q?=E7=89=B9=E8=89=B2LOGO=20(#1047)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 增加:有品-每日上新 * 修复 summary 字段错误 * 将 youpin 模块转移至 mi 目录下,并更新文档 * 增加:搜狗特色LOGO --- docs/README.md | 4 ++++ router.js | 3 +++ routes/sogou/doodles.js | 26 ++++++++++++++++++++++++++ 3 files changed, 33 insertions(+) create mode 100644 routes/sogou/doodles.js diff --git a/docs/README.md b/docs/README.md index 8af524a8d..2793cc9a4 100644 --- a/docs/README.md +++ b/docs/README.md @@ -2178,6 +2178,10 @@ IATA 国际航空运输协会机场代码, 参见[维基百科 国际航空运 +### 搜狗 + + + ### 香港天文台 diff --git a/router.js b/router.js index 254660110..cc0a1c0a5 100644 --- a/router.js +++ b/router.js @@ -738,6 +738,9 @@ router.get('/geekpark/breakingnews', require('./routes/geekpark/breakingnews')); // 百度 router.get('/baidu/doodles', require('./routes/baidu/doodles')); +// 搜狗 +router.get('/sogou/doodles', require('./routes/sogou/doodles')); + // 香港天文台 router.get('/hko/weather', require('./routes/hko/weather')); diff --git a/routes/sogou/doodles.js b/routes/sogou/doodles.js new file mode 100644 index 000000000..1bea6a8d7 --- /dev/null +++ b/routes/sogou/doodles.js @@ -0,0 +1,26 @@ +const axios = require('../../utils/axios'); + +module.exports = async (ctx) => { + const response = await axios({ + method: 'get', + url: 'http://help.sogou.com/logo/doodle_logo_list.html', + }); + + const data = response.data.split(/\r\n/).slice(1); + + ctx.state.data = { + title: '搜狗特色LOGO', + link: 'http://help.sogou.com/logo/', + item: data.map((item) => { + item = item.split(','); + + return { + title: `${item[2]}-${item[5]}`, + description: ``, + pubDate: new Date(item[5]).toUTCString(), + link: item[7], + guid: item[4], + }; + }), + }; +};