From f6c6e90fedfe774ef06347c5cd50bd4434c8d62f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Louis=20V=C3=A9zina?= <5130500+morpheus65535@users.noreply.github.com> Date: Mon, 6 Jul 2020 12:38:18 -0400 Subject: [PATCH] Fix for #913 (subs4free only) --- libs/subliminal_patch/providers/subs4free.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/libs/subliminal_patch/providers/subs4free.py b/libs/subliminal_patch/providers/subs4free.py index 033ff664e..c3a77fdb3 100644 --- a/libs/subliminal_patch/providers/subs4free.py +++ b/libs/subliminal_patch/providers/subs4free.py @@ -30,12 +30,14 @@ class Subs4FreeSubtitle(Subtitle): """Subs4Free Subtitle.""" provider_name = 'subs4free' - def __init__(self, language, page_link, title, year, version, download_link): + def __init__(self, language, page_link, title, year, version, download_link, uploader): super(Subs4FreeSubtitle, self).__init__(language, page_link=page_link) self.title = title self.year = year self.version = version + self.release_info = version self.download_link = download_link + self.uploader = uploader self.hearing_impaired = None self.encoding = 'utf8' @@ -71,8 +73,8 @@ class Subs4FreeProvider(Provider): """Subs4Free Provider.""" languages = {Language(l) for l in ['ell', 'eng']} video_types = (Movie,) - server_url = 'https://www.sf4-industry.com' - download_url = '/getSub.html' + server_url = 'https://www.subs4free.info' + download_url = '/getSub.php' search_url = '/search_report.php?search={}&searchType=1' anti_block_1 = 'https://images.subs4free.info/favicon.ico' anti_block_2 = 'https://www.subs4series.com/includes/anti-block-layover.php?launch=1' @@ -171,13 +173,15 @@ class Subs4FreeProvider(Provider): subtitles = [] # loop over episode rows - for subs_tag in soup.select('table .seeDark,.seeMedium'): + for subs_tag in soup.select('.movie-details'): # read common info - version = subs_tag.find('b').text + version = subs_tag.find('span').text download_link = self.server_url + subs_tag.find('a')['href'] - language = Language.fromalpha2(subs_tag.find('img')['src'].split('/')[-1].split('.')[0]) + uploader = subs_tag.select_one('.movie-info').find('p').find('a').text + language_code = subs_tag.select_one('.sprite')['class'][1].split('gif')[0] + language = Language.fromietf(language_code) - subtitle = self.subtitle_class(language, page_link, show_title, year, version, download_link) + subtitle = self.subtitle_class(language, page_link, show_title, year, version, download_link, uploader) logger.debug('Found subtitle {!r}'.format(subtitle)) subtitles.append(subtitle)