mirror of
https://github.com/morpheus65535/bazarr
synced 2024-12-26 01:27:07 +00:00
fix zimuku provider
This commit is contained in:
parent
d17e2645f9
commit
143b83ab3e
1 changed files with 18 additions and 2 deletions
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue