diff --git a/Cargo.lock b/Cargo.lock index 2bb4253..f05e8b8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3511,7 +3511,7 @@ dependencies = [ [[package]] name = "websurfx" -version = "0.15.1" +version = "0.15.2" dependencies = [ "actix-files", "actix-web", diff --git a/Cargo.toml b/Cargo.toml index c8ceda3..0ab7994 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "websurfx" -version = "0.15.1" +version = "0.15.2" 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." repository = "https://github.com/neon-mmd/websurfx" diff --git a/src/engines/duckduckgo.rs b/src/engines/duckduckgo.rs index 487e120..42f4994 100644 --- a/src/engines/duckduckgo.rs +++ b/src/engines/duckduckgo.rs @@ -47,7 +47,7 @@ impl SearchEngine for DuckDuckGo { // Page number can be missing or empty string and so appropriate handling is required // so that upstream server recieves valid page number. 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") } _ => { diff --git a/src/engines/searx.rs b/src/engines/searx.rs index 5fd7354..ab73ee0 100644 --- a/src/engines/searx.rs +++ b/src/engines/searx.rs @@ -45,7 +45,10 @@ impl SearchEngine for Searx { ) -> Result, EngineError> { // Page number can be missing or empty string and so appropriate handling is required // 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. let mut header_map = HeaderMap::new();