Update app.py
Browse files
app.py
CHANGED
|
@@ -3,6 +3,7 @@ import yt_dlp
|
|
| 3 |
import gradio as gr
|
| 4 |
import subprocess
|
| 5 |
from uuid import uuid4
|
|
|
|
| 6 |
from tempfile import TemporaryDirectory
|
| 7 |
|
| 8 |
cachedir = ".cache"
|
|
@@ -25,7 +26,8 @@ def clip(yt_url, start_timestamp, duration):
|
|
| 25 |
ydl_opts["format"] = "22"
|
| 26 |
with yt_dlp.YoutubeDL(ydl_opts) as ydl:
|
| 27 |
ydl.download([video_url])
|
| 28 |
-
except:
|
|
|
|
| 29 |
ydl_opts["format"] = "bestvideo[height<=480][ext=mp4]+bestaudio[ext=m4a]/best[height<=480[ext=mp4]/best"
|
| 30 |
sleep(5)
|
| 31 |
with yt_dlp.YoutubeDL(ydl_opts) as ydl:
|
|
|
|
| 3 |
import gradio as gr
|
| 4 |
import subprocess
|
| 5 |
from uuid import uuid4
|
| 6 |
+
from time import sleep
|
| 7 |
from tempfile import TemporaryDirectory
|
| 8 |
|
| 9 |
cachedir = ".cache"
|
|
|
|
| 26 |
ydl_opts["format"] = "22"
|
| 27 |
with yt_dlp.YoutubeDL(ydl_opts) as ydl:
|
| 28 |
ydl.download([video_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:
|