rutor.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. $rutor_url = "http://rutor.info/search/$query";
  3. function get_rutor_results($response)
  4. {
  5. global $config;
  6. $xpath = get_xpath($response);
  7. $results = array();
  8. foreach($xpath->query("//table/tr[@class='gai' or @class='tum']") as $result)
  9. {
  10. $name = $xpath->evaluate(".//td/a", $result)[2]->textContent;
  11. $magnet = $xpath->evaluate(".//td/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(".//td", $result)[3]->textContent;
  15. $seeders = $xpath->evaluate(".//span", $result)[0]->textContent;
  16. $leechers = $xpath->evaluate(".//span", $result)[1]->textContent;
  17. array_push($results,
  18. array (
  19. "name" => htmlspecialchars($name),
  20. "seeders" => (int) remove_special($seeders),
  21. "leechers" => (int) remove_special($leechers),
  22. "magnet" => htmlspecialchars($magnet),
  23. "size" => htmlspecialchars($size),
  24. "source" => "rutor.info"
  25. )
  26. );
  27. }
  28. return $results;
  29. }
  30. ?>