Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
@@ -50,6 +50,7 @@ from pymongo import MongoClient
|
|
50 |
from RyuzakiLib.hackertools.chatgpt import RendyDevChat
|
51 |
from RyuzakiLib.hackertools.gemini import GeminiLatest
|
52 |
from RyuzakiLib.mental import BadWordsList
|
|
|
53 |
from serpapi import GoogleSearch
|
54 |
|
55 |
from models import *
|
@@ -384,14 +385,15 @@ async def get_torrent_info(url):
|
|
384 |
print("Error fetching torrent info:", e)
|
385 |
return []
|
386 |
|
387 |
-
|
|
|
388 |
async def get_movie_info(name: str, api_key: str = Header(...)):
|
389 |
validate_api_key(api_key) # Validate API key here
|
390 |
results = []
|
391 |
try:
|
392 |
for page in range(1, 2):
|
393 |
url = f"https://yts.mx/browse-movies/{name}/all/all/0/seeds/0/all"
|
394 |
-
r =
|
395 |
soup = BeautifulSoup(r, "lxml")
|
396 |
for movie in soup.findAll("div", class_="browse-movie-wrap col-xs-10 col-sm-4 col-md-5 col-lg-4"):
|
397 |
mov_name = movie.find("div", class_="browse-movie-bottom")
|
@@ -422,22 +424,7 @@ async def get_movie_info(name: str, api_key: str = Header(...)):
|
|
422 |
if "--" in movie_name:
|
423 |
movie_name = movie_name.replace("--", "-")
|
424 |
movie_url = f"https://yts.mx/movie/{movie_name.lower()}"
|
425 |
-
|
426 |
-
n_soup = BeautifulSoup(request, "lxml")
|
427 |
-
info = n_soup.find("div", class_="bottom-info")
|
428 |
-
torrent_info = n_soup.find("p", class_="hidden-xs hidden-sm")
|
429 |
-
genre = n_soup.findAll("h2")[1].text
|
430 |
-
likes = info.find("span", id="movie-likes").text
|
431 |
-
imdb_link = info.find("a", title="IMDb Rating")["href"]
|
432 |
-
magnet_links = []
|
433 |
-
for torrent in torrent_info.findAll("a"):
|
434 |
-
if "magnet" in torrent["href"]:
|
435 |
-
magnet_links.append(torrent["href"])
|
436 |
-
elif torrent.text[:3] == "720":
|
437 |
-
torrent_720 = torrent["href"]
|
438 |
-
elif torrent.text[:4] == "1080":
|
439 |
-
torrent_1080 = torrent["href"]
|
440 |
-
torrents = await get_torrent_info(movie_url) # Get torrent info asynchronously
|
441 |
entry = {
|
442 |
"yts_link": movie_url,
|
443 |
"name": movie_name,
|
|
|
50 |
from RyuzakiLib.hackertools.chatgpt import RendyDevChat
|
51 |
from RyuzakiLib.hackertools.gemini import GeminiLatest
|
52 |
from RyuzakiLib.mental import BadWordsList
|
53 |
+
from pyUltroid.fns.helper import async_searcher
|
54 |
from serpapi import GoogleSearch
|
55 |
|
56 |
from models import *
|
|
|
385 |
print("Error fetching torrent info:", e)
|
386 |
return []
|
387 |
|
388 |
+
|
389 |
+
app.get("/UFoP/yts", response_model=List[MovieInfo])
|
390 |
async def get_movie_info(name: str, api_key: str = Header(...)):
|
391 |
validate_api_key(api_key) # Validate API key here
|
392 |
results = []
|
393 |
try:
|
394 |
for page in range(1, 2):
|
395 |
url = f"https://yts.mx/browse-movies/{name}/all/all/0/seeds/0/all"
|
396 |
+
r = await async_searcher(url)
|
397 |
soup = BeautifulSoup(r, "lxml")
|
398 |
for movie in soup.findAll("div", class_="browse-movie-wrap col-xs-10 col-sm-4 col-md-5 col-lg-4"):
|
399 |
mov_name = movie.find("div", class_="browse-movie-bottom")
|
|
|
424 |
if "--" in movie_name:
|
425 |
movie_name = movie_name.replace("--", "-")
|
426 |
movie_url = f"https://yts.mx/movie/{movie_name.lower()}"
|
427 |
+
torrents = await sicX.yts(movie_name, api_key) # Get torrent info asynchronously
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
428 |
entry = {
|
429 |
"yts_link": movie_url,
|
430 |
"name": movie_name,
|