diff options
| author | lolcat <will@lolcat.ca> | 2026-06-14 15:10:55 -0400 |
|---|---|---|
| committer | Pinapelz <yukais@pinapelz.com> | 2026-06-21 14:54:20 -0700 |
| commit | 0a487e128c0db215c1c2b3103ff741cb8fc9d3b5 (patch) | |
| tree | 48751284e80e5884dc9782192b2728b82c83ad44 /scraper/qwant.php | |
| parent | 083e87b2ace0e3a0446b484d19c7201e133d1997 (diff) | |
qwant fix
Diffstat (limited to 'scraper/qwant.php')
| -rw-r--r-- | scraper/qwant.php | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/scraper/qwant.php b/scraper/qwant.php index c242de7..e65fc73 100644 --- a/scraper/qwant.php +++ b/scraper/qwant.php @@ -217,15 +217,19 @@ class qwant{ $headers = [ "User-Agent: " . config::USER_AGENT, "Accept: application/json, text/plain, */*", - "Accept-Language: en-US,en;q=0.5", - "Accept-Encoding: gzip", + "Accept-Language: en-US,en;q=0.9", + "Accept-Encoding: gzip, deflate, br, zstd", + "Referer: https://www.qwant.com/", + "Origin: https://www.qwant.com", "DNT: 1", + "Sec-GPC: 1", "Connection: keep-alive", - "Origin: https://www.qwant.com", - "Referer: https://www.qwant.com/", "Sec-Fetch-Dest: empty", "Sec-Fetch-Mode: cors", "Sec-Fetch-Site: same-site", + "Priority: u=4", + "Pragma: no-cache", + "Cache-Control: no-cache", "TE: trailers" ]; @@ -297,7 +301,8 @@ class qwant{ "device" => "desktop", "tgp" => 3, "safesearch" => 0, - "displayed" => "true" + "displayed" => "true", + "llm" => "false" ]; switch($get["nsfw"]){ @@ -316,7 +321,7 @@ class qwant{ $json = $this->get( $proxy, - "https://fdn.qwant.com/v3/search/web", + "https://api.qwant.com/v3/search/web", $params ); @@ -353,6 +358,8 @@ class qwant{ "related" => [] ]; + $this->detect_errors($json); + if( $json["status"] != "success" && $json["data"]["error_code"] === 5 @@ -362,8 +369,6 @@ class qwant{ return $out; } - $this->detect_errors($json); - if(!isset($json["data"]["result"]["items"]["mainline"])){ throw new Exception("Server did not return a result object"); |
