Spaces:
Running
Running
Update main.py
Browse files
main.py
CHANGED
@@ -422,7 +422,22 @@ 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 |
entry = {
|
427 |
"yts_link": movie_url,
|
428 |
"name": movie_name,
|
|
|
422 |
if "--" in movie_name:
|
423 |
movie_name = movie_name.replace("--", "-")
|
424 |
movie_url = f"https://yts.mx/movie/{movie_name.lower()}"
|
425 |
+
request = await async_searcher(movie_url)
|
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,
|