diff --git a/tubearchivist/home/src/index/generic.py b/tubearchivist/home/src/index/generic.py index 2823533..dcff82b 100644 --- a/tubearchivist/home/src/index/generic.py +++ b/tubearchivist/home/src/index/generic.py @@ -133,7 +133,7 @@ class Pagination: """validate pagination with total_hits after making api call""" page_get = self.page_get max_pages = math.ceil(total_hits / self.page_size) - if total_hits > 10000: + if total_hits >= 10000: # es returns maximal 10000 results self.pagination["max_hits"] = True max_pages = max_pages - 1 diff --git a/tubearchivist/home/src/index/video.py b/tubearchivist/home/src/index/video.py index 8866118..a58a0cb 100644 --- a/tubearchivist/home/src/index/video.py +++ b/tubearchivist/home/src/index/video.py @@ -170,6 +170,11 @@ class SubtitleParser: self.all_cues = [] for idx, event in enumerate(all_events): + if "dDurationMs" not in event: + # some events won't have a duration + print(f"failed to parse event without duration: {event}") + continue + cue = { "start": self._ms_conv(event["tStartMs"]), "end": self._ms_conv(event["tStartMs"] + event["dDurationMs"]),