Fix crash on rare weird 503 responses from Twitter without content

This commit is contained in:
JustAnotherArchivist
2021-01-26 22:39:02 +00:00
parent 0121fa51c2
commit 5cd3b7d7cc

View File

@@ -207,7 +207,7 @@ class TwitterAPIScraper(snscrape.base.Scraper):
self._unset_guest_token()
self._ensure_guest_token()
return False, 'rate-limited'
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'
if r.status_code != 200:
return False, 'non-200 status code'