Check HTTP status code before attempting parsing

This commit is contained in:
JustAnotherArchivist
2019-06-27 15:25:26 +00:00
parent fae7432c64
commit eec83f181e

View File

@@ -80,6 +80,8 @@ class InstagramCommonScraper(snscrape.base.Scraper):
return True, None
def _check_json_callback(self, r):
if r.status_code != 200:
return False, f'status code {r.status_code}'
try:
obj = json.loads(r.text)
except json.JSONDecodeError as e: