diff --git a/docs/multimedia.md b/docs/multimedia.md index 977d8aac6..3943048f9 100644 --- a/docs/multimedia.md +++ b/docs/multimedia.md @@ -861,6 +861,20 @@ pageClass: routes ## 深影译站 +### 首页 + + + +### 剧集类型 + + + +| 英美剧 | 日韩剧 | 小语种 | +| ------ | ------ | ------ | +| 62 | 140 | 2 | + + + ### 最新作品 diff --git a/lib/router.js b/lib/router.js index 93c44176e..5ac4caa32 100644 --- a/lib/router.js +++ b/lib/router.js @@ -3910,6 +3910,7 @@ router.get('/tingshen', require('./routes/tingshen/tingshen')); router.get('/gov/mohrss/sbjm/:category?', require('./routes/gov/mohrss/sbjm')); // 深影译站 +router.get('/shinybbs/:id?', require('./routes/shinybbs/index')); router.get('/shinybbs/latest', require('./routes/shinybbs/latest')); module.exports = router; diff --git a/lib/routes/shinybbs/index.js b/lib/routes/shinybbs/index.js new file mode 100644 index 000000000..f2f7f155e --- /dev/null +++ b/lib/routes/shinybbs/index.js @@ -0,0 +1,61 @@ +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}/?page_id=${id}`; + const response = await got({ + method: 'get', + url: currentUrl, + }); + + const $ = cheerio.load(response.data); + + const list = $('.elementor-button-link, .kb-gallery-item-link') + .slice(0, 10) + .map((_, item) => { + item = $(item); + return { + link: item.attr('href'), + }; + }) + .get(); + + const items = await Promise.all( + list.map( + async (item) => + await ctx.cache.tryGet(item.link, async () => { + const detailResponse = await got({ + method: 'get', + url: item.link, + }); + const content = cheerio.load(detailResponse.data); + + content('.elementor-section').last().remove(); + content('.elementor-section').last().remove(); + + content('.elementor-tabs-wrapper').remove(); + + item.title = content('.post-title').text(); + item.description = content('.elementor-inner, .post-content').html(); + item.pubDate = new Date(content('.post-date').text().replace(/年|月/g, '-').replace('日', '')).toUTCString(); + + item.enclosure_type = 'application/x-bittorrent'; + + const enclosureUrl = content('.elementor-tab-content a').last().attr('href'); + + item.enclosure_url = enclosureUrl ? enclosureUrl.replace('http://magnet', 'magnet') : ''; + + return item; + }) + ) + ); + + ctx.state.data = { + title: $('title').text(), + link: currentUrl, + item: items, + }; +};