diff --git a/docs/multimedia.md b/docs/multimedia.md index 7bb71502c..bb4464908 100644 --- a/docs/multimedia.md +++ b/docs/multimedia.md @@ -477,6 +477,14 @@ pageClass: routes +### 指定剧集 + + + +如:雪国列车(剧版)的下载页 URL 为 `https://ysfx.tv/view/qEzRyY3v.html`,即剧集 id 为 `qEzRyY3v`。 + + + ## Nyaa ### 搜索结果 diff --git a/lib/router.js b/lib/router.js index bfa853886..4542c512e 100644 --- a/lib/router.js +++ b/lib/router.js @@ -3888,7 +3888,8 @@ router.get('/feed-the-beast/modpack/:modpackEntry', require('./routes/feed-the-b router.get('/gab/user/:username', require('./routes/gab/user')); router.get('/gab/popular/:sort?', require('./routes/gab/explore')); -// NEW字幕组 +// NEW 字幕组 +router.get('/newzmz/view/:id', require('./routes/newzmz/view')); router.get('/newzmz/:category?', require('./routes/newzmz/index')); // Phrack Magazine diff --git a/lib/routes/newzmz/view.js b/lib/routes/newzmz/view.js new file mode 100644 index 000000000..9107a7e9a --- /dev/null +++ b/lib/routes/newzmz/view.js @@ -0,0 +1,42 @@ +const got = require('@/utils/got'); +const cheerio = require('cheerio'); + +module.exports = async (ctx) => { + const id = ctx.params.id; + + const rootUrl = `https://ysfx.tv`; + const currentUrl = `${rootUrl}/view/${id}.html`; + + const response = await got({ + method: 'get', + url: currentUrl, + }); + const $ = cheerio.load(response.data); + + $('img, .link-name').remove(); + + $('a[title]').each(function () { + $(this).text($(this).attr('title')); + }); + + const list = $('.team-con-area') + .map((_, item) => { + item = $(item); + const link = item.find('a[data-target="#down-modal"]').eq(0).attr('href'); + + return { + link, + enclosure_url: link, + enclosure_type: 'application/x-bittorrent', + title: item.find('.item-content').text(), + description: ``, + }; + }) + .get(); + + ctx.state.data = { + title: `${$('.page-header-content .title').text()} - NEW字幕组`, + link: currentUrl, + item: list, + }; +};