VideoCutter / app.py
GilangAlRusliadi
Yoi
2cf399d
raw
history blame
3.98 kB
import os
import streamlit as st
from streamlit_option_menu import option_menu
from youtube import youtube, download_youtube
from pornhub import pornhub
from iwara import iwara
# from megaDL import mega_dl
from rule34 import rule34
from paipancon import paipancon
from trailer import trailer
from others import *
# Navigasi Sidebar
options = ['Youtube', 'Pornhub (Not Work)', 'Iwara (Not Work)', '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, iwara, download_youtube, rule34, paipancon, trailer]
if selected:
index = options.index(selected)
fungsi = functions[index]
st.title(f"{selected} Video Downloader and Cutter")
st.write(f"Download dan potong sebagian video {selected}.")
if selected == 'Youtube' or selected == 'Pornhub':
video_link = st.text_input("Link Video", value='https://www.youtube.com/watch?v=ZGltvcmVSAk')
resolution = st.selectbox("Pilih Resolusi", (360, 480, 720), 2)
elif selected == 'Iwara' or selected == 'Mega':
name = st.text_input("Nama File")
video_link = st.text_input("Link Video")
else:
video_link = st.text_input("Link Video")
choice = st.radio('Pilih Proses:', ['Potong Video', 'Compress Video', 'Cuma Download'], 2)
if choice == 'Potong Video':
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}"):
if selected == 'Youtube' or selected == 'Pornhub':
video_file, judul_video, video_info, thumbnail_file = fungsi(video_link, resolution)
elif selected == 'Iwara' or selected == 'Mega':
video_file, judul_video, video_info, thumbnail_file = fungsi(video_link, name)
else:
video_file, judul_video, video_info, thumbnail_file = fungsi(video_link)
video_file = cut_video(video_file, judul_video, start_time, end_time)
file_size = os.path.getsize(video_file)
session(video_info, video_file, thumbnail_file, choice)
st.text_input(f"Video '{judul_video}' setelah diproses:", convert_size(file_size))
elif choice == 'Compress Video':
compress = st.selectbox("Pilih Resolusi Compress", (360, 480, 720), 2)
if st.button(f"Download and Compress {selected}"):
if selected == 'Youtube' or selected == 'Pornhub':
video_file, judul_video, video_info, thumbnail_file = fungsi(video_link, resolution)
elif selected == 'Iwara' or selected == 'Mega':
video_file, judul_video, video_info, thumbnail_file = fungsi(video_link, name)
else:
video_file, judul_video, video_info, thumbnail_file = fungsi(video_link)
video_file = convert_videos(compress, video_file)
file_size = os.path.getsize(video_file)
session(video_info, video_file, thumbnail_file, choice)
st.text_input(f"Video '{judul_video}' setelah diproses:", convert_size(file_size))
else:
if st.button(f"Download {selected}"):
if selected == 'Youtube' or selected == 'Pornhub':
video_file, judul_video, video_info, thumbnail_file = fungsi(video_link, resolution)
elif selected == 'Iwara' or selected == 'Mega':
video_file, judul_video, video_info, thumbnail_file = fungsi(video_link, name)
else:
video_file, judul_video, video_info, thumbnail_file = fungsi(video_link)
file_size = os.path.getsize(video_file)
session(video_info, video_file, thumbnail_file, choice)
st.text_input(f"Video '{judul_video}' setelah diproses:", convert_size(file_size))