Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -31,24 +31,43 @@ def download_video(url, progress_bar, status_text):
|
|
31 |
'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:122.0) Gecko/20100101 Firefox/122.0'
|
32 |
]
|
33 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
ydl_opts = {
|
35 |
'format': 'best',
|
36 |
'outtmpl': str(output_dir / '%(title)s.%(ext)s'),
|
37 |
'quiet': True,
|
38 |
'no_warnings': True,
|
39 |
-
# 쿠키 파일 설정
|
40 |
'cookiefile': 'youtube.com_cookies.txt',
|
41 |
'user_agent': random.choice(user_agents),
|
42 |
'referer': 'https://www.youtube.com/',
|
43 |
'http_chunk_size': random.randint(10000000, 15000000),
|
44 |
-
'retries':
|
45 |
-
'sleep_interval':
|
46 |
-
'max_sleep_interval':
|
|
|
47 |
'headers': {
|
48 |
'Accept-Language': 'en-US,en;q=0.9',
|
49 |
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
|
50 |
-
}
|
51 |
}
|
|
|
52 |
|
53 |
def progress_hook(d):
|
54 |
if d['status'] == 'downloading':
|
|
|
31 |
'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:122.0) Gecko/20100101 Firefox/122.0'
|
32 |
]
|
33 |
|
34 |
+
# ydl_opts = {
|
35 |
+
# 'format': 'best',
|
36 |
+
# 'outtmpl': str(output_dir / '%(title)s.%(ext)s'),
|
37 |
+
# 'quiet': True,
|
38 |
+
# 'no_warnings': True,
|
39 |
+
# # 쿠키 파일 설정
|
40 |
+
# 'cookiefile': 'youtube.com_cookies.txt',
|
41 |
+
# 'user_agent': random.choice(user_agents),
|
42 |
+
# 'referer': 'https://www.youtube.com/',
|
43 |
+
# 'http_chunk_size': random.randint(10000000, 15000000),
|
44 |
+
# 'retries': 3,
|
45 |
+
# 'sleep_interval': 1,
|
46 |
+
# 'max_sleep_interval': 5,
|
47 |
+
# 'headers': {
|
48 |
+
# 'Accept-Language': 'en-US,en;q=0.9',
|
49 |
+
# 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
|
50 |
+
# }
|
51 |
+
# }
|
52 |
ydl_opts = {
|
53 |
'format': 'best',
|
54 |
'outtmpl': str(output_dir / '%(title)s.%(ext)s'),
|
55 |
'quiet': True,
|
56 |
'no_warnings': True,
|
|
|
57 |
'cookiefile': 'youtube.com_cookies.txt',
|
58 |
'user_agent': random.choice(user_agents),
|
59 |
'referer': 'https://www.youtube.com/',
|
60 |
'http_chunk_size': random.randint(10000000, 15000000),
|
61 |
+
'retries': 1,
|
62 |
+
'sleep_interval': 3,
|
63 |
+
'max_sleep_interval': 8,
|
64 |
+
'proxy': 'http://your_proxy_address:port', # Optional: Set up if proxy is available
|
65 |
'headers': {
|
66 |
'Accept-Language': 'en-US,en;q=0.9',
|
67 |
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
|
68 |
+
},
|
69 |
}
|
70 |
+
|
71 |
|
72 |
def progress_hook(d):
|
73 |
if d['status'] == 'downloading':
|