Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -20,18 +20,32 @@ video_url = st.text_input("Enter YouTube Video URL:", placeholder="https://www.y
|
|
20 |
# Function to download video
|
21 |
def download_video(url):
|
22 |
try:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
ydl_opts = {
|
24 |
'format': 'bestvideo+bestaudio/best',
|
25 |
'outtmpl': str(output_dir / '%(title)s.%(ext)s'),
|
26 |
'merge_output_format': 'webm',
|
27 |
-
# Add these options to mimic browser behavior
|
28 |
'quiet': True,
|
29 |
'no_warnings': True,
|
30 |
'user_agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36',
|
31 |
'referer': 'https://www.youtube.com/',
|
32 |
-
'cookiefile': 'youtube.com_cookies.txt',
|
33 |
'socket_timeout': 30,
|
34 |
-
'http_chunk_size': 10485760,
|
|
|
35 |
}
|
36 |
|
37 |
# Progress placeholder
|
|
|
20 |
# Function to download video
|
21 |
def download_video(url):
|
22 |
try:
|
23 |
+
# ydl_opts = {
|
24 |
+
# 'format': 'bestvideo+bestaudio/best',
|
25 |
+
# 'outtmpl': str(output_dir / '%(title)s.%(ext)s'),
|
26 |
+
# 'merge_output_format': 'webm',
|
27 |
+
# # Add these options to mimic browser behavior
|
28 |
+
# 'quiet': True,
|
29 |
+
# 'no_warnings': True,
|
30 |
+
# 'user_agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36',
|
31 |
+
# 'referer': 'https://www.youtube.com/',
|
32 |
+
# 'cookiefile': 'youtube.com_cookies.txt', # 쿠키 파일 사용
|
33 |
+
# 'socket_timeout': 30,
|
34 |
+
# 'http_chunk_size': 10485760, # 10MB
|
35 |
+
# }
|
36 |
+
|
37 |
ydl_opts = {
|
38 |
'format': 'bestvideo+bestaudio/best',
|
39 |
'outtmpl': str(output_dir / '%(title)s.%(ext)s'),
|
40 |
'merge_output_format': 'webm',
|
|
|
41 |
'quiet': True,
|
42 |
'no_warnings': True,
|
43 |
'user_agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36',
|
44 |
'referer': 'https://www.youtube.com/',
|
45 |
+
'cookiefile': 'youtube.com_cookies.txt',
|
46 |
'socket_timeout': 30,
|
47 |
+
'http_chunk_size': 10485760,
|
48 |
+
'retries': 5, # Set higher retries if encountering errors
|
49 |
}
|
50 |
|
51 |
# Progress placeholder
|