Merge pull request #1043 from gyh1621/development

fix zimuku provider
pull/1055/head
morpheus65535 4 years ago committed by GitHub
commit 71a716af01
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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…
Cancel
Save