mirror of
https://github.com/hnhx/librex.git
synced 2025-04-29 14:09:27 -04:00
added back wiki image results, updated the user agent string, updated readme
This commit is contained in:
parent
9e0709d77d
commit
2905501d42
5 changed files with 34 additions and 6 deletions
10
README.md
10
README.md
|
@ -25,6 +25,7 @@ Your request will be **rejected** if your instance:
|
||||||
+ Torrent results from popular torrent sites
|
+ Torrent results from popular torrent sites
|
||||||
+ Special queries (e.g.: 1 btc to usd , what does xyz mean etc.)
|
+ Special queries (e.g.: 1 btc to usd , what does xyz mean etc.)
|
||||||
+ Tracking snippets from URLs are removed
|
+ Tracking snippets from URLs are removed
|
||||||
|
+ Multiple color themes
|
||||||
+ Image results are converted to base64 to prevent clients from connecting to Google servers
|
+ Image results are converted to base64 to prevent clients from connecting to Google servers
|
||||||
+ Supports both POST and GET requests
|
+ Supports both POST and GET requests
|
||||||
+ Popular social media sites (YouTube, Instagram, Twitter) are replaced with privacy friendly front-ends
|
+ Popular social media sites (YouTube, Instagram, Twitter) are replaced with privacy friendly front-ends
|
||||||
|
@ -51,4 +52,11 @@ Example API request: `.../api.php?q=gentoo&p=2&type=0` <br/><br/>
|
||||||
The API also supports both POST and GET requests.
|
The API also supports both POST and GET requests.
|
||||||
|
|
||||||
# Donate
|
# Donate
|
||||||
Monero (XMR): `41dGQr9EwZBfYBY3fibTtJZYfssfRuzJZDSVDeneoVcgckehK3BiLxAV4FvEVJiVqdiW996zvMxhFB8G8ot9nBFqQ84VkuC`
|
### Monero (XMR)
|
||||||
|
Address: `41dGQr9EwZBfYBY3fibTtJZYfssfRuzJZDSVDeneoVcgckehK3BiLxAV4FvEVJiVqdiW996zvMxhFB8G8ot9nBFqQ84VkuC`
|
||||||
|
|
||||||
|
QR code:
|
||||||
|
|
||||||
|
<p align="left">
|
||||||
|
<img src="https://user-images.githubusercontent.com/49120638/160815173-dea8b0ee-1b1c-4ead-868d-01313ec28350.png">
|
||||||
|
</p>
|
|
@ -28,7 +28,7 @@
|
||||||
// CURLOPT_PROXYTYPE => CURLPROXY_HTTP,
|
// CURLOPT_PROXYTYPE => CURLPROXY_HTTP,
|
||||||
CURLOPT_RETURNTRANSFER => true,
|
CURLOPT_RETURNTRANSFER => true,
|
||||||
CURLOPT_ENCODING => "",
|
CURLOPT_ENCODING => "",
|
||||||
CURLOPT_USERAGENT => "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.102 Safari/537.36",
|
CURLOPT_USERAGENT => "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.82 Safari/537.36",
|
||||||
CURLOPT_IPRESOLVE => CURL_IPRESOLVE_V4,
|
CURLOPT_IPRESOLVE => CURL_IPRESOLVE_V4,
|
||||||
CURLOPT_CUSTOMREQUEST => "GET",
|
CURLOPT_CUSTOMREQUEST => "GET",
|
||||||
CURLOPT_SSL_VERIFYHOST => false,
|
CURLOPT_SSL_VERIFYHOST => false,
|
||||||
|
|
|
@ -53,7 +53,7 @@
|
||||||
$url = "https://api.dictionaryapi.dev/api/v2/entries/en/$word_to_define";
|
$url = "https://api.dictionaryapi.dev/api/v2/entries/en/$word_to_define";
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
$url = "https://en.wikipedia.org/w/api.php?format=json&action=query&prop=extracts&explaintext&redirects=1&titles=$query_encoded";
|
$url = "https://en.wikipedia.org/w/api.php?format=json&action=query&prop=extracts%7Cpageimages&exintro&explaintext&redirects=1&pithumbsize=500&titles=$query_encoded";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -141,6 +141,8 @@
|
||||||
$source = $special["special_response"]["source"];
|
$source = $special["special_response"]["source"];
|
||||||
|
|
||||||
echo "<p class=\"special-result-container\">";
|
echo "<p class=\"special-result-container\">";
|
||||||
|
if (array_key_exists("image", $special["special_response"]))
|
||||||
|
echo "<img src=\"" . $special["special_response"]["image"] . "\">";
|
||||||
echo $response;
|
echo $response;
|
||||||
echo "<a href=\"$source\" target=\"_blank\">$source</a>";
|
echo "<a href=\"$source\" target=\"_blank\">$source</a>";
|
||||||
echo "</p>";
|
echo "</p>";
|
||||||
|
|
|
@ -12,12 +12,17 @@
|
||||||
$description = substr($first_page["extract"], 0, 250) . "...";
|
$description = substr($first_page["extract"], 0, 250) . "...";
|
||||||
|
|
||||||
$source = "https://en.wikipedia.org/wiki/$query";
|
$source = "https://en.wikipedia.org/wiki/$query";
|
||||||
return array(
|
$response = array(
|
||||||
"special_response" => array(
|
"special_response" => array(
|
||||||
"response" => $description,
|
"response" => $description,
|
||||||
"source" => $source
|
"source" => $source
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (array_key_exists("thumbnail", $first_page))
|
||||||
|
$response["special_response"]["image"] = $first_page["thumbnail"]["source"];
|
||||||
|
|
||||||
|
return $response;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
|
@ -191,6 +191,15 @@ a:hover, .text-result-wrapper h2:hover {
|
||||||
font-size:14px;
|
font-size:14px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.special-result-container img {
|
||||||
|
display: flex;
|
||||||
|
max-width: 60%;
|
||||||
|
max-height: 200px;
|
||||||
|
padding-bottom:10px;
|
||||||
|
margin-left:auto;
|
||||||
|
margin-right:auto;
|
||||||
|
}
|
||||||
|
|
||||||
.next-page-button-wrapper {
|
.next-page-button-wrapper {
|
||||||
margin-top:-50px;
|
margin-top:-50px;
|
||||||
margin-bottom:100px;
|
margin-bottom:100px;
|
||||||
|
@ -200,8 +209,8 @@ a:hover, .text-result-wrapper h2:hover {
|
||||||
border:none;
|
border:none;
|
||||||
background-color: inherit;
|
background-color: inherit;
|
||||||
color: var(--result-link-fg);
|
color: var(--result-link-fg);
|
||||||
font-size: 20px;
|
font-size: 18px;
|
||||||
margin-right: 6px;
|
margin-right: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.next-page-button-wrapper #page {
|
.next-page-button-wrapper #page {
|
||||||
|
@ -304,6 +313,10 @@ a:hover, .text-result-wrapper h2:hover {
|
||||||
max-width: 80%;
|
max-width: 80%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.special-result-container img {
|
||||||
|
max-width: 80%;
|
||||||
|
}
|
||||||
|
|
||||||
.misc-container {
|
.misc-container {
|
||||||
margin-bottom: 200px;
|
margin-bottom: 200px;
|
||||||
width: 95%;
|
width: 95%;
|
||||||
|
|
Loading…
Add table
Reference in a new issue