add uploader member variable to subtitle class

Add uploader member variable to subtitle class and update subssabbz, subsunacs and yavkanet to retrieve the uplader username.
pull/876/head
josdion 4 years ago
parent 03b181701e
commit e09d84e09c

@ -132,7 +132,7 @@ class SubsSabBzProvider(Provider):
logger.debug('No subtitles found')
return subtitles
soup = BeautifulSoup(response.content, 'html.parser')
soup = BeautifulSoup(response.content, 'lxml')
rows = soup.findAll('tr', {'class': 'subs-row'})
# Search on first 20 rows only
@ -142,8 +142,12 @@ class SubsSabBzProvider(Provider):
element = a_element_wrapper.find('a')
if element:
link = element.get('href')
element = row.find('a', href = re.compile(r'.*showuser=.*'))
uploader = element.get_text() if element else None
logger.info('Found subtitle link %r', link)
subtitles = subtitles + self.download_archive_and_add_subtitle_files(link, language, video)
for s in subtitles:
s.uploader = uploader
return subtitles

@ -135,16 +135,22 @@ class SubsUnacsProvider(Provider):
logger.debug('No subtitles found')
return subtitles
soup = BeautifulSoup(response.content, 'html.parser')
rows = soup.findAll('td', {'class': 'tdMovie'})
soup = BeautifulSoup(response.content, 'lxml')
rows = soup.findAll('tr', onmouseover=True)
# Search on first 20 rows only
for row in rows[:20]:
element = row.find('a', {'class': 'tooltip'})
if element:
link = element.get('href')
logger.info('Found subtitle link %r', link)
subtitles = subtitles + self.download_archive_and_add_subtitle_files('https://subsunacs.net' + link, language, video)
a_element_wrapper = row.find('td', {'class': 'tdMovie'})
if a_element_wrapper:
element = a_element_wrapper.find('a', {'class': 'tooltip'})
if element:
link = element.get('href')
element = row.find('a', href = re.compile(r'.*/search\.php\?t=1\&memid=.*'))
uploader = element.get_text() if element else None
logger.info('Found subtitle link %r', link)
subtitles = subtitles + self.download_archive_and_add_subtitle_files('https://subsunacs.net' + link, language, video)
for s in subtitles:
s.uploader = uploader
return subtitles

@ -121,7 +121,7 @@ class YavkaNetProvider(Provider):
logger.debug('No subtitles found')
return subtitles
soup = BeautifulSoup(response.content, 'html.parser')
soup = BeautifulSoup(response.content, 'lxml')
rows = soup.findAll('tr', {'class': 'info'})
# Search on first 20 rows only
@ -129,8 +129,12 @@ class YavkaNetProvider(Provider):
element = row.find('a', {'class': 'selector'})
if element:
link = element.get('href')
element = row.find('a', {'class': 'click'})
uploader = element.get_text() if element else None
logger.info('Found subtitle link %r', link)
subtitles = subtitles + self.download_archive_and_add_subtitle_files('http://yavka.net/' + link, language, video)
for s in subtitles:
s.uploader = uploader
return subtitles

@ -54,6 +54,7 @@ class Subtitle(Subtitle_):
is_pack = False
asked_for_release_group = None
asked_for_episode = None
uploader = None # string - uploader username
pack_data = None
_guessed_encoding = None

Loading…
Cancel
Save