mirror of
https://github.com/neon-mmd/websurfx.git
synced 2024-12-22 12:28:21 -05:00
🚑️ fix(engine): fix the pagination code for duckduckgo
engine (#468)
This commit is contained in:
parent
d073aa247a
commit
0dd25aacb6
@ -51,15 +51,14 @@ 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 | 0 => {
|
||||
0 => {
|
||||
format!("https://html.duckduckgo.com/html/?q={query}&s=&dc=&v=1&o=json&api=/d.js")
|
||||
}
|
||||
_ => {
|
||||
format!(
|
||||
"https://duckduckgo.com/html/?q={}&s={}&dc={}&v=1&o=json&api=/d.js",
|
||||
query,
|
||||
(page / 2 + (page % 2)) * 30,
|
||||
(page / 2 + (page % 2)) * 30 + 1
|
||||
"https://duckduckgo.com/html/?q={query}&s={}&dc={}&v=1&o=json&api=/d.js",
|
||||
page * 30,
|
||||
page * 30 + 1
|
||||
)
|
||||
}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user