2023-02-03 21:01:28 +00:00
|
|
|
<?php
|
2023-04-11 19:40:17 +00:00
|
|
|
$rutor_url = "http://rutor.info/search/$query";
|
2023-02-03 21:01:28 +00:00
|
|
|
|
2023-04-11 19:40:17 +00:00
|
|
|
function get_rutor_results($response)
|
|
|
|
{
|
|
|
|
try {
|
2023-02-03 21:01:28 +00:00
|
|
|
global $config;
|
|
|
|
$xpath = get_xpath($response);
|
|
|
|
$results = array();
|
|
|
|
|
|
|
|
|
2023-04-11 19:40:17 +00:00
|
|
|
foreach ($xpath->query("//table/tr[@class='gai' or @class='tum']") as $result) {
|
2023-02-03 21:01:28 +00:00
|
|
|
|
|
|
|
$name = $xpath->evaluate(".//td/a", $result)[2]->textContent;
|
2023-04-11 19:40:17 +00:00
|
|
|
$magnet = $xpath->evaluate(".//td/a/@href", $result)[1]->textContent;
|
2023-02-03 21:01:28 +00:00
|
|
|
$magnet_without_tracker = explode("&tr=", $magnet)[0];
|
|
|
|
$magnet = $magnet_without_tracker . $config->bittorent_trackers;
|
|
|
|
$size = $xpath->evaluate(".//td", $result)[3]->textContent;
|
|
|
|
$seeders = $xpath->evaluate(".//span", $result)[0]->textContent;
|
|
|
|
$leechers = $xpath->evaluate(".//span", $result)[1]->textContent;
|
|
|
|
|
2023-04-11 19:40:17 +00:00
|
|
|
array_push(
|
|
|
|
$results,
|
|
|
|
array(
|
2023-02-03 21:01:28 +00:00
|
|
|
"name" => htmlspecialchars($name),
|
|
|
|
"seeders" => (int) remove_special($seeders),
|
|
|
|
"leechers" => (int) remove_special($leechers),
|
|
|
|
"magnet" => htmlspecialchars($magnet),
|
|
|
|
"size" => htmlspecialchars($size),
|
|
|
|
"source" => "rutor.info"
|
|
|
|
)
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
return $results;
|
2023-04-11 19:40:17 +00:00
|
|
|
|
|
|
|
} catch (Error $e) {
|
|
|
|
return array();
|
2023-02-03 21:01:28 +00:00
|
|
|
}
|
2023-04-11 19:40:17 +00:00
|
|
|
}
|
|
|
|
?>
|