2022-02-25 20:26:15 +01:00
|
|
|
<?php
|
2022-04-27 13:15:17 +02:00
|
|
|
$yts_url = "https://yts.mx/api/v2/list_movies.json?query_term=$query";
|
2022-02-25 20:26:15 +01:00
|
|
|
|
2022-04-27 13:15:17 +02:00
|
|
|
function get_yts_results($response)
|
2022-02-25 20:26:15 +01:00
|
|
|
{
|
2022-03-11 10:04:36 +01:00
|
|
|
global $config;
|
2022-02-25 20:26:15 +01:00
|
|
|
$results = array();
|
|
|
|
$json_response = json_decode($response, true);
|
|
|
|
|
2022-02-25 20:34:16 +01:00
|
|
|
if ($json_response["status"] == "ok" && $json_response["data"]["movie_count"] != 0)
|
2022-02-25 20:26:15 +01:00
|
|
|
{
|
|
|
|
foreach ($json_response["data"]["movies"] as $movie)
|
|
|
|
{
|
|
|
|
$name = $movie["title"];
|
|
|
|
$name_encoded = urlencode($name);
|
|
|
|
|
|
|
|
foreach ($movie["torrents"] as $torrent)
|
|
|
|
{
|
|
|
|
|
|
|
|
$hash = $torrent["hash"];
|
|
|
|
$seeders = $torrent["seeds"];
|
|
|
|
$leechers = $torrent["peers"];
|
|
|
|
$size = $torrent["size"];
|
|
|
|
|
2022-03-11 10:04:36 +01:00
|
|
|
$magnet = "magnet:?xt=urn:btih:$hash&dn=$name_encoded$config->bittorent_trackers";
|
2022-02-25 20:26:15 +01:00
|
|
|
|
|
|
|
array_push($results,
|
|
|
|
array (
|
|
|
|
"size" => $size,
|
|
|
|
"name" => $name,
|
|
|
|
"seeders" => $seeders,
|
|
|
|
"leechers" => $leechers,
|
|
|
|
"magnet" => $magnet,
|
|
|
|
"source" => "yts.mx"
|
|
|
|
)
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return $results;
|
|
|
|
|
|
|
|
}
|
|
|
|
?>
|