GilbertClaus commited on
Commit
7af36b7
·
1 Parent(s): aef07c6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -11
app.py CHANGED
@@ -5,27 +5,31 @@ from pornhub import ph_down
5
  from other import cut_video, session
6
 
7
  # Navigasi Sidebar
 
8
  with st.sidebar:
9
- selected = option_menu("Video Downloader", ['Youtube', 'Pornhub', 'Iwara', 'Mega', 'Rule34', 'Trailer'],
10
  icons=['play', 'fire', 'star', 'star', 'moon','gear', 'lightning'], menu_icon="cast", default_index=0)
11
 
12
- if selected == 'Youtube':
13
- st.title("YouTube Video Cutter")
14
- st.write("Potong dan download sebagian video YouTube.")
 
 
 
 
15
  video_link = st.text_input("Link Video", value='https://www.youtube.com/watch?v=ZGltvcmVSAk')
16
  resolution = st.text_input("Resolusi", value='720')
 
17
  cut = st.checkbox("Potong Video")
18
  if cut:
19
  start_time = st.text_input("Start Time", value='00:07:12.750')
20
  end_time = st.text_input("End Time", value='00:09:31.000')
21
 
22
- if st.button("Download and Cut Youtube"):
23
- filename, judul_video, video_info = yt_down(video_link, resolution)
24
- output_file_path = cut_video(filename, start_time, end_time)
25
  session(video_info, video_file, cut)
26
  else:
27
- if st.button("Download Youtube"):
28
  video_info, video_file = yt_down(video_link, resolution, start_time, end_time)
29
- session(video_info, video_file, cut)
30
-
31
-
 
5
  from other import cut_video, session
6
 
7
  # Navigasi Sidebar
8
+ options = ['Youtube', 'Pornhub', 'Iwara', 'Mega', 'Rule34', 'Trailer']
9
  with st.sidebar:
10
+ selected = option_menu("Video Downloader", options,
11
  icons=['play', 'fire', 'star', 'star', 'moon','gear', 'lightning'], menu_icon="cast", default_index=0)
12
 
13
+ functions = [yt_down, ph_down]
14
+
15
+ if selected:
16
+ index = options.index(selected)
17
+ fungsi = functions[index]
18
+ st.title(f"{selected} Video Downloader and Cutter")
19
+ st.write(f"Potong dan download sebagian video {selected}.")
20
  video_link = st.text_input("Link Video", value='https://www.youtube.com/watch?v=ZGltvcmVSAk')
21
  resolution = st.text_input("Resolusi", value='720')
22
+
23
  cut = st.checkbox("Potong Video")
24
  if cut:
25
  start_time = st.text_input("Start Time", value='00:07:12.750')
26
  end_time = st.text_input("End Time", value='00:09:31.000')
27
 
28
+ if st.button(f"Download and Cut {selected}"):
29
+ filename, judul_video, video_info = fungsi(video_link, resolution)
30
+ output_file_path = cut_video(filename, judul_video, start_time, end_time)
31
  session(video_info, video_file, cut)
32
  else:
33
+ if st.button(f"Download {selected}"):
34
  video_info, video_file = yt_down(video_link, resolution, start_time, end_time)
35
+ session(video_info, video_file, cut)