diff --git a/docs/multimedia.md b/docs/multimedia.md index 251df185f..8f736dc46 100644 --- a/docs/multimedia.md +++ b/docs/multimedia.md @@ -420,3 +420,9 @@ pageClass: routes ### 影视 + +## 低端影视 + +### 影视剧集 + + diff --git a/lib/router.js b/lib/router.js index e140d00e4..4905534d5 100644 --- a/lib/router.js +++ b/lib/router.js @@ -2098,6 +2098,9 @@ router.get('/mlog-club/projects', require('./routes/mlog-club/projects')); // Chrome 网上应用店 router.get('/chrome/webstore/extensions/:id', require('./routes/chrome/extensions')); +// 低端影视 +router.get('/ddrk/:name/:season?', require('./routes/ddrk/index')); + // 公主链接日服公告 router.get('/pcr/news', require('./routes/pcr/news')); diff --git a/lib/routes/ddrk/index.js b/lib/routes/ddrk/index.js new file mode 100644 index 000000000..70a352a5c --- /dev/null +++ b/lib/routes/ddrk/index.js @@ -0,0 +1,32 @@ +const got = require('@/utils/got'); +const cheerio = require('cheerio'); + +module.exports = async (ctx) => { + const name = ctx.params.name; + const season = ctx.params.season; + + let link = `https://ddrk.me/${name}/`; + + if (season) { + link += `${season}/`; + } + + const response = await got(link); + const $ = cheerio.load(response.body); + + const title = $('title').html(); + const description = $('.abstract').html(); + const tracks = JSON.parse($('.wp-playlist-script').html()).tracks.reverse(); + const total = tracks.length; + + ctx.state.data = { + title, + link, + description, + item: tracks.map(({ caption, description }, index) => ({ + title: caption, + link: `${link}?ep=${total - index}`, + description, + })), + }; +};