Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -34,7 +34,7 @@ def load_video(vid):
|
|
34 |
frame_count = int(capture.get(cv2.CAP_PROP_FRAME_COUNT))
|
35 |
msc = float(frame_count/fps)
|
36 |
capture.release()
|
37 |
-
vid_t =
|
38 |
hours = int(vid_t/360)
|
39 |
minutes = int(vid_t/60)-(hours*360)
|
40 |
seconds = vid_t-(minutes*60)-(hours*360)
|
@@ -63,7 +63,11 @@ def dl(inp,img):
|
|
63 |
try:
|
64 |
inp_out=inp.replace("https://","")
|
65 |
inp_out=inp_out.replace("/","_").replace(".","_").replace("=","_").replace("?","_")
|
66 |
-
|
|
|
|
|
|
|
|
|
67 |
out = f"{uid}/{inp_out}.mp4"
|
68 |
capture = cv2.VideoCapture(out)
|
69 |
fps = capture.get(cv2.CAP_PROP_FPS)
|
|
|
34 |
frame_count = int(capture.get(cv2.CAP_PROP_FRAME_COUNT))
|
35 |
msc = float(frame_count/fps)
|
36 |
capture.release()
|
37 |
+
vid_t = int(msc)
|
38 |
hours = int(vid_t/360)
|
39 |
minutes = int(vid_t/60)-(hours*360)
|
40 |
seconds = vid_t-(minutes*60)-(hours*360)
|
|
|
63 |
try:
|
64 |
inp_out=inp.replace("https://","")
|
65 |
inp_out=inp_out.replace("/","_").replace(".","_").replace("=","_").replace("?","_")
|
66 |
+
if "twitter" in inp:
|
67 |
+
os.system(f'yt-dlp "{inp}" --extractor-arg "twitter:api=syndication" --trim-filenames 160 -o "{uid}/{inp_out}.mp4" -S res,mp4 --recode mp4')
|
68 |
+
else:
|
69 |
+
os.system(f'yt-dlp "{inp}" --trim-filenames 160 -o "{uid}/{inp_out}.mp4" -S res,mp4 --recode mp4')
|
70 |
+
|
71 |
out = f"{uid}/{inp_out}.mp4"
|
72 |
capture = cv2.VideoCapture(out)
|
73 |
fps = capture.get(cv2.CAP_PROP_FPS)
|