Fix series scraping

Series scraping was off for some series, this fixes it + also adds support for episodes that are in multiple parts (continuation of each other) as the provider returns them as a single file in episode ranges.
This commit is contained in:
teddyHV11
2024-04-07 15:33:04 +03:00
parent 73facc0184
commit 7dc5a5ac83

View File

@@ -23,16 +23,17 @@ export const insertunitScraper = makeSourcerer({
ctx.progress(60); ctx.progress(60);
const seasonTable = JSON.parse(seasonData[1]); const seasonTable = JSON.parse(seasonData[1]);
for (const season of seasonTable) { for (const seasonElement of seasonTable) {
if (season.season === ctx.media.season.number) { if (seasonElement.season === ctx.media.season.number) {
if (season.episodes[ctx.media.episode.number] && season.episodes[ctx.media.episode.number].hls) { for (const episodeElement of seasonElement.episodes) {
if (episodeElement.episode.includes(ctx.media.episode.number)) {
return { return {
embeds: [], embeds: [],
stream: [ stream: [
{ {
id: 'primary', id: 'primary',
captions: [], captions: [],
playlist: season.episodes[ctx.media.episode.number].hls, playlist: episodeElement.hls,
type: 'hls', type: 'hls',
flags: [flags.CORS_ALLOWED], flags: [flags.CORS_ALLOWED],
}, },
@@ -41,6 +42,7 @@ export const insertunitScraper = makeSourcerer({
} }
} }
} }
}
throw new NotFoundError('No result found'); throw new NotFoundError('No result found');
}, },