Skip to content

Commit

Permalink
Fixed yavka.net subtitles search since they've modified the website. #…
Browse files Browse the repository at this point in the history
  • Loading branch information
morpheus65535 committed Aug 12, 2023
1 parent 403386c commit cce1be4
Showing 1 changed file with 6 additions and 23 deletions.
29 changes: 6 additions & 23 deletions libs/subliminal_patch/providers/yavkanet.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,32 +122,15 @@ def terminate(self):
def query(self, language, video):
subtitles = []
isEpisode = isinstance(video, Episode)
params = {
's': '',
'y': '',
'u': '',
'l': 'BG',
'i': ''
}

if isEpisode:
params['s'] = "%s s%02de%02d" % (sanitize(fix_tv_naming(video.series), {'\''}), video.season, video.episode)
imdb_id = video.series_imdb_id
else:
params['y'] = video.year
params['s'] = sanitize(fix_movie_naming(video.title), {'\''})

if language == 'en' or language == 'eng':
params['l'] = 'EN'
elif language == 'ru' or language == 'rus':
params['l'] = 'RU'
elif language == 'es' or language == 'spa':
params['l'] = 'ES'
elif language == 'it' or language == 'ita':
params['l'] = 'IT'

logger.info('Searching subtitle %r', params)
response = self.retry(self.session.get('https://yavka.net/subtitles.php', params=params, allow_redirects=False,
timeout=10, headers={'Referer': 'https://yavka.net/'}))
imdb_id = video.imdb_id

logger.info(f'Searching subtitle for {imdb_id}')
response = self.retry(self.session.get(f'https://yavka.net/imdb/{imdb_id}', timeout=10,
headers={'Referer': 'https://yavka.net/'}))
if not response:
return subtitles
response.raise_for_status()
Expand Down

0 comments on commit cce1be4

Please sign in to comment.