From 6d082f8b388341ce70dfb647efb88b0964651f4b Mon Sep 17 00:00:00 2001 From: morpheus65535 Date: Tue, 21 Sep 2021 13:50:49 -0400 Subject: [PATCH] Fixed issue with movies on Addic7ed. #1550 --- libs/subliminal_patch/providers/addic7ed.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/libs/subliminal_patch/providers/addic7ed.py b/libs/subliminal_patch/providers/addic7ed.py index 2ff04afdf..71f840d9d 100644 --- a/libs/subliminal_patch/providers/addic7ed.py +++ b/libs/subliminal_patch/providers/addic7ed.py @@ -249,8 +249,12 @@ class Addic7edProvider(_Addic7edProvider): for item in movies: link = item.find('a', href=True) if link: - type, media_id = link['href'].split('/') - if type == 'movie': + if link['href'].startswith('movie/'): + splitted_uri = link['href'].split('/') + if len(splitted_uri) == 2: + media_id = splitted_uri[1] + else: + continue media_title = link.text match = re.search(r'(.+)\s\((\d{4})\)$', media_title) if match: @@ -492,7 +496,10 @@ class Addic7edProvider(_Addic7edProvider): page_link = self.server_url + 'movie/' + movie_id version_matches = re.search(r'Version\s(.+),.+', str(row1.contents[1].contents[1])) version = version_matches.group(1) if version_matches else None - download_link = row2.contents[8].contents[2].attrs['href'][1:] + try: + download_link = row2.contents[8].contents[3].attrs['href'][1:] + except IndexError: + download_link = row2.contents[8].contents[2].attrs['href'][1:] uploader = row1.contents[2].contents[8].text.strip() # set subtitle language to hi if it's hearing_impaired