torrentgalaxy.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. $torrentgalaxy_url = "https://torrentgalaxy.to/torrents.php?search=$query#results";
  3. function get_torrentgalaxy_results($response)
  4. {
  5. global $config;
  6. $xpath = get_xpath($response);
  7. $results = array();
  8. foreach($xpath->query("//div[@class='tgxtablerow txlight']") as $result)
  9. {
  10. $name = $xpath->evaluate(".//div[contains(@class, 'clickable-row')]", $result)[0]->textContent;
  11. $magnet = $xpath->evaluate(".//div[@class='tgxtablecell collapsehide rounded txlight']/a/@href", $result)[1]->textContent;
  12. $magnet_without_tracker = explode("&tr=", $magnet)[0];
  13. $magnet = $magnet_without_tracker . $config->bittorent_trackers;
  14. $size = $xpath->evaluate(".//div[@class='tgxtablecell collapsehide rounded txlight']/span", $result)[0]->textContent;
  15. $seeders = $xpath->evaluate(".//div[@class='tgxtablecell collapsehide rounded txlight']/span/font", $result)[1]->textContent;
  16. $leechers = $xpath->evaluate(".//div[@class='tgxtablecell collapsehide rounded txlight']/span/font", $result)[2]->textContent;
  17. array_push($results,
  18. array (
  19. "name" => htmlspecialchars($name),
  20. "seeders" => (int) $seeders,
  21. "leechers" => (int) $leechers,
  22. "magnet" => htmlspecialchars($magnet),
  23. "size" => htmlspecialchars($size),
  24. "source" => "torrentgalaxy.to"
  25. )
  26. );
  27. }
  28. return $results;
  29. }
  30. ?>