rutor.php 1.4 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. $td = $xpath->evaluate(".//td", $result);
  15. $size = $td[count($td) == 5 ? 3 : 2]->textContent;
  16. $seeders = $xpath->evaluate(".//span", $result)[0]->textContent;
  17. $leechers = $xpath->evaluate(".//span", $result)[1]->textContent;
  18. array_push($results,
  19. array (
  20. "name" => htmlspecialchars($name),
  21. "seeders" => (int) filter_var($seeders, FILTER_SANITIZE_NUMBER_INT),
  22. "leechers" => (int) filter_var($leechers, FILTER_SANITIZE_NUMBER_INT),
  23. "magnet" => htmlspecialchars($magnet),
  24. "size" => htmlspecialchars($size),
  25. "source" => "rutor.info"
  26. )
  27. );
  28. }
  29. return $results;
  30. }
  31. ?>