diff --git a/libs/subliminal_patch/providers/ktuvit.py b/libs/subliminal_patch/providers/ktuvit.py index c9b656922..24762d938 100644 --- a/libs/subliminal_patch/providers/ktuvit.py +++ b/libs/subliminal_patch/providers/ktuvit.py @@ -118,6 +118,7 @@ class KtuvitProvider(Provider): request_download_id_url = "Services/ContentProvider.svc/RequestSubtitleDownload" download_link = "Services/DownloadFile.ashx?DownloadIdentifier=" subtitle_class = KtuvitSubtitle + no_subtitle_str = 'אין כתוביות' _tmdb_api_key = "a51ee051bcd762543373903de296e0a3" @@ -315,6 +316,7 @@ class KtuvitProvider(Provider): else: subs = self._search_tvshow(ktuvit_id, season, episode) + logger.debug('Got {} Subs from Ktuvit'.format(len(subs))) for sub in subs: # otherwise create it subtitle = KtuvitSubtitle( @@ -349,7 +351,11 @@ class KtuvitProvider(Provider): r.raise_for_status() sub_list = ParserBeautifulSoup(r.content, ["html.parser"]) - sub_rows = sub_list.find_all("tr") + sub_rows = sub_list("tr") + + if sub_list.find("tr") and sub_list.find("tr").find("td") and sub_list.find("tr").find("td").get_text() == self.no_subtitle_str: + logger.debug("No Subtitles Found. URL " + url) + return subs for row in sub_rows: columns = row.find_all("td") @@ -362,8 +368,9 @@ class KtuvitProvider(Provider): sub["sub_id"] = column.find("input", attrs={"data-sub-id": True})[ "data-sub-id" ] - - subs.append(sub) + + if 'sub_id' in sub: + subs.append(sub) return subs def _search_movie(self, movie_id): @@ -386,7 +393,8 @@ class KtuvitProvider(Provider): "data-subtitle-id" ] - subs.append(sub) + if 'sub_id' in sub: + subs.append(sub) return subs def list_subtitles(self, video, languages):