Spaces:
Sleeping
Sleeping
Commit ·
31ed2a8
1
Parent(s): b62586b
Update app.py
Browse files
app.py
CHANGED
|
@@ -2,77 +2,54 @@ import os
|
|
| 2 |
import streamlit as st
|
| 3 |
from streamlit_option_menu import option_menu
|
| 4 |
from youtube import youtube, download_youtube
|
| 5 |
-
from pornhub import pornhub
|
| 6 |
-
from iwara import iwara
|
| 7 |
-
# from megaDL import mega_dl
|
| 8 |
-
from rule34 import rule34
|
| 9 |
-
from paipancon import paipancon
|
| 10 |
-
from trailer import trailer
|
| 11 |
from others import *
|
| 12 |
|
| 13 |
# Navigasi Sidebar
|
| 14 |
-
options = ['Youtube'
|
| 15 |
with st.sidebar:
|
| 16 |
selected = option_menu("Video Downloader", options,
|
| 17 |
-
icons=['play'
|
| 18 |
|
| 19 |
-
functions = [youtube
|
| 20 |
|
| 21 |
if selected:
|
| 22 |
index = options.index(selected)
|
| 23 |
fungsi = functions[index]
|
| 24 |
st.title(f"{selected} Video Downloader and Cutter")
|
| 25 |
-
st.write(f"Download
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
resolution = st.selectbox("Pilih Resolusi", (360, 480, 720), 2)
|
| 29 |
-
elif selected == 'Iwara' or selected == 'Mega':
|
| 30 |
-
name = st.text_input("Nama File")
|
| 31 |
-
video_link = st.text_input("Link Video")
|
| 32 |
-
else:
|
| 33 |
-
video_link = st.text_input("Link Video")
|
| 34 |
|
| 35 |
-
choice = st.radio('
|
| 36 |
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
video_file, judul_video, video_info, thumbnail_file = fungsi(video_link)
|
| 48 |
video_file = cut_video(video_file, judul_video, start_time, end_time)
|
| 49 |
file_size = os.path.getsize(video_file)
|
| 50 |
session(video_info, video_file, thumbnail_file, choice)
|
| 51 |
-
st.text_input(f"Video '{judul_video}'
|
| 52 |
|
| 53 |
elif choice == 'Compress Video':
|
| 54 |
-
compress = st.selectbox("
|
| 55 |
|
| 56 |
if st.button(f"Download and Compress {selected}"):
|
| 57 |
-
|
| 58 |
-
video_file, judul_video, video_info, thumbnail_file = fungsi(video_link, resolution)
|
| 59 |
-
elif selected == 'Iwara' or selected == 'Mega':
|
| 60 |
-
video_file, judul_video, video_info, thumbnail_file = fungsi(video_link, name)
|
| 61 |
-
else:
|
| 62 |
-
video_file, judul_video, video_info, thumbnail_file = fungsi(video_link)
|
| 63 |
video_file = convert_videos(compress, video_file)
|
| 64 |
file_size = os.path.getsize(video_file)
|
| 65 |
session(video_info, video_file, thumbnail_file, choice)
|
| 66 |
-
st.text_input(f"Video '{judul_video}'
|
| 67 |
|
| 68 |
else:
|
| 69 |
if st.button(f"Download {selected}"):
|
| 70 |
-
|
| 71 |
-
video_file, judul_video, video_info, thumbnail_file = fungsi(video_link, resolution)
|
| 72 |
-
elif selected == 'Iwara' or selected == 'Mega':
|
| 73 |
-
video_file, judul_video, video_info, thumbnail_file = fungsi(video_link, name)
|
| 74 |
-
else:
|
| 75 |
-
video_file, judul_video, video_info, thumbnail_file = fungsi(video_link)
|
| 76 |
file_size = os.path.getsize(video_file)
|
| 77 |
session(video_info, video_file, thumbnail_file, choice)
|
| 78 |
-
st.text_input(f"Video '{judul_video}'
|
|
|
|
| 2 |
import streamlit as st
|
| 3 |
from streamlit_option_menu import option_menu
|
| 4 |
from youtube import youtube, download_youtube
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
from others import *
|
| 6 |
|
| 7 |
# Navigasi Sidebar
|
| 8 |
+
options = ['Youtube']
|
| 9 |
with st.sidebar:
|
| 10 |
selected = option_menu("Video Downloader", options,
|
| 11 |
+
icons=['play'], menu_icon="cast", default_index=0)
|
| 12 |
|
| 13 |
+
functions = [youtube]
|
| 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"Download and cut a portion of the {selected} video.")
|
| 20 |
+
video_link = st.text_input("Video Link", value='https://www.youtube.com/watch?v=ZGltvcmVSAk')
|
| 21 |
+
resolution = st.selectbox("Select Resolution", (360, 480, 720), 2)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
|
| 23 |
+
choice = st.radio('Select Process:', ['Cut Video', 'Compress Video', 'Just Download'], 2)
|
| 24 |
|
| 25 |
+
start_time = st.text_input("Start Time", value='00:07:12.000')
|
| 26 |
+
end_time = st.text_input("End Time", value='00:07:31.000')
|
| 27 |
+
|
| 28 |
+
# Display video preview when the button is clicked
|
| 29 |
+
if st.button(f"Download and Cut {selected}"):
|
| 30 |
+
video_file, judul_video, video_info, thumbnail_file = fungsi(video_link, resolution)
|
| 31 |
+
st.video(video_link)
|
| 32 |
+
|
| 33 |
+
# Button to download the cutted part
|
| 34 |
+
if st.button("Download Cutted"):
|
|
|
|
| 35 |
video_file = cut_video(video_file, judul_video, start_time, end_time)
|
| 36 |
file_size = os.path.getsize(video_file)
|
| 37 |
session(video_info, video_file, thumbnail_file, choice)
|
| 38 |
+
st.text_input(f"Video '{judul_video}' after processing:", convert_size(file_size))
|
| 39 |
|
| 40 |
elif choice == 'Compress Video':
|
| 41 |
+
compress = st.selectbox("Select Compression Resolution", (360, 480, 720), 2)
|
| 42 |
|
| 43 |
if st.button(f"Download and Compress {selected}"):
|
| 44 |
+
video_file, judul_video, video_info, thumbnail_file = fungsi(video_link, resolution)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
video_file = convert_videos(compress, video_file)
|
| 46 |
file_size = os.path.getsize(video_file)
|
| 47 |
session(video_info, video_file, thumbnail_file, choice)
|
| 48 |
+
st.text_input(f"Video '{judul_video}' after processing:", convert_size(file_size))
|
| 49 |
|
| 50 |
else:
|
| 51 |
if st.button(f"Download {selected}"):
|
| 52 |
+
video_file, judul_video, video_info, thumbnail_file = fungsi(video_link, resolution)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 53 |
file_size = os.path.getsize(video_file)
|
| 54 |
session(video_info, video_file, thumbnail_file, choice)
|
| 55 |
+
st.text_input(f"Video '{judul_video}' after processing:", convert_size(file_size))
|