From 2c3edae3158229b91bd68e88730b64ca09d83b1b Mon Sep 17 00:00:00 2001 From: Ethan Shen Date: Sun, 14 Feb 2021 02:40:55 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20add=20=E6=B7=B1=E5=BD=B1=E8=AF=91?= =?UTF-8?q?=E7=AB=99=E6=8C=87=E5=AE=9A=E5=89=A7=E9=9B=86=20(#6854)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/multimedia.md | 4 ++++ lib/router.js | 1 + lib/routes/shinybbs/p.js | 38 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 43 insertions(+) create mode 100644 lib/routes/shinybbs/p.js diff --git a/docs/multimedia.md b/docs/multimedia.md index 7b28d8eab..24001bf59 100644 --- a/docs/multimedia.md +++ b/docs/multimedia.md @@ -886,6 +886,10 @@ pageClass: routes +### 指定剧集 + + + ## 腾讯视频 ### 播放列表 diff --git a/lib/router.js b/lib/router.js index 46e541c11..4d86e6fbb 100644 --- a/lib/router.js +++ b/lib/router.js @@ -3911,6 +3911,7 @@ router.get('/gov/mohrss/sbjm/:category?', require('./routes/gov/mohrss/sbjm')); // 深影译站 router.get('/shinybbs/:id?', require('./routes/shinybbs/index')); +router.get('/shinybbs/p/:id', require('./routes/shinybbs/p')); router.get('/shinybbs/latest', require('./routes/shinybbs/latest')); // 天眼查 diff --git a/lib/routes/shinybbs/p.js b/lib/routes/shinybbs/p.js new file mode 100644 index 000000000..853af59f2 --- /dev/null +++ b/lib/routes/shinybbs/p.js @@ -0,0 +1,38 @@ +const got = require('@/utils/got'); +const cheerio = require('cheerio'); + +module.exports = async (ctx) => { + const id = ctx.params.id; + + const rootUrl = 'https://sub.shinybbs.vip'; + const currentUrl = `${rootUrl}/?p=${id}`; + const response = await got({ + method: 'get', + url: currentUrl, + }); + + const $ = cheerio.load(response.data); + + $('.elementor-section').last().remove(); + $('.elementor-section').last().remove(); + + $('.elementor-tabs-wrapper').remove(); + + const items = $('.elementor-tab-content a') + .map((_, item) => { + item = $(item); + return { + title: item.text(), + link: item.attr('href'), + enclosure_url: item.attr('href'), + enclosure_type: 'application/x-bittorrent', + }; + }) + .get(); + + ctx.state.data = { + title: `${$('.post-title').text()} - 深影译站`, + link: currentUrl, + item: items.reverse(), + }; +};