feat: add 深影译站指定剧集 (#6854)

This commit is contained in:
Ethan Shen
2021-02-13 13:40:55 -05:00
committed by GitHub
parent e9124edbc4
commit 2c3edae315
3 changed files with 43 additions and 0 deletions
+4
View File
@@ -886,6 +886,10 @@ pageClass: routes
<Route author="nczitzk" example="/shinybbs/latest" path="/shinybbs/latest" />
### 指定剧集
<Route author="nczitzk" example="/shinybbs/p/1790" path="/shinybbs/p/:id" :paramsDesc="['剧集 id,可在剧集页 URL 中找到']" />
## 腾讯视频
### 播放列表
+1
View File
@@ -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'));
// 天眼查
+38
View File
@@ -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(),
};
};