From d0f50a2e99d8e13e3ab0c406f26e7ebfa0d3cf95 Mon Sep 17 00:00:00 2001 From: Bogdan Ilisei Date: Thu, 25 Feb 2021 13:37:03 +0200 Subject: [PATCH] Improved RegieLive.ro to not get throttled when there are no results (#1293) --- libs/subliminal_patch/providers/regielive.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libs/subliminal_patch/providers/regielive.py b/libs/subliminal_patch/providers/regielive.py index bc8a0ded9..706ba0e46 100644 --- a/libs/subliminal_patch/providers/regielive.py +++ b/libs/subliminal_patch/providers/regielive.py @@ -120,11 +120,11 @@ class RegieLiveProvider(Provider): payload['an'] = video.year response = self.session.post(self.url, data=payload, headers=self.headers) logger.info(response.json()) - response_json = response.json()['rezultate'] subtitles = [] - if not 'eroare' in response_json: - for film in response_json: - for sub in response_json[film]['subtitrari']: + if response.json()['cod'] == '200': + results_subs = response.json()['rezultate'] + for film in results_subs: + for sub in results_subs[film]['subtitrari']: logger.debug(sub) subtitles.append( RegieLiveSubtitle(sub['titlu'], video, sub['url'], sub['rating'], language)