Spaces:
Paused
Paused
Update main.py
Browse files
main.py
CHANGED
|
@@ -346,41 +346,39 @@ def sibyl_system(
|
|
| 346 |
|
| 347 |
async def get_torrent_info(url):
|
| 348 |
try:
|
| 349 |
-
|
| 350 |
-
|
| 351 |
-
|
| 352 |
-
|
| 353 |
-
|
| 354 |
-
|
| 355 |
-
|
| 356 |
-
|
| 357 |
-
|
| 358 |
-
else:
|
| 359 |
-
poster_url = "N/A"
|
| 360 |
|
| 361 |
# Extract other torrent information
|
| 362 |
-
|
| 363 |
-
|
| 364 |
-
|
| 365 |
-
|
| 366 |
-
|
| 367 |
-
|
| 368 |
-
|
| 369 |
-
|
| 370 |
-
|
| 371 |
|
| 372 |
-
|
| 373 |
-
|
| 374 |
-
|
| 375 |
-
|
| 376 |
-
|
| 377 |
-
|
| 378 |
-
|
| 379 |
-
|
| 380 |
-
|
| 381 |
-
|
| 382 |
-
|
| 383 |
-
|
| 384 |
except Exception as e:
|
| 385 |
print("Error fetching torrent info:", e)
|
| 386 |
return []
|
|
@@ -393,7 +391,7 @@ async def get_movie_info(name: str, api_key: str = Header(...)):
|
|
| 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")
|
|
|
|
| 346 |
|
| 347 |
async def get_torrent_info(url):
|
| 348 |
try:
|
| 349 |
+
html = await async_searcher(url)
|
| 350 |
+
soup = BeautifulSoup(html, "html.parser")
|
| 351 |
+
torrents = []
|
| 352 |
+
for movie_div in soup.find_all("div", class_="container", id="movie-content"):
|
| 353 |
+
poster = movie_div.find("img", itemprop="image")
|
| 354 |
+
if poster:
|
| 355 |
+
poster_url = poster["src"]
|
| 356 |
+
else:
|
| 357 |
+
poster_url = "N/A"
|
|
|
|
|
|
|
| 358 |
|
| 359 |
# Extract other torrent information
|
| 360 |
+
torrent_divs = movie_div.find_all("div", class_="modal-torrent")
|
| 361 |
+
for div in torrent_divs:
|
| 362 |
+
quality = div.find("div", class_="modal-quality").find("span").text
|
| 363 |
+
all_p = div.find_all("p", class_="quality-size")
|
| 364 |
+
quality_type = all_p[0].text if all_p else "N/A"
|
| 365 |
+
size = all_p[1].text if len(all_p) > 1 else "N/A"
|
| 366 |
+
torrent_link = div.find("a", class_="download-torrent")["href"]
|
| 367 |
+
magnet = div.find("a", class_="magnet-download")["href"]
|
| 368 |
+
hash = re.search(r"([{a-f\d,A-F\d}]{32,40})\b", magnet).group(0)
|
| 369 |
|
| 370 |
+
torrents.append(
|
| 371 |
+
{
|
| 372 |
+
"poster": poster_url,
|
| 373 |
+
"quality": quality,
|
| 374 |
+
"type": quality_type,
|
| 375 |
+
"size": size,
|
| 376 |
+
"torrent": torrent_link,
|
| 377 |
+
"magnet": magnet,
|
| 378 |
+
"hash": hash,
|
| 379 |
+
}
|
| 380 |
+
)
|
| 381 |
+
return torrents
|
| 382 |
except Exception as e:
|
| 383 |
print("Error fetching torrent info:", e)
|
| 384 |
return []
|
|
|
|
| 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 = await async_searcher(url)
|
| 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")
|