diff options
author | Guy Khmelnitsky <[email protected]> | 2021-09-22 19:22:56 +0300 |
---|---|---|
committer | GitHub <[email protected]> | 2021-09-22 12:22:56 -0400 |
commit | 66585ec7654d5ba5633f79d5cc51ca18807619a4 (patch) | |
tree | 8ce11cf176a3b0ce01e9f0e90ac6b838af6756f5 | |
parent | c1421f1cce7b2553dbcb2f60954203b0293a8e3b (diff) | |
download | bazarr-66585ec7654d5ba5633f79d5cc51ca18807619a4.tar.gz bazarr-66585ec7654d5ba5633f79d5cc51ca18807619a4.zip |
Fix Missing subtitles issue with Ktuvit providerv0.9.10-beta.6
-rw-r--r-- | libs/subliminal_patch/providers/ktuvit.py | 16 |
1 files changed, 12 insertions, 4 deletions
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): |