mirror of
https://github.com/bellingcat/snscrape.git
synced 2026-06-12 12:28:28 +03:00
@@ -187,10 +187,10 @@ class TwitterAPIScraper(snscrape.base.Scraper):
|
|||||||
del self._apiHeaders['x-guest-token']
|
del self._apiHeaders['x-guest-token']
|
||||||
|
|
||||||
def _check_api_response(self, r):
|
def _check_api_response(self, r):
|
||||||
if r.status_code == 429:
|
if r.status_code in (403, 429):
|
||||||
self._unset_guest_token()
|
self._unset_guest_token()
|
||||||
self._ensure_guest_token()
|
self._ensure_guest_token()
|
||||||
return False, 'rate-limited'
|
return False, f'blocked ({r.status_code})'
|
||||||
if r.headers.get('content-type', '').replace(' ', '') != 'application/json;charset=utf-8':
|
if r.headers.get('content-type', '').replace(' ', '') != 'application/json;charset=utf-8':
|
||||||
return False, 'content type is not JSON'
|
return False, 'content type is not JSON'
|
||||||
if r.status_code != 200:
|
if r.status_code != 200:
|
||||||
|
|||||||
Reference in New Issue
Block a user