Self-Host

To Self-host @ https://link.flossboxin.org.in
This commit is contained in:
vdbhb59 2025-02-21 21:50:36 +05:30
commit c9898cf261
95 changed files with 5217 additions and 0 deletions

View file

@ -0,0 +1,40 @@
<?php
require_once "engines/text/text.php";
class TorSearch extends EngineRequest {
public function get_request_url() {
return "https://ahmia.fi/search/?q=" . urlencode($this->query);
}
public function parse_results($response) {
$results = array();
$xpath = get_xpath($response);
if (!$xpath)
return $results;
foreach($xpath->query("//ol[@class='searchResults']//li[@class='result']") as $result)
{
$url = "http://" . $xpath->evaluate(".//cite", $result)[0]->textContent;
$title = remove_special($xpath->evaluate(".//h4", $result)[0]->textContent);
$description = $xpath->evaluate(".//p", $result)[0]->textContent;
array_push($results,
array (
"title" => $title ? htmlspecialchars($title) : TEXTS["result_no_description"],
"url" => htmlspecialchars($url),
// base_url is to be removed in the future, see #47
"base_url" => htmlspecialchars(get_base_url($url)),
"description" => htmlspecialchars($description)
)
);
}
return $results;
}
public static function print_results($results, $opts) {
TextSearch::print_results($results, $opts);
}
}
?>