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