Ufoptg commited on
Commit
7eaad9b
1 Parent(s): 9c9d323

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +25 -21
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 div in soup.find_all("div", class_="container", id="movie-content"):
354
- poster = div.find("img", itemprop="image")
355
  if poster:
356
  poster_url = poster["src"]
357
  else:
358
  poster_url = "N/A"
359
- quality = div.find("div", class_="modal-quality").find("span").text
360
- all_p = div.find_all("p", class_="quality-size")
361
- quality_type = all_p[0].text if all_p else "N/A"
362
- size = all_p[1].text if len(all_p) > 1 else "N/A"
363
- torrent_link = div.find("a", class_="download-torrent")["href"]
364
- magnet = div.find("a", class_="magnet-download")["href"]
365
- hash = re.search(r"([{a-f\d,A-F\d}]{32,40})\b", magnet).group(0)
366
-
367
- torrents.append(
368
- {
369
- "poster": poster_url,
370
- "quality": quality,
371
- "type": quality_type,
372
- "size": size,
373
- "torrent": torrent_link,
374
- "magnet": magnet,
375
- "hash": hash,
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)