feat: add 猫耳FM广播剧 (#6303)
This commit is contained in:
parent
fdefa01986
commit
ca6e8b6c91
|
|
@ -5,19 +5,37 @@ module.exports = async (ctx) => {
|
|||
const host = 'www.missevan.com';
|
||||
const dramaUrl = `https://${host}/dramaapi/getdrama?drama_id=${id}`;
|
||||
const dramaResp = await got(dramaUrl);
|
||||
const episodesSize = dramaResp.data.info.episodes.episode.length;
|
||||
const episodesUrl = `https://${host}/dramaapi/getdramaepisodedetails?drama_id=${id}&p=1&page_size=${episodesSize}`;
|
||||
const episodesResp = await got(episodesUrl);
|
||||
|
||||
const items = await Promise.all(
|
||||
dramaResp.data.info.episodes.episode.map(
|
||||
async (item) =>
|
||||
await ctx.cache.tryGet(`https://www.missevan.com/sound/getsound?soundid=${item.sound_id}`, async () => {
|
||||
const soundResponse = await got({
|
||||
method: 'get',
|
||||
url: `https://www.missevan.com/sound/getsound?soundid=${item.sound_id}`,
|
||||
});
|
||||
const soundData = soundResponse.data.info.sound;
|
||||
return {
|
||||
title: item.name,
|
||||
enclosure_url: soundData.soundurl,
|
||||
enclosure_length: soundData.duration,
|
||||
enclosure_type: 'audio/mpeg',
|
||||
image: dramaResp.data.info.drama.cover,
|
||||
itunes_author: soundData.username,
|
||||
itunes_category: '',
|
||||
link: `https://www.missevan.com/sound/player?id=${item.sound_id}`,
|
||||
description: `<img src=${dramaResp.data.info.drama.cover}><br>${soundData.intro}`,
|
||||
pubDate: new Date(soundData.last_update_time * 1000).toUTCString(),
|
||||
};
|
||||
})
|
||||
)
|
||||
);
|
||||
|
||||
ctx.state.data = {
|
||||
title: dramaResp.data.info.drama.name,
|
||||
link: `https://${host}/mdrama/drama/${id}`,
|
||||
image: dramaResp.data.info.drama.cover,
|
||||
description: dramaResp.data.info.drama.abstract,
|
||||
item: episodesResp.data.info.Datas.map((e) => ({
|
||||
title: e.soundstr,
|
||||
description: `<img src="${e.front_cover}" /><br>${e.intro}`,
|
||||
link: `https://${host}/sound/player?id=${e.id}`,
|
||||
})),
|
||||
item: items,
|
||||
};
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue