From fd1809a1a71739faed5bf7f83fd4e48113d69759 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A0=D1=83=D1=81=D1=82=D0=B5=D0=BC=20=D0=93=D0=B0=D0=BB?= =?UTF-8?q?=D0=B8=D0=B0=D0=BA=D0=B1=D0=B5=D1=80=D0=BE=D0=B2?= Date: Wed, 17 Jul 2024 22:55:22 +0300 Subject: [PATCH] fix lostfilm --- monitorrent/plugins/trackers/lostfilm.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/monitorrent/plugins/trackers/lostfilm.py b/monitorrent/plugins/trackers/lostfilm.py index 036619aa..501b85f7 100644 --- a/monitorrent/plugins/trackers/lostfilm.py +++ b/monitorrent/plugins/trackers/lostfilm.py @@ -625,7 +625,19 @@ def parse_download(table): **self.tracker_settings.get_requests_kwargs()) soup = get_soup(download_page.text) - return list(map(parse_download, soup.find_all('div', class_='inner-box--item'))) + table = soup.find_all('div', class_='inner-box--item') + if len(table) == 0: + def a_href(tag): + return tag.name == 'a' and tag.has_attr('href') and tag.attrs['href'] != '/' + next_path = soup.find(a_href).attrs['href'] + url_parts = urlparse(download_page_url) + new_url_pattern = '{scheme}://{netloc}{path}' + download_page_url = new_url_pattern.format(scheme=url_parts.scheme, netloc=url_parts.netloc, path=next_path) + download_page = session.get(download_page_url, headers=self.headers, cookies=self.get_cookies(), + **self.tracker_settings.get_requests_kwargs()) + soup = get_soup(download_page.text) + table = soup.find_all('div', class_='inner-box--item') + return list(map(parse_download, table)) def replace_domain(self, url): url_parts = urlparse(url)