From 8a96fcb83ca541ea6d9f51ae8ce93cb63f8f87f5 Mon Sep 17 00:00:00 2001 From: shiningdracon Date: Thu, 23 Sep 2021 01:14:54 -0700 Subject: [PATCH] =?UTF-8?q?feat(route):=20=E6=B7=BB=E5=8A=A0=20=E2=80=9CTh?= =?UTF-8?q?e=20Ring=20of=20Wonder=20=E9=A6=96=E9=A1=B5=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E2=80=9D=E7=9A=84route=E4=BB=A5=E5=8F=8A=E6=96=87=E6=A1=A3=20(?= =?UTF-8?q?#8237)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add route: The Ring of Wonder * Fix timezone * Remove templates (not in use) --- docs/bbs.md | 6 ++++++ lib/v2/trow/maintainer.js | 3 +++ lib/v2/trow/portal.js | 32 ++++++++++++++++++++++++++++++++ lib/v2/trow/radar.js | 13 +++++++++++++ lib/v2/trow/router.js | 3 +++ 5 files changed, 57 insertions(+) create mode 100644 lib/v2/trow/maintainer.js create mode 100644 lib/v2/trow/portal.js create mode 100644 lib/v2/trow/radar.js create mode 100644 lib/v2/trow/router.js diff --git a/docs/bbs.md b/docs/bbs.md index 1d2a68794..e8d5c62a9 100644 --- a/docs/bbs.md +++ b/docs/bbs.md @@ -778,4 +778,10 @@ pageClass: routes | ------------- | ------------ | ------------ | | lingyishijain | lingyitupian | minjianqitan | +## The Ring of Wonder + +### 首页更新 + + + diff --git a/lib/v2/trow/maintainer.js b/lib/v2/trow/maintainer.js new file mode 100644 index 000000000..9d167afb0 --- /dev/null +++ b/lib/v2/trow/maintainer.js @@ -0,0 +1,3 @@ +module.exports = { + '/portal': ['shiningdracon'], +}; diff --git a/lib/v2/trow/portal.js b/lib/v2/trow/portal.js new file mode 100644 index 000000000..05dd62b6d --- /dev/null +++ b/lib/v2/trow/portal.js @@ -0,0 +1,32 @@ +const got = require('@/utils/got'); +const cheerio = require('cheerio'); +const { parseDate } = require('@/utils/parse-date'); +const timezone = require('@/utils/timezone'); + +module.exports = async (ctx) => { + const response = await got({ + method: 'get', + url: `https://trow.cc`, + }); + const data = response.data; + + const $ = cheerio.load(data); + const list = $('#portal_content .borderwrap[style="display:show"]'); + + ctx.state.data = { + title: `The Ring of Wonder - Portal`, + link: `https://trow.cc`, + description: `The Ring of Wonder 首页更新`, + item: list && list.map((index, item) => { + item = $(item); + const dateraw = item.find('.postdetails').text(); + return { + title: item.find('.maintitle p:nth-child(2) > a').text(), + description: item.find('.portal_news_content .row18').html(), + link: item.find('.maintitle p:nth-child(2) > a').attr('href'), + author: item.find('.postdetails a').text(), + pubDate: timezone(parseDate(dateraw.slice(3), 'YYYY-MM-DD, HH:mm'), +8), + }; + }).get(), + }; +}; \ No newline at end of file diff --git a/lib/v2/trow/radar.js b/lib/v2/trow/radar.js new file mode 100644 index 000000000..febfa0f3e --- /dev/null +++ b/lib/v2/trow/radar.js @@ -0,0 +1,13 @@ +module.exports = { + 'trow.cc': { + _name: 'The Ring of Wonder', + '.': [ + { + title: '首页更新', + docs: 'https://docs.rsshub.app/bbs.html#the-ring-of-wonder', + source: ['/'], + target: '/portal', + }, + ], + }, +}; diff --git a/lib/v2/trow/router.js b/lib/v2/trow/router.js new file mode 100644 index 000000000..f49741853 --- /dev/null +++ b/lib/v2/trow/router.js @@ -0,0 +1,3 @@ +module.exports = function (router) { + router.get('/portal', require('./portal')); +};