added back wiki image results, updated the user agent string, updated readme

This commit is contained in:
hnhx 2022-03-30 13:18:31 +02:00
parent 9e0709d77d
commit 2905501d42
5 changed files with 34 additions and 6 deletions

View File

@ -25,6 +25,7 @@ Your request will be **rejected** if your instance:
+ Torrent results from popular torrent sites
+ Special queries (e.g.: 1 btc to usd , what does xyz mean etc.)
+ Tracking snippets from URLs are removed
+ Multiple color themes
+ Image results are converted to base64 to prevent clients from connecting to Google servers
+ Supports both POST and GET requests
+ 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.
# 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>

View File

@ -28,7 +28,7 @@
// CURLOPT_PROXYTYPE => CURLPROXY_HTTP,
CURLOPT_RETURNTRANSFER => true,
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_CUSTOMREQUEST => "GET",
CURLOPT_SSL_VERIFYHOST => false,

View File

@ -53,7 +53,7 @@
$url = "https://api.dictionaryapi.dev/api/v2/entries/en/$word_to_define";
break;
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;
}
@ -141,6 +141,8 @@
$source = $special["special_response"]["source"];
echo "<p class=\"special-result-container\">";
if (array_key_exists("image", $special["special_response"]))
echo "<img src=\"" . $special["special_response"]["image"] . "\">";
echo $response;
echo "<a href=\"$source\" target=\"_blank\">$source</a>";
echo "</p>";

View File

@ -12,12 +12,17 @@
$description = substr($first_page["extract"], 0, 250) . "...";
$source = "https://en.wikipedia.org/wiki/$query";
return array(
$response = array(
"special_response" => array(
"response" => $description,
"source" => $source
)
);
if (array_key_exists("thumbnail", $first_page))
$response["special_response"]["image"] = $first_page["thumbnail"]["source"];
return $response;
}
}
?>

View File

@ -191,6 +191,15 @@ a:hover, .text-result-wrapper h2:hover {
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 {
margin-top:-50px;
margin-bottom:100px;
@ -200,8 +209,8 @@ a:hover, .text-result-wrapper h2:hover {
border:none;
background-color: inherit;
color: var(--result-link-fg);
font-size: 20px;
margin-right: 6px;
font-size: 18px;
margin-right: 8px;
}
.next-page-button-wrapper #page {
@ -304,6 +313,10 @@ a:hover, .text-result-wrapper h2:hover {
max-width: 80%;
}
.special-result-container img {
max-width: 80%;
}
.misc-container {
margin-bottom: 200px;
width: 95%;