mirror of
https://github.com/bellingcat/snscrape.git
synced 2026-06-12 12:28:28 +03:00
Check HTTP status code before attempting parsing
This commit is contained in:
@@ -80,6 +80,8 @@ class InstagramCommonScraper(snscrape.base.Scraper):
|
|||||||
return True, None
|
return True, None
|
||||||
|
|
||||||
def _check_json_callback(self, r):
|
def _check_json_callback(self, r):
|
||||||
|
if r.status_code != 200:
|
||||||
|
return False, f'status code {r.status_code}'
|
||||||
try:
|
try:
|
||||||
obj = json.loads(r.text)
|
obj = json.loads(r.text)
|
||||||
except json.JSONDecodeError as e:
|
except json.JSONDecodeError as e:
|
||||||
|
|||||||
Reference in New Issue
Block a user