mirror of
https://github.com/cquest/tootbot.git
synced 2025-02-24 02:58:37 +00:00
Compare commits
No commits in common. "887474a1f33a46396f06ebfa0f45a873a05f81fe" and "79f922af2451b09c9cf23093ae8605dc47186f57" have entirely different histories.
887474a1f3
...
79f922af24
@ -17,11 +17,7 @@ import requests
|
|||||||
|
|
||||||
def unredir(redir):
|
def unredir(redir):
|
||||||
r = requests.get(redir, allow_redirects=False)
|
r = requests.get(redir, allow_redirects=False)
|
||||||
redir_count = 0
|
|
||||||
while r.status_code in {301, 302}:
|
while r.status_code in {301, 302}:
|
||||||
redir_count = redir_count + 1
|
|
||||||
if redir_count > 10:
|
|
||||||
break
|
|
||||||
if 'http' not in r.headers.get('Location'):
|
if 'http' not in r.headers.get('Location'):
|
||||||
redir = re.sub(r'(https?://.*)/.*', r'\1', redir) + \
|
redir = re.sub(r'(https?://.*)/.*', r'\1', redir) + \
|
||||||
r.headers.get('Location')
|
r.headers.get('Location')
|
||||||
@ -290,7 +286,7 @@ else:
|
|||||||
c = c.replace(l, '')
|
c = c.replace(l, '')
|
||||||
video = redir
|
video = redir
|
||||||
print('video:', video)
|
print('video:', video)
|
||||||
subprocess.run('rm -f out.mp4; yt-dlp -N 8 -o out.mp4 --recode-video mp4 --no-playlist %s --max-filesize 100M' %
|
subprocess.run('rm -f out.mp4; yt-dlp -N 8 -o out.mp4 --recode-video mp4 --no-playlist %s' %
|
||||||
(video,), shell=True, capture_output=False)
|
(video,), shell=True, capture_output=False)
|
||||||
print("received")
|
print("received")
|
||||||
try:
|
try:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user