Omnibus commited on
Commit
eac0bb2
·
1 Parent(s): b99d9e0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -2
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 = round(msc)
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
- os.system(f'yt-dlp "{inp}" --extractor-arg "twitter:api=syndication" --trim-filenames 160 -o "{uid}/{inp_out}.mp4" -S res,mp4 --recode mp4')
 
 
 
 
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)