diff --git a/src/engines/mod.rs b/src/engines/mod.rs index e721aaa..cf4bc86 100644 --- a/src/engines/mod.rs +++ b/src/engines/mod.rs @@ -193,16 +193,17 @@ pub async fn search_with_client_and_engines( for engine in engines { requests.push(async { let engine = *engine; - progress_tx.send(ProgressUpdate::new( - ProgressUpdateKind::Requesting, - engine, - start_time, - ))?; let request_response = engine.request(client, query).into(); let response = match request_response { RequestResponse::Http(request) => { + progress_tx.send(ProgressUpdate::new( + ProgressUpdateKind::Requesting, + engine, + start_time, + ))?; + let res = request.send().await?; progress_tx.send(ProgressUpdate::new( diff --git a/src/normalize.rs b/src/normalize.rs index ea25732..40289d0 100644 --- a/src/normalize.rs +++ b/src/normalize.rs @@ -1,6 +1,7 @@ use url::Url; pub fn normalize_url(url: &str) -> eyre::Result { + let url = url.trim_end_matches('#'); if url.is_empty() { return Ok(String::new()); } diff --git a/src/parse.rs b/src/parse.rs index 428fc1d..e450d48 100644 --- a/src/parse.rs +++ b/src/parse.rs @@ -161,11 +161,17 @@ pub(super) fn parse_html_response_with_opts( let url = normalize_url(&url)?; let description = featured_snippet_description_query_method.call(&featured_snippet)?; - Some(EngineFeaturedSnippet { - url, - title, - description, - }) + // this can happen on google if you search "what's my user agent" + let is_empty = description.is_empty() && title.is_empty() && url.is_empty(); + if is_empty { + None + } else { + Some(EngineFeaturedSnippet { + url, + title, + description, + }) + } } else { None }