Update app.py
Browse files
app.py
CHANGED
@@ -25,13 +25,13 @@ def clip(yt_url, start_timestamp, duration):
|
|
25 |
try:
|
26 |
ydl_opts["format"] = "22"
|
27 |
with yt_dlp.YoutubeDL(ydl_opts) as ydl:
|
28 |
-
ydl.download([
|
29 |
except Exception as e:
|
30 |
print(e)
|
31 |
ydl_opts["format"] = "bestvideo[height<=480][ext=mp4]+bestaudio[ext=m4a]/best[height<=480[ext=mp4]/best"
|
32 |
sleep(5)
|
33 |
with yt_dlp.YoutubeDL(ydl_opts) as ydl:
|
34 |
-
ydl.download([
|
35 |
clip_path = os.path.join(tmpdir, f"{uuid4()}.mp3")
|
36 |
subprocess.run(f'ffmpeg -ss {start_timestamp} -t {duration} -i "{video_output_path}" "{clip_path}"', shell=True)
|
37 |
return clip_path
|
|
|
25 |
try:
|
26 |
ydl_opts["format"] = "22"
|
27 |
with yt_dlp.YoutubeDL(ydl_opts) as ydl:
|
28 |
+
ydl.download([yt_url])
|
29 |
except Exception as e:
|
30 |
print(e)
|
31 |
ydl_opts["format"] = "bestvideo[height<=480][ext=mp4]+bestaudio[ext=m4a]/best[height<=480[ext=mp4]/best"
|
32 |
sleep(5)
|
33 |
with yt_dlp.YoutubeDL(ydl_opts) as ydl:
|
34 |
+
ydl.download([yt_url])
|
35 |
clip_path = os.path.join(tmpdir, f"{uuid4()}.mp3")
|
36 |
subprocess.run(f'ffmpeg -ss {start_timestamp} -t {duration} -i "{video_output_path}" "{clip_path}"', shell=True)
|
37 |
return clip_path
|