rutor.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. function get_rutor_results($query)
  3. {
  4. global $config;
  5. $url = "http://rutor.info/search/$query";
  6. $response = request($url);
  7. $xpath = get_xpath($response);
  8. $results = array();
  9. foreach($xpath->query("//table/tr[@class='gai' or @class='tum']") as $result)
  10. {
  11. $name = $xpath->evaluate(".//td/a", $result)[2]->textContent;
  12. $magnet = $xpath->evaluate(".//td/a/@href", $result)[1]->textContent;
  13. $magnet_without_tracker = explode("&tr=", $magnet)[0];
  14. $magnet = $magnet_without_tracker . $config->bittorent_trackers;
  15. $size = $xpath->evaluate(".//td", $result)[3]->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" => $name,
  21. "seeders" => (int) remove_special($seeders),
  22. "leechers" => (int) remove_special($leechers),
  23. "magnet" => $magnet,
  24. "size" => $size,
  25. "source" => "rutor.info"
  26. )
  27. );
  28. }
  29. return $results;
  30. }
  31. ?>