diff --git a/app/downloaders/series_sites/zonetelechargement.py b/app/downloaders/series_sites/zonetelechargement.py index ec2706d..3906f91 100644 --- a/app/downloaders/series_sites/zonetelechargement.py +++ b/app/downloaders/series_sites/zonetelechargement.py @@ -135,26 +135,29 @@ class ZoneTelechargementDownloader(BaseSeriesSite): soup = BeautifulSoup(html, "lxml") episodes = [] + seen_urls = set() - # ZT typically lists episodes in a table or list of links - # Links often look like: /telecharger-series/.../saison-X-episode-Y.html - links = soup.find_all("a", href=re.compile(r"episode-\d+")) + # ZT lists episodes as tags inside inside div.postinfo + # Text matches "Episode X" pattern, URLs go through dl-protect + for link in soup.find_all("a"): + text = link.get_text(strip=True) + ep_match = re.search(r"episode\s*(\d+)", text, re.I) + if not ep_match: + continue - for i, link in enumerate(links): href = link.get("href", "") - if not href.startswith("http"): - href = urljoin(self.base_url, href) - - title = link.get_text(strip=True) - ep_match = re.search(r"episode\s*(\d+)", title.lower()) - ep_number = int(ep_match.group(1)) if ep_match else i + 1 + if not href or href in seen_urls: + continue + seen_urls.add(href) + ep_number = int(ep_match.group(1)) episodes.append( - {"episode_number": ep_number, "url": href, "title": title} + {"episode_number": ep_number, "url": href, "title": text} ) # Sort by episode number episodes.sort(key=lambda x: x["episode_number"]) + logger.info(f"Found {len(episodes)} episodes on {anime_url}") return episodes except Exception as e: diff --git a/templates/components/anime_search_results.html b/templates/components/anime_search_results.html index cae0c70..5f187da 100644 --- a/templates/components/anime_search_results.html +++ b/templates/components/anime_search_results.html @@ -82,13 +82,12 @@ Saison complete -
-