diff --git a/docs/multimedia.md b/docs/multimedia.md index 81731d5bb..fcf94a9e0 100644 --- a/docs/multimedia.md +++ b/docs/multimedia.md @@ -217,6 +217,22 @@ pageClass: routes ::: +## FIX 字幕侠 + +### 分类 + + + +| ALL | FIX 德语社 | 欧美剧集 | 欧美电影 | 综艺 & 纪录 | FIX 日语社 | FIX 韩语社 | FIX 法语社 | +| --- | ---------- | -------- | -------- | ----------- | ---------- | ---------- | ---------- | +| | 昆仑德语社 | 欧美剧集 | 欧美电影 | 综艺纪录 | fix 日语社 | fix 韩语社 | fix 法语社 | + + + +### 剧集 + + + ### Lookup Torrents by IMDB ID diff --git a/lib/router.js b/lib/router.js index 95f120732..d57eb8b75 100644 --- a/lib/router.js +++ b/lib/router.js @@ -4067,6 +4067,10 @@ router.get('/jisilu/topic/:user', require('./routes/jisilu/topic')); // Constitutional Court of Baden-Württemberg (Germany) router.get('/verfghbw/press/:keyword?', require('./routes/verfghbw/press')); +// FIX 字幕侠 +router.get('/zimuxia/portfolio/:id', require('./routes/zimuxia/portfolio')); +router.get('/zimuxia/:category?', require('./routes/zimuxia/index')); + // Bandcamp router.get('/bandcamp/tag/:tag?', require('./routes/bandcamp/tag')); diff --git a/lib/routes/zimuxia/index.js b/lib/routes/zimuxia/index.js new file mode 100644 index 000000000..583e4be60 --- /dev/null +++ b/lib/routes/zimuxia/index.js @@ -0,0 +1,57 @@ +const got = require('@/utils/got'); +const cheerio = require('cheerio'); + +module.exports = async (ctx) => { + const category = ctx.params.category || ''; + + const rootUrl = 'https://www.zimuxia.cn'; + const currentUrl = `${rootUrl}/我们的作品?cat=${category}`; + const response = await got({ + method: 'get', + url: currentUrl, + }); + + const $ = cheerio.load(response.data); + + const list = $('.pg-item a') + .slice(0, 10) + .map((_, item) => { + item = $(item); + + return { + title: item.find('h2').text(), + 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); + + const links = detailResponse.data.match(/磁力下载<\/a>/g); + + if (links) { + item.enclosure_type = 'application/x-bittorrent'; + item.enclosure_url = links.pop().match(/磁力下载<\/a>/)[1]; + } + + item.description = content('.content-box').html(); + + return item; + }) + ) + ); + + ctx.state.data = { + title: `${category || 'ALL'} - FIX字幕侠`, + link: currentUrl, + item: items, + }; +}; diff --git a/lib/routes/zimuxia/portfolio.js b/lib/routes/zimuxia/portfolio.js new file mode 100644 index 000000000..c8e83a5d7 --- /dev/null +++ b/lib/routes/zimuxia/portfolio.js @@ -0,0 +1,39 @@ +const got = require('@/utils/got'); +const cheerio = require('cheerio'); + +module.exports = async (ctx) => { + const id = ctx.params.id; + + const rootUrl = 'http://zimuxia.cn'; + const currentUrl = `${rootUrl}/portfolio/${id}`; + const response = await got({ + method: 'get', + url: currentUrl, + }); + + const $ = cheerio.load(response.data); + + const items = $('a') + .filter(function () { + return $(this).attr('href').substr(0, 7) === 'magnet:'; + }) + .reverse() + .map((_, item) => { + item = $(item); + + return { + link: currentUrl, + title: item.parent().text().split(' ')[0], + description: `

${item.parent().html()}

`, + enclosure_url: item.attr('href'), + enclosure_type: 'application/x-bittorrent', + }; + }) + .get(); + + ctx.state.data = { + title: `${$('.content-page-title').text()} - FIX字幕侠`, + link: currentUrl, + item: items, + }; +};