Merge branch 'rolling' into patch-searx-results-on-first-page

This commit is contained in:
neon_arch 2023-07-31 13:57:34 +03:00 committed by GitHub
commit a8b6a9bce2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 26 additions and 7 deletions

View file

@ -29,6 +29,7 @@ impl SearchEngine for DuckDuckGo {
/// * `query` - Takes the user provided query to query to the upstream search engine with.
/// * `page` - Takes an u32 as an argument.
/// * `user_agent` - Takes a random user agent string as an argument.
/// * `request_timeout` - Takes a time (secs) as a value which controls the server request timeout.
///
/// # Errors
///
@ -41,6 +42,7 @@ impl SearchEngine for DuckDuckGo {
query: String,
page: u32,
user_agent: String,
request_timeout: u8,
) -> Result<HashMap<String, RawSearchResult>, EngineError> {
// Page number can be missing or empty string and so appropriate handling is required
// so that upstream server recieves valid page number.
@ -90,7 +92,7 @@ impl SearchEngine for DuckDuckGo {
);
let document: Html = Html::parse_document(
&DuckDuckGo::fetch_html_from_upstream(self, url, header_map).await?,
&DuckDuckGo::fetch_html_from_upstream(self, url, header_map, request_timeout).await?,
);
let no_result: Selector = Selector::parse(".no-results")