mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-07 13:39:35 +08:00
feat: add ddrk.me (#3738)
This commit is contained in:
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