Spaces:
Paused
Paused
Commit ·
70d1319
1
Parent(s): 194b56c
Update app.py
Browse files
app.py
CHANGED
|
@@ -3,27 +3,30 @@ from streamlit_option_menu import option_menu
|
|
| 3 |
import streamlit as st
|
| 4 |
from youtube import cut_video
|
| 5 |
|
| 6 |
-
|
|
|
|
|
|
|
|
|
|
| 7 |
|
| 8 |
-
|
| 9 |
-
st.
|
| 10 |
-
|
| 11 |
-
video_link = st.text_input("Link Video")
|
| 12 |
-
resolution = st.text_input("Resolusi", value='720')
|
| 13 |
-
start_time = st.text_input("Start Time", value='00:00:00.000')
|
| 14 |
-
end_time = st.text_input("End Time", value='00:01:00.000')
|
| 15 |
-
|
| 16 |
-
if st.button("Download and Cut Video"):
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
|
|
|
| 3 |
import streamlit as st
|
| 4 |
from youtube import cut_video
|
| 5 |
|
| 6 |
+
# Navigasi Sidebar
|
| 7 |
+
with st.sidebar:
|
| 8 |
+
selected = option_menu("Video Downloader", ['Youtube', 'Pornhub', 'Iwara', 'Mega', 'Rule34', 'Trailer'],
|
| 9 |
+
icons=['play', 'fire', 'star', 'star', 'moon','gear', 'lightning'], menu_icon="cast", default_index=0)
|
| 10 |
|
| 11 |
+
if selected == 'Youtube':
|
| 12 |
+
st.title("YouTube Video Cutter")
|
| 13 |
+
st.write("Potong dan download sebagian video YouTube.")
|
| 14 |
+
video_link = st.text_input("Link Video")
|
| 15 |
+
resolution = st.text_input("Resolusi", value='720')
|
| 16 |
+
start_time = st.text_input("Start Time", value='00:00:00.000')
|
| 17 |
+
end_time = st.text_input("End Time", value='00:01:00.000')
|
| 18 |
+
|
| 19 |
+
if st.button("Download and Cut Video"):
|
| 20 |
+
video_info, video_result, video_file = cut_video(video_link, resolution, start_time, end_time)
|
| 21 |
+
num_lines = info.count('\n') + 1
|
| 22 |
+
text_area_height = 25 * num_lines
|
| 23 |
+
st.text_area("Hasil Tracing", video_info, height=text_area_height)
|
| 24 |
+
st.video(video_result)
|
| 25 |
+
with open(video_file, 'rb') as f:
|
| 26 |
+
file_contents = f.read()
|
| 27 |
+
st.download_button(
|
| 28 |
+
label="Download Hasil Potongan Video",
|
| 29 |
+
data=file_contents,
|
| 30 |
+
file_name=video_file.replace('/home/user/app/', '').title().replace('Mp4', 'mp4'),
|
| 31 |
+
mime='application/octet-stream'
|
| 32 |
+
)
|