VideoCutter / app.py
GilbertClaus's picture
Update app.py
b3b0d73
raw
history blame
1.49 kB
import streamlit as st
from streamlit_option_menu import option_menu
from youtube import youtube
from pornhub import pornhub
from other import cut_video, session
# Navigasi Sidebar
options = ['Youtube', 'Pornhub', 'Iwara', 'Mega', 'Rule34', 'Trailer']
with st.sidebar:
selected = option_menu("Video Downloader", options,
icons=['play', 'fire', 'star', 'star', 'moon','gear', 'lightning'], menu_icon="cast", default_index=0)
functions = [yt_down, ph_down]
if selected:
index = options.index(selected)
fungsi = functions[index]
st.title(f"{selected} Video Downloader and Cutter")
st.write(f"Potong dan download sebagian video {selected}.")
video_link = st.text_input("Link Video", value='https://www.youtube.com/watch?v=ZGltvcmVSAk')
resolution = st.text_input("Resolusi", value='720')
cut = st.checkbox("Potong Video")
if cut:
start_time = st.text_input("Start Time", value='00:07:12.750')
end_time = st.text_input("End Time", value='00:09:31.000')
if st.button(f"Download and Cut {selected}"):
filename, judul_video, video_info = fungsi(video_link, resolution)
output_file_path = cut_video(filename, judul_video, start_time, end_time)
session(video_info, video_file, cut)
else:
if st.button(f"Download {selected}"):
video_info, video_file = yt_down(video_link, resolution, start_time, end_time)
session(video_info, video_file, cut)