2022-02-17 21:14:56 +01:00
|
|
|
<?php
|
2022-02-24 11:30:15 +01:00
|
|
|
require "engines/google.php";
|
2022-02-24 22:29:10 +01:00
|
|
|
require "engines/bittorrent.php";
|
2022-02-24 11:30:15 +01:00
|
|
|
|
|
|
|
if (!isset($_REQUEST["q"]))
|
|
|
|
{
|
|
|
|
echo "API usage: <a href=\"https://github.com/hnhx/librex/#api\">https://github.com/hnhx/librex/</a>";
|
|
|
|
die();
|
|
|
|
}
|
2022-02-17 21:14:56 +01:00
|
|
|
|
|
|
|
$query = $_REQUEST["q"];
|
2022-02-24 11:30:15 +01:00
|
|
|
$page = isset($_REQUEST["p"]) ? (int) $_REQUEST["p"] : 0;
|
|
|
|
$type = isset($_REQUEST["type"]) ? (int) $_REQUEST["type"] : 0;
|
2022-02-17 21:14:56 +01:00
|
|
|
|
2022-02-24 22:29:10 +01:00
|
|
|
$results = $type != 3 ? get_google_results($query, $page, $type) : get_bittorrent_results($query);
|
2022-02-17 21:14:56 +01:00
|
|
|
|
2022-02-24 11:30:15 +01:00
|
|
|
header('Content-Type: application/json');
|
2022-02-21 22:00:59 +01:00
|
|
|
echo json_encode($results, JSON_PRETTY_PRINT);
|
2022-02-17 21:14:56 +01:00
|
|
|
?>
|