Spaces:
Paused
Paused
GilangAlRusliadi commited on
Commit ·
81ba6f6
1
Parent(s): 6b64712
Rule 34
Browse files
rule34.py
CHANGED
|
@@ -2,7 +2,9 @@ from bs4 import BeautifulSoup
|
|
| 2 |
import json
|
| 3 |
from others import *
|
| 4 |
|
| 5 |
-
def get_info_rule34(
|
|
|
|
|
|
|
| 6 |
# Mencari judul video di elemen dengan class title_video
|
| 7 |
title = soup.find(class_="title_video")
|
| 8 |
if title:
|
|
@@ -79,7 +81,19 @@ def get_info_rule34(soup: BeautifulSoup):
|
|
| 79 |
print("Tidak ditemukan video kualitas 720p atau 480p")
|
| 80 |
video_url = None
|
| 81 |
|
| 82 |
-
return video_title, artist,
|
| 83 |
|
| 84 |
-
def rule34():
|
| 85 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
import json
|
| 3 |
from others import *
|
| 4 |
|
| 5 |
+
def get_info_rule34(url):
|
| 6 |
+
response = requests.get(url)
|
| 7 |
+
soup = BeautifulSoup(response.text, 'html.parser')
|
| 8 |
# Mencari judul video di elemen dengan class title_video
|
| 9 |
title = soup.find(class_="title_video")
|
| 10 |
if title:
|
|
|
|
| 81 |
print("Tidak ditemukan video kualitas 720p atau 480p")
|
| 82 |
video_url = None
|
| 83 |
|
| 84 |
+
return video_title, artist, video_url, thumbnail_url
|
| 85 |
|
| 86 |
+
def rule34(link, resolusi_input):
|
| 87 |
+
video_info = ""
|
| 88 |
+
video_title, artist, video_url, thumbnail_url = get_info_rule34(link)
|
| 89 |
+
directory = f"/home/user/app/Hasil Download/Rule34/{artist}"
|
| 90 |
+
if not os.path.exists(directory):
|
| 91 |
+
os.makedirs(directory)
|
| 92 |
+
# Menentukan nama file thumbnail
|
| 93 |
+
thumbnail_file = download_file(thumbnail_url, video_title, directory)
|
| 94 |
+
video_file = download_file(video_url, video_title, directory)
|
| 95 |
+
|
| 96 |
+
video_info = f"Nama Channel: {artist}\n"
|
| 97 |
+
video_info += f"Judul Video: {video_title}\n"
|
| 98 |
+
|
| 99 |
+
return video_file, video_title, video_info, thumbnail_file
|