mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-05 20:27:52 +08:00
33 lines
823 B
JavaScript
33 lines
823 B
JavaScript
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,
|
|
})),
|
|
};
|
|
};
|