diff options
Diffstat (limited to 'libs/subliminal_patch/providers/zimuku.py')
-rw-r--r-- | libs/subliminal_patch/providers/zimuku.py | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/libs/subliminal_patch/providers/zimuku.py b/libs/subliminal_patch/providers/zimuku.py index a8564cca1..8bc5c9eae 100644 --- a/libs/subliminal_patch/providers/zimuku.py +++ b/libs/subliminal_patch/providers/zimuku.py @@ -57,7 +57,6 @@ class ZimukuSubtitle(Subtitle): # episode if isinstance(video, Episode): - # always make year a match info = guessit(self.version, {"type": "episode"}) # other properties matches |= guess_matches(video, info, partial=True) @@ -145,6 +144,19 @@ class ZimukuProvider(Provider): logger.debug("No data returned from provider") return [] + html = r.content.decode("utf-8", "ignore") + # parse window location + pattern = r"url\s*=\s*'([^']*)'\s*\+\s*url" + parts = re.findall(pattern, html) + redirect_url = search_link + while parts: + parts.reverse() + redirect_url = urljoin(self.server_url, "".join(parts)) + r = self.session.get(redirect_url, timeout=30) + html = r.content.decode("utf-8", "ignore") + parts = re.findall(pattern, html) + logger.debug("search url located: " + redirect_url) + soup = ParserBeautifulSoup( r.content.decode("utf-8", "ignore"), ["lxml", "html.parser"] ) @@ -154,8 +166,12 @@ class ZimukuProvider(Provider): logger.debug("enter a non-shooter page") for item in soup.find_all("div", {"class": "item"}): title_a = item.find("p", class_="tt clearfix").find("a") - subs_year = re.findall(r"\d{4}", title_a.text) or None + subs_year = year if season: + # episode year in zimuku is the season's year not show's year + actual_subs_year = re.findall(r"\d{4}", title_a.text) or None + if actual_subs_year: + subs_year = int(actual_subs_year[0]) - season + 1 title = title_a.text season_cn1 = re.search("第(.*)季", title) if not season_cn1: |