2022-03-04 01:36:31 -08:00
|
|
|
<?php
|
2023-08-22 05:25:44 -07:00
|
|
|
class RutorRequest extends EngineRequest {
|
|
|
|
public function get_request_url() {
|
|
|
|
return "http://rutor.info/search/" . urlencode($this->query);
|
|
|
|
}
|
2022-04-27 04:15:17 -07:00
|
|
|
|
2023-08-22 05:25:44 -07:00
|
|
|
public function get_results() {
|
|
|
|
$response = curl_multi_getcontent($this->ch);
|
|
|
|
$xpath = get_xpath($response);
|
|
|
|
$results = array();
|
2022-03-04 01:36:31 -08:00
|
|
|
|
|
|
|
|
2023-08-22 05:25:44 -07:00
|
|
|
foreach($xpath->query("//table/tr[@class='gai' or @class='tum']") as $result)
|
|
|
|
{
|
|
|
|
$name = $xpath->evaluate(".//td/a", $result)[2]->textContent;
|
|
|
|
$magnet = $xpath->evaluate(".//td/a/@href", $result)[1]->textContent;
|
|
|
|
$magnet_without_tracker = explode("&tr=", $magnet)[0];
|
|
|
|
$magnet = $magnet_without_tracker . $this->config->bittorent_trackers;
|
|
|
|
$td = $xpath->evaluate(".//td", $result);
|
|
|
|
$size = $td[count($td) == 5 ? 3 : 2]->textContent;
|
|
|
|
$seeders = $xpath->evaluate(".//span", $result)[0]->textContent;
|
|
|
|
$leechers = $xpath->evaluate(".//span", $result)[1]->textContent;
|
2022-03-04 01:36:31 -08:00
|
|
|
|
2023-08-22 05:25:44 -07:00
|
|
|
array_push($results,
|
|
|
|
array (
|
|
|
|
"name" => htmlspecialchars($name),
|
|
|
|
"seeders" => (int) filter_var($seeders, FILTER_SANITIZE_NUMBER_INT),
|
|
|
|
"leechers" => (int) filter_var($leechers, FILTER_SANITIZE_NUMBER_INT),
|
|
|
|
"magnet" => htmlspecialchars($magnet),
|
|
|
|
"size" => htmlspecialchars($size),
|
|
|
|
"source" => "rutor.info"
|
|
|
|
)
|
|
|
|
);
|
|
|
|
}
|
2022-03-04 01:36:31 -08:00
|
|
|
|
2023-08-22 05:25:44 -07:00
|
|
|
return $results;
|
|
|
|
}
|
2022-03-04 01:36:31 -08:00
|
|
|
}
|
2022-05-15 01:34:46 -07:00
|
|
|
?>
|