Fix problem due to invalid headers from t.co
This commit is contained in:
parent
ac1e01fda1
commit
7f47fe95c5
1 changed files with 1 additions and 1 deletions
|
@ -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'))
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue