Fix problem due to invalid headers from t.co

This commit is contained in:
Felix Ableitner 2018-12-18 19:49:29 +01:00
parent ac1e01fda1
commit 7f47fe95c5

View file

@ -87,7 +87,7 @@ for t in reversed(d.entries[0:5]):
m = re.search(r"http[^ \xa0]*", c) m = re.search(r"http[^ \xa0]*", c)
if m != None: if m != None:
l = m.group(0) l = m.group(0)
r = requests.get(l, allow_redirects=False) r = requests.get(l, allow_redirects=False, headers={'Accept-Encoding': 'identity'})
if r.status_code in {301,302}: if r.status_code in {301,302}:
c = c.replace(l,r.headers.get('Location')) c = c.replace(l,r.headers.get('Location'))