mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-08 05:59:00 +08:00
feat: add ddrk.me (#3738)
This commit is contained in:
@@ -420,3 +420,9 @@ pageClass: routes
|
||||
### 影视
|
||||
|
||||
<Route author="DIYgod" example="/zimuzu/resource/37031" path="/zimuzu/resource/:id?" :paramsDesc="['影视 id,对应影视的 URL 中找到,为空时输出最近更新']" supportBT="1"/>
|
||||
|
||||
## 低端影视
|
||||
|
||||
### 影视剧集
|
||||
|
||||
<Route author="saintwinkle" example="/ddrk/silicon-valley/6" path="/ddrk/:name/:season?" :paramsDesc="['影视名称,可以在 URL 中找到','季数,可以在 URL 中找到,剧集没有分季时不用填写,或是默认输出第一季的内容,']" />
|
||||
|
||||
@@ -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'));
|
||||
|
||||
|
||||
32
lib/routes/ddrk/index.js
Normal file
32
lib/routes/ddrk/index.js
Normal file
@@ -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,
|
||||
})),
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user