From d7b7a01ca1fa455f56fb08f403aa9abea7f03588 Mon Sep 17 00:00:00 2001 From: zytomorrow Date: Wed, 6 Apr 2022 23:30:58 +0800 Subject: [PATCH] feat(route): add gaze.run update notify (#9482) * feat(route): add gaze.run update notify * feat(route): add gaze.run update notify * Update docs/multimedia.md Co-authored-by: Tony * Update lib/v2/gaze/radar.js Co-authored-by: Tony * Update lib/v2/gaze/templates/update.art Co-authored-by: Tony * Update lib/v2/gaze/update.js Co-authored-by: Tony * Update lib/v2/gaze/update.js Co-authored-by: Tony Co-authored-by: Tony --- docs/multimedia.md | 6 ++++++ lib/v2/gaze/maintainer.js | 3 +++ lib/v2/gaze/radar.js | 13 +++++++++++++ lib/v2/gaze/router.js | 3 +++ lib/v2/gaze/templates/update.art | 4 ++++ lib/v2/gaze/update.js | 27 +++++++++++++++++++++++++++ 6 files changed, 56 insertions(+) create mode 100644 lib/v2/gaze/maintainer.js create mode 100644 lib/v2/gaze/radar.js create mode 100644 lib/v2/gaze/router.js create mode 100644 lib/v2/gaze/templates/update.art create mode 100644 lib/v2/gaze/update.js diff --git a/docs/multimedia.md b/docs/multimedia.md index cecbc54037..c9df98a1e2 100644 --- a/docs/multimedia.md +++ b/docs/multimedia.md @@ -389,6 +389,12 @@ BT 之家的域名会变更,本路由以 为默认 +## 注视影视 + +### 更新通知 + + + ## Hentaimama ### 近期更新 diff --git a/lib/v2/gaze/maintainer.js b/lib/v2/gaze/maintainer.js new file mode 100644 index 0000000000..863472a9b4 --- /dev/null +++ b/lib/v2/gaze/maintainer.js @@ -0,0 +1,3 @@ +module.exports = { + '/update/:mid': ['zytomorrow'], +}; diff --git a/lib/v2/gaze/radar.js b/lib/v2/gaze/radar.js new file mode 100644 index 0000000000..96de41f196 --- /dev/null +++ b/lib/v2/gaze/radar.js @@ -0,0 +1,13 @@ +module.exports = { + 'gaze.run': { + _name: '注视影视', + '.': [ + { + title: '更新通知', + docs: 'https://docs.rsshub.app//multimedia.html#gaze-run', + source: ['/play/:mid'], + target: (params) => `/gaze/update/${params.mid}`, + }, + ], + }, +}; diff --git a/lib/v2/gaze/router.js b/lib/v2/gaze/router.js new file mode 100644 index 0000000000..49eaf43c52 --- /dev/null +++ b/lib/v2/gaze/router.js @@ -0,0 +1,3 @@ +module.exports = function (router) { + router.get('/update/:mid', require('./update')); +}; diff --git a/lib/v2/gaze/templates/update.art b/lib/v2/gaze/templates/update.art new file mode 100644 index 0000000000..919f938ec1 --- /dev/null +++ b/lib/v2/gaze/templates/update.art @@ -0,0 +1,4 @@ +
+ {{ data.name }}已于{{ data.update_time }}更新第{{ data.episodes }}集。
+ 观看地址:{{ data.name }}第{{ data.episodes }}集 +
diff --git a/lib/v2/gaze/update.js b/lib/v2/gaze/update.js new file mode 100644 index 0000000000..11e75a764f --- /dev/null +++ b/lib/v2/gaze/update.js @@ -0,0 +1,27 @@ +const got = require('@/utils/got'); +const { art } = require('@/utils/render'); +const path = require('path'); +const { parseDate } = require('@/utils/parse-date'); +const timezone = require('@/utils/timezone') + +// 站长提供的API +const rootUrl = 'https://gaze.run/3e47b75000b0924b6c9ba5759a7cf15d'; + +module.exports = async (ctx) => { + const mid = ctx.params.mid; + const response = await got.post(rootUrl, { form: { mid } }); + const data = response.data.data; + + ctx.state.data = { + title: `gaze.run影视更新通知 - ${data.name}`, + link: `https://gaze.run/play/${mid}`, + item: [ + { + title: `${data.name}-第${data.episodes}集`, + description: art(path.resolve(__dirname, './templates/update.art'), { data }), + link: `https://gaze.run/play/${mid}`, + pubDate: timezone(parseDate(data.update_time), +8), + }, + ], + }; +};