From fb59c4721a094f7d52881e533e571df13dab14bd Mon Sep 17 00:00:00 2001 From: Kevin Date: Mon, 13 Aug 2018 14:19:50 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20fir.im=20app=20=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=20(#457)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 1 + docs/README.md | 8 ++++++++ router.js | 3 +++ routes/fir/update.js | 32 ++++++++++++++++++++++++++++++++ 4 files changed, 44 insertions(+) create mode 100644 routes/fir/update.js diff --git a/README.md b/README.md index 95a0b8f06..027a86cd6 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,7 @@ RSSHub 是一个轻量、易于扩展的 RSS 生成器,可以给任何奇奇 - Firefox - 腾讯云移动直播 SDK - Bugly SDK + - fir.im - bilibili - 番剧 - UP 主投稿 diff --git a/docs/README.md b/docs/README.md index c37ee29cc..1a73e8da0 100644 --- a/docs/README.md +++ b/docs/README.md @@ -148,6 +148,14 @@ type: 类型,可选参数 参数:platform, 平台类型,必选,1 为 Android,2 为 iOS +### Fir.im 更新 + +举例: [https://rsshub.app/fir/update/xcz](https://rsshub.app/fir/update/xcz) + +路由: `/fir/update/:id` + +参数:id, fir app id,必选,如 fir 生成的链接地址为 https://fir.im/xcz,则 id 为 xcz + ## bilibili ### 番剧 diff --git a/router.js b/router.js index 898616edc..3e064bf56 100755 --- a/router.js +++ b/router.js @@ -412,4 +412,7 @@ router.get('/bugly/changelog/:platform', require('./routes/bugly/changelog')); // All the Flight Deals router.get('/atfd/:locations/:nearby?', require('./routes/atfd/index')); +// Fir +router.get('/fir/update/:id', require('./routes/fir/update')); + module.exports = router; diff --git a/routes/fir/update.js b/routes/fir/update.js new file mode 100644 index 000000000..78188cfd6 --- /dev/null +++ b/routes/fir/update.js @@ -0,0 +1,32 @@ +const axios = require('../../utils/axios'); +const config = require('../../config'); + +module.exports = async (ctx) => { + const id = ctx.params.id; + const APIUrl = `https://download.fir.im/${id}`; + + const webUrl = `https://fir.im/${id}`; + + const res = await axios({ + method: 'get', + url: APIUrl, + headers: { + 'User-Agent': config.ua, + Referer: webUrl, + }, + }); + + const data = res.data; + + const title = data.app.name + ' 更新'; + + const item = {}; + item.title = data.app.name + ' ' + data.app.releases.master.version + '(' + data.app.releases.master.build + ')'; + item.description = data.app.releases.master.changelog; + item.pubDate = new Date(data.app.releases.master.created_at * 1000); + ctx.state.data = { + title: title, + link: webUrl, + item: [item], + }; +};