Spaces:
Runtime error
Runtime error
yiyixuxu
commited on
Commit
·
62cb8e9
1
Parent(s):
fd03f3a
clear cache for youtube-dl
Browse files
app.py
CHANGED
@@ -33,12 +33,18 @@ def select_video_format(url, format_note='480p', ext='mp4'):
|
|
33 |
return(format_id, fps)
|
34 |
|
35 |
def download_video(url,format_id):
|
|
|
|
|
36 |
ydl_opts = {
|
37 |
'format':format_id,
|
38 |
'outtmpl': "%(id)s.%(ext)s"}
|
39 |
-
|
40 |
-
|
41 |
-
|
|
|
|
|
|
|
|
|
42 |
|
43 |
def process_video_parallel(video, skip_frames, dest_path, num_processes, process_number):
|
44 |
cap = cv2.VideoCapture(video)
|
|
|
33 |
return(format_id, fps)
|
34 |
|
35 |
def download_video(url,format_id):
|
36 |
+
# testing
|
37 |
+
print(f"testing...all the files in local directory: {os.listdir('.')}")
|
38 |
ydl_opts = {
|
39 |
'format':format_id,
|
40 |
'outtmpl': "%(id)s.%(ext)s"}
|
41 |
+
with youtube_dl.YoutubeDL(ydl_opts) as ydl:
|
42 |
+
try:
|
43 |
+
ydl.cache.remove()
|
44 |
+
meta = ydl.extract_info(url)
|
45 |
+
save_location = meta['id'] + '.' + meta['ext']
|
46 |
+
except youtube_dl.DownloadError as error:
|
47 |
+
print(f'error with download_video function: {error}')
|
48 |
|
49 |
def process_video_parallel(video, skip_frames, dest_path, num_processes, process_number):
|
50 |
cap = cv2.VideoCapture(video)
|