From 7dc5a5ac8324deb8d1ae1006b5d46058d8e847e2 Mon Sep 17 00:00:00 2001 From: teddyHV11 Date: Sun, 7 Apr 2024 15:33:04 +0300 Subject: [PATCH] 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. --- src/providers/sources/insertunit.ts | 32 +++++++++++++++-------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/src/providers/sources/insertunit.ts b/src/providers/sources/insertunit.ts index bf70a51..4dd9795 100644 --- a/src/providers/sources/insertunit.ts +++ b/src/providers/sources/insertunit.ts @@ -23,21 +23,23 @@ export const insertunitScraper = makeSourcerer({ ctx.progress(60); const seasonTable = JSON.parse(seasonData[1]); - for (const season of seasonTable) { - if (season.season === ctx.media.season.number) { - if (season.episodes[ctx.media.episode.number] && season.episodes[ctx.media.episode.number].hls) { - return { - embeds: [], - stream: [ - { - id: 'primary', - captions: [], - playlist: season.episodes[ctx.media.episode.number].hls, - type: 'hls', - flags: [flags.CORS_ALLOWED], - }, - ], - }; + for (const seasonElement of seasonTable) { + if (seasonElement.season === ctx.media.season.number) { + for (const episodeElement of seasonElement.episodes) { + if (episodeElement.episode.includes(ctx.media.episode.number)) { + return { + embeds: [], + stream: [ + { + id: 'primary', + captions: [], + playlist: episodeElement.hls, + type: 'hls', + flags: [flags.CORS_ALLOWED], + }, + ], + }; + } } } }