From 130fa5ee114dc9e7a11579814762f36cb8bb7791 Mon Sep 17 00:00:00 2001 From: Tera <1527149+Denoder@users.noreply.github.com> Date: Fri, 10 May 2024 00:27:35 +0300 Subject: [PATCH] [HiDive] Remove unreleased episodes from list When doing a range download/single selection of an anime that's currently airing episodes that haven't released will still get downloaded at 0 bytes. This will skip them if they have a date range in them, rather than an appropriate title. --- hidive.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/hidive.ts b/hidive.ts index 6492969..e146acd 100644 --- a/hidive.ts +++ b/hidive.ts @@ -369,6 +369,10 @@ export default class Hidive implements ServiceClass { season.value.paging.moreDataAvailable = seasonPage.value.paging.moreDataAvailable; } for (const episode of season.value.episodes) { + const datePattern = /\d{1,2}\/\d{1,2}\/\d{2,4} \d{1,2}:\d{2} UTC/; + if (datePattern.test(episode.title)) { + continue; + } if (episode.title.includes(' - ')) { episode.episodeInformation.episodeNumber = parseFloat(episode.title.split(' - ')[0].replace('E', '')); episode.title = episode.title.split(' - ')[1]; @@ -397,6 +401,10 @@ export default class Hidive implements ServiceClass { } const episodes: Episode[] = []; for (const episode of season.value.episodes) { + const datePattern = /\d{1,2}\/\d{1,2}\/\d{2,4} \d{1,2}:\d{2} UTC/; + if (datePattern.test(episode.title)) { + continue; + } if (episode.title.includes(' - ')) { episode.episodeInformation.episodeNumber = parseFloat(episode.title.split(' - ')[0].replace('E', '')); episode.title = episode.title.split(' - ')[1]; @@ -1077,4 +1085,4 @@ export default class Hidive implements ServiceClass { setTimeout(resolve, ms); }); } -} \ No newline at end of file +}