Spaces:
Paused
Paused
Commit ·
fd9a1bf
1
Parent(s): 784ea8a
Update pornhub.py
Browse files- pornhub.py +1 -27
pornhub.py
CHANGED
|
@@ -4,6 +4,7 @@ import subprocess
|
|
| 4 |
import youtube_dl
|
| 5 |
from datetime import datetime, timedelta
|
| 6 |
from moviepy.editor import VideoFileClip
|
|
|
|
| 7 |
|
| 8 |
def download_pornhub(url, resolusi, nama_channel, judul_video, extension):
|
| 9 |
download = f"/home/user/app/Hasil Download/Pornhub/{nama_channel}"
|
|
@@ -13,16 +14,6 @@ def download_pornhub(url, resolusi, nama_channel, judul_video, extension):
|
|
| 13 |
filename = f'{download}/{file_name}'
|
| 14 |
subprocess.run(["youtube-dl", "-f", f"bestvideo[height<={resolusi}]+bestaudio/best[height<={resolusi}]", "-o", filename, url])
|
| 15 |
return filename
|
| 16 |
-
|
| 17 |
-
def format_number(number):
|
| 18 |
-
if number < 1000:
|
| 19 |
-
return str(number)
|
| 20 |
-
elif number < 1000000:
|
| 21 |
-
return f"{round(number / 1000)} ribu"
|
| 22 |
-
elif number < 1000000000:
|
| 23 |
-
return f"{round(number / 1000000)} juta"
|
| 24 |
-
else:
|
| 25 |
-
return f"{round(number / 1000000000)} miliar"
|
| 26 |
|
| 27 |
def ph_down(url, resolusi_input, start_time_str, end_time_str):
|
| 28 |
video_info = ""
|
|
@@ -63,20 +54,3 @@ def ph_down(url, resolusi_input, start_time_str, end_time_str):
|
|
| 63 |
|
| 64 |
filename = download_pornhub(url, resolusi, nama_channel, judul_video, 'mp4')
|
| 65 |
return filename, judul_video, video_info
|
| 66 |
-
|
| 67 |
-
def ph_cut(url, resolusi_input, start_time_str, end_time_str):
|
| 68 |
-
filename, judul_video, video_info = ph_down(url, resolusi_input, start_time_str, end_time_str)
|
| 69 |
-
start_time_parts = start_time_str.split(':')
|
| 70 |
-
end_time_parts = end_time_str.split(':')
|
| 71 |
-
start_time_seconds = int(start_time_parts[0]) * 3600 + int(start_time_parts[1]) * 60 + float(start_time_parts[2])
|
| 72 |
-
end_time_seconds = int(end_time_parts[0]) * 3600 + int(end_time_parts[1]) * 60 + float(end_time_parts[2])
|
| 73 |
-
potong = "/home/user/app/Hasil Potong"
|
| 74 |
-
if not os.path.exists(potong):
|
| 75 |
-
os.makedirs(potong)
|
| 76 |
-
output_file_path = f'{potong}/{judul_video}.mp4'
|
| 77 |
-
|
| 78 |
-
with VideoFileClip(filename) as video:
|
| 79 |
-
subclip = video.subclip(start_time_seconds, end_time_seconds)
|
| 80 |
-
subclip.write_videofile(output_file_path)
|
| 81 |
-
|
| 82 |
-
return video_info, output_file_path
|
|
|
|
| 4 |
import youtube_dl
|
| 5 |
from datetime import datetime, timedelta
|
| 6 |
from moviepy.editor import VideoFileClip
|
| 7 |
+
from other import format_number
|
| 8 |
|
| 9 |
def download_pornhub(url, resolusi, nama_channel, judul_video, extension):
|
| 10 |
download = f"/home/user/app/Hasil Download/Pornhub/{nama_channel}"
|
|
|
|
| 14 |
filename = f'{download}/{file_name}'
|
| 15 |
subprocess.run(["youtube-dl", "-f", f"bestvideo[height<={resolusi}]+bestaudio/best[height<={resolusi}]", "-o", filename, url])
|
| 16 |
return filename
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
|
| 18 |
def ph_down(url, resolusi_input, start_time_str, end_time_str):
|
| 19 |
video_info = ""
|
|
|
|
| 54 |
|
| 55 |
filename = download_pornhub(url, resolusi, nama_channel, judul_video, 'mp4')
|
| 56 |
return filename, judul_video, video_info
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|