Compare commits

..

No commits in common. "d022f43aa3c27ce0b7a58ba2bae8118f478d7cac" and "dfde209171a93edb0f36811cfdd7c73c7922d490" have entirely different histories.

2 changed files with 8 additions and 9 deletions

View File

@ -1,5 +1,5 @@
feedparser>=6.0.10
Mastodon.py==1.8.1
requests==2.31.0
Mastodon.py==1.8.0
requests==2.28.1
twint @ git+https://github.com/woluxwolu/twint.git
yt-dlp>=2023.3.4

View File

@ -22,17 +22,16 @@ def unredir(redir):
redir_count = redir_count + 1
if redir_count > 10:
break
location = r.headers.get('Location')
if 'go.france24.com' in redir:
# decoding hack in case "location" header is UTF-8 encoded (should not !)
location = location.encode("latin1").decode("utf-8")
if 'http' not in location:
redir = re.sub(r'(https?://[^/]*).*$', r'\1', redir) + location
if 'http' not in r.headers.get('Location'):
redir = re.sub(r'(https?://.*)/.*', r'\1', redir) + \
r.headers.get('Location')
else:
redir = location
redir = r.headers.get('Location')
# print('redir', redir)
if '//ow.ly/' in redir or '//bit.ly/' in redir:
redir = redir.replace('https://ow.ly/', 'http://ow.ly/') # only http
redir = requests.get(redir, allow_redirects=False).headers.get('Location')
# print('redir+', redir)
try:
r = requests.get(redir, allow_redirects=False, timeout=5)
except: