mirror of
https://github.com/neon-mmd/websurfx.git
synced 2024-11-21 21:48:21 -05:00
Merge pull request #165 from neon-mmd/patch-searx-results-on-first-page
🛠️ Handle page value returned from search query parameter
This commit is contained in:
commit
372a5145b6
2
Cargo.lock
generated
2
Cargo.lock
generated
@ -3511,7 +3511,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "websurfx"
|
name = "websurfx"
|
||||||
version = "0.15.1"
|
version = "0.15.2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"actix-files",
|
"actix-files",
|
||||||
"actix-web",
|
"actix-web",
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "websurfx"
|
name = "websurfx"
|
||||||
version = "0.15.1"
|
version = "0.15.2"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
description = "An open-source alternative to Searx that provides clean, ad-free, and organic results with incredible speed while keeping privacy and security in mind."
|
description = "An open-source alternative to Searx that provides clean, ad-free, and organic results with incredible speed while keeping privacy and security in mind."
|
||||||
repository = "https://github.com/neon-mmd/websurfx"
|
repository = "https://github.com/neon-mmd/websurfx"
|
||||||
|
@ -47,7 +47,7 @@ impl SearchEngine for DuckDuckGo {
|
|||||||
// Page number can be missing or empty string and so appropriate handling is required
|
// Page number can be missing or empty string and so appropriate handling is required
|
||||||
// so that upstream server recieves valid page number.
|
// so that upstream server recieves valid page number.
|
||||||
let url: String = match page {
|
let url: String = match page {
|
||||||
1 => {
|
1 | 0 => {
|
||||||
format!("https://html.duckduckgo.com/html/?q={query}&s=&dc=&v=1&o=json&api=/d.js")
|
format!("https://html.duckduckgo.com/html/?q={query}&s=&dc=&v=1&o=json&api=/d.js")
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
|
@ -45,7 +45,10 @@ impl SearchEngine for Searx {
|
|||||||
) -> Result<HashMap<String, RawSearchResult>, EngineError> {
|
) -> Result<HashMap<String, RawSearchResult>, EngineError> {
|
||||||
// Page number can be missing or empty string and so appropriate handling is required
|
// Page number can be missing or empty string and so appropriate handling is required
|
||||||
// so that upstream server recieves valid page number.
|
// so that upstream server recieves valid page number.
|
||||||
let url: String = format!("https://searx.work/search?q={query}&pageno={page}");
|
let url: String = match page {
|
||||||
|
0 | 1 => format!("https://searx.work/search?q={query}&pageno=1"),
|
||||||
|
_ => format!("https://searx.work/search?q={query}&pageno={page}"),
|
||||||
|
};
|
||||||
|
|
||||||
// initializing headers and adding appropriate headers.
|
// initializing headers and adding appropriate headers.
|
||||||
let mut header_map = HeaderMap::new();
|
let mut header_map = HeaderMap::new();
|
||||||
|
Loading…
Reference in New Issue
Block a user