mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-09-24 23:12:34 +08:00
fix: fetch PV or CM from other section (#4415)
This commit is contained in:
@@ -15,17 +15,36 @@ module.exports = async (ctx) => {
|
||||
}
|
||||
const { data } = await got.get(`https://api.bilibili.com/pgc/web/season/section?season_id=${seasonid}`);
|
||||
|
||||
let episodes = [];
|
||||
if (data.result.main_section && data.result.main_section.episodes) {
|
||||
episodes = episodes.concat(
|
||||
data.result.main_section.episodes.map((item) => ({
|
||||
title: `第${item.title}话 ${item.long_title}`,
|
||||
description: `<img src="${item.cover}">`,
|
||||
link: `https://www.bilibili.com/bangumi/play/ep${item.id}`,
|
||||
}))
|
||||
);
|
||||
}
|
||||
|
||||
if (data.result.section) {
|
||||
data.result.section.forEach((section) => {
|
||||
if (section.episodes) {
|
||||
episodes = episodes.concat(
|
||||
section.episodes.map((item) => ({
|
||||
title: `${item.title} ${item.long_title}`,
|
||||
description: `<img src="${item.cover}">`,
|
||||
link: `https://www.bilibili.com/bangumi/play/ep${item.id}`,
|
||||
}))
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
ctx.state.data = {
|
||||
title: mediaData.mediaInfo.title,
|
||||
link: `https://www.bilibili.com/bangumi/media/md${mediaData.mediaInfo.media_id}/`,
|
||||
image: mediaData.mediaInfo.cover,
|
||||
description: mediaData.mediaInfo.evaluate,
|
||||
item:
|
||||
data.result.main_section.episodes &&
|
||||
data.result.main_section.episodes.map((item, index) => ({
|
||||
title: `第${index + 1}话 ${item.long_title}`,
|
||||
description: `<img src="${item.cover}">`,
|
||||
link: `https://www.bilibili.com/bangumi/play/ep${item.id}`,
|
||||
})),
|
||||
item: episodes,
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user