Spaces:
Paused
Paused
File size: 1,819 Bytes
c6ab2d5 8069ca7 b3b0d73 df9c165 b3fc5a1 70d1319 9b10cd0 70d1319 7af36b7 529af5e 8069ca7 9b86cb6 7af36b7 8f7e782 ab547c1 7af36b7 19f3a65 df9c165 70d1319 7af36b7 454b6b9 df9c165 19f3a65 e2c8e49 19f3a65 7af36b7 454b6b9 df9c165 cfc9106 e2c8e49 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | import os
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, convert_size
# Navigasi Sidebar
options = ['Youtube', 'Pornhub', 'Iwara', 'Mega', 'Rule34', 'Paipancon', 'Trailer']
with st.sidebar:
selected = option_menu("Video Downloader", options,
icons=['play', 'fire', 'star', 'moon','gear', 'house', 'lightning'], menu_icon="cast", default_index=0)
functions = [youtube, pornhub]
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.selectbox("Pilih Resolusi", (360, 480, 720), 2)
cut = st.checkbox("Potong Video")
if cut:
start_time = st.text_input("Start Time", value='00:07:12.000')
end_time = st.text_input("End Time", value='00:07:31.000')
if st.button(f"Download and Cut {selected}"):
video_file, judul_video, video_info = fungsi(video_link, resolution)
video_file = cut_video(video_file, judul_video, start_time, end_time)
file_size = os.path.getsize(video_file)
session(video_info, video_file, cut)
st.text_area(f"Video '{judul_video}' setelah diproses:", convert_size(file_size))
else:
if st.button(f"Download {selected}"):
video_file, judul_video, video_info = fungsi(video_link, resolution)
file_size = os.path.getsize(video_file)
session(video_info, video_file, cut)
st.text_area(f"Video '{judul_video}' setelah diproses:", convert_size(file_size)) |