From 2d6a20285746d34090513619cda1ff55d2babb5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=87=89=E5=87=89?= Date: Thu, 1 Nov 2018 19:02:34 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=EF=BC=9A=E6=9E=81=E5=AE=A2?= =?UTF-8?q?=E5=85=AC=E5=9B=AD-=E5=85=A8=E7=90=83=E5=BF=AB=E8=AE=AF=20(#102?= =?UTF-8?q?3)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Closes #1017 --- docs/README.md | 4 ++++ router.js | 3 +++ routes/geekpark/breakingnews.js | 26 ++++++++++++++++++++++++++ 3 files changed, 33 insertions(+) create mode 100644 routes/geekpark/breakingnews.js diff --git a/docs/README.md b/docs/README.md index 744e838a53..9b62707c4e 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1594,6 +1594,10 @@ Solidot 提供的 feed: +### 极客公园 + + + ## 预报预警 ### 停水通知 diff --git a/router.js b/router.js index e08662946b..cfa040c4d6 100644 --- a/router.js +++ b/router.js @@ -728,4 +728,7 @@ router.get('/acfun/bangumi/:id', require('./routes/acfun/bangumi')); // Auto Trader router.get('/autotrader/:query', require('./routes/autotrader')); +// 极客公园 +router.get('/geekpark/breakingnews', require('./routes/geekpark/breakingnews')); + module.exports = router; diff --git a/routes/geekpark/breakingnews.js b/routes/geekpark/breakingnews.js new file mode 100644 index 0000000000..cea7a43268 --- /dev/null +++ b/routes/geekpark/breakingnews.js @@ -0,0 +1,26 @@ +const axios = require('../../utils/axios'); + +module.exports = async (ctx) => { + const url = 'https://digestapit.geeks.vc/v1/articles'; + const link = 'https://www.geekpark.net/breakingnews'; + + const response = await axios({ + method: 'get', + url, + }); + const data = response.data.data.reverse(); + + ctx.state.data = { + title: '全球快讯 | 极客公园', + description: + '极客公园聚焦互联网领域,跟踪最新的科技新闻动态,关注极具创新精神的科技产品。目前涵盖前沿科技、游戏、手机评测、硬件测评、出行方式、共享经济、人工智能等全方位的科技生活内容。现有前沿社、挖App、深度报道、极客养成指南等多个内容栏目。', + link, + item: data.map(({ url, edited_title, summary, published, _id }) => ({ + title: edited_title, + description: summary, + link: url, + pubDate: new Date(published).toUTCString(), + guid: _id, + })), + }; +};