mirror of
https://git.bakhai.co.in/FbIN/LibreY.git
synced 2025-11-03 11:31:32 +05:30
Synced
Update qwant search engine. (f8b0d94468) && (2c6b577f5b) chore: merge pull request 227 from davidovski/main Update image.php
This commit is contained in:
parent
845b229312
commit
dca71e3ed1
1 changed files with 9 additions and 4 deletions
|
|
@ -3,7 +3,12 @@
|
|||
public function get_request_url() {
|
||||
$offset = $this->page * 5; // load 50 images per page
|
||||
$query = urlencode($this->query);
|
||||
return "https://api.qwant.com/v3/search/images?q=$query&t=images&count=50&locale=en_us&offset=$offset&device=desktop&tgp=3&safesearch=1";
|
||||
$url = "https://api.qwant.com/v3/search/images?q=$query&t=images&count=50&locale=en_us&offset=$offset&device=desktop&tgp=3";
|
||||
|
||||
if (isset($_COOKIE["safe_search"]))
|
||||
$url .= "&safesearch=1";
|
||||
|
||||
return $url;
|
||||
}
|
||||
|
||||
public function parse_results($response) {
|
||||
|
|
@ -18,7 +23,7 @@
|
|||
|
||||
for ($i = 0; $i < $imgCount; $i++)
|
||||
{
|
||||
array_push($results,
|
||||
array_push($results,
|
||||
array (
|
||||
"thumbnail" => htmlspecialchars($imgs[$i]["thumbnail"]),
|
||||
"alt" => htmlspecialchars($imgs[$i]["title"]),
|
||||
|
|
@ -35,7 +40,7 @@
|
|||
|
||||
foreach($results as $result)
|
||||
{
|
||||
if (!$result
|
||||
if (!$result
|
||||
|| !array_key_exists("url", $result)
|
||||
|| !array_key_exists("alt", $result))
|
||||
continue;
|
||||
|
|
@ -52,4 +57,4 @@
|
|||
echo "</div>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
?>
|
||||
Loading…
Add table
Add a link
Reference in a new issue