Improved RegieLive.ro to not get throttled when there are no results (#1293)

pull/1297/head
Bogdan Ilisei 4 years ago committed by GitHub
parent ef8c4a43d4
commit d0f50a2e99
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -120,11 +120,11 @@ class RegieLiveProvider(Provider):
payload['an'] = video.year payload['an'] = video.year
response = self.session.post(self.url, data=payload, headers=self.headers) response = self.session.post(self.url, data=payload, headers=self.headers)
logger.info(response.json()) logger.info(response.json())
response_json = response.json()['rezultate']
subtitles = [] subtitles = []
if not 'eroare' in response_json: if response.json()['cod'] == '200':
for film in response_json: results_subs = response.json()['rezultate']
for sub in response_json[film]['subtitrari']: for film in results_subs:
for sub in results_subs[film]['subtitrari']:
logger.debug(sub) logger.debug(sub)
subtitles.append( subtitles.append(
RegieLiveSubtitle(sub['titlu'], video, sub['url'], sub['rating'], language) RegieLiveSubtitle(sub['titlu'], video, sub['url'], sub['rating'], language)

Loading…
Cancel
Save