Spaces:
Paused
Paused
File size: 5,753 Bytes
c6ab2d5 8069ca7 e50e5eb d51d2cb e50e5eb d51d2cb 72aa956 b3fc5a1 70d1319 6035632 70d1319 7af36b7 9709f8c 8069ca7 cfdf719 7af36b7 b8039b9 dba9952 5807824 dba9952 e07bd3d dba9952 6035632 3e61cb2 64a6f97 3e61cb2 cfdf719 3e61cb2 a505952 dba9952 7af36b7 6035632 1a67b32 a9e05c6 3e61cb2 49384d8 3e61cb2 e07bd3d 3e61cb2 49384d8 3e61cb2 e07bd3d 3e61cb2 74da608 3e61cb2 e07bd3d 3e61cb2 e07bd3d | 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 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 | 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', 'Iwara', 'Mega', 'Rule34', 'Paipancon', 'Trailer', 'Cek Video']
with st.sidebar:
selected = option_menu("Video Downloader", options,
icons=['play', 'fire', 'star', 'moon','gear', 'house', 'lightning', 'circle'], menu_icon="cast", default_index=7)
functions = [youtube, pornhub, iwara, download_youtube, rule34, paipancon, trailer, 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=tFSfPmqbfKU')
resolution = st.selectbox("Pilih Resolusi", (360, 480, 720), 2)
elif selected == 'Mega':
name = st.text_input("Nama File")
video_link = st.text_input("Link Video")
elif selected == 'Cek Video':
tempat = st.selectbox("Pilih Tempat", ("Hasil Potong", "Hasil Konversi", "Hasil Download"), 2)
tempat_path = os.path.join('/home/user/app', tempat)
# Buat list untuk menyimpan semua file
all_files = []
# Iterasi melalui semua direktori dan sub-direktori
for root, dirs, files in os.walk(tempat_path):
for file in files:
if file.endswith(".mp4"):
# Tambahkan path file ke list
all_files.append(file)
# Buat variabel untuk menyimpan jumlah baris dalam text area
num_lines = len(all_files)
# Jika tidak ada file dalam direktori
if not all_files:
st.write('Folder is empty!')
else:
# Tampilkan semua file dalam text area
st.write('Files in directory:', tempat_path)
st.text_area("Files", "\n".join(all_files), height=25*num_lines)
else:
video_link = st.text_input("Link Video")
if selected == 'Cek Video':
video_file = st.text_input("Pilih File", value='Brandish PV.mp4')
video_path = cari_file(video_file, tempat_path)
thumbnail_path = cari_file(video_file.replace("mp4", "jpg"), '/home/user/app/Hasil Download')
if tempat =="Hasil Potong":
choice = 'Potong Video'
elif tempat =="Hasil Konversi":
choice = 'Compress Video'
else:
choice = ''
if st.button(f"Dapatkan File"):
file_size = os.path.getsize(video_path)
session("", video_path, thumbnail_path, choice)
st.text_input(f"Video '{video_file}' dengan size:", convert_size(file_size))
else:
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 == '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 == '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 == '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)) |