From f9c6602cc1e833b6dc17ee4e243e4c038c802ade Mon Sep 17 00:00:00 2001 From: mat Date: Sun, 1 Sep 2024 21:01:34 +0000 Subject: [PATCH] make google featured snippet selector stricter --- src/engines/search/google.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/engines/search/google.rs b/src/engines/search/google.rs index dbd2ebb..31c6505 100644 --- a/src/engines/search/google.rs +++ b/src/engines/search/google.rs @@ -53,10 +53,10 @@ pub fn parse_response(body: &str) -> eyre::Result { Ok(description) }))) - .featured_snippet_title("h3") + .featured_snippet_title(".g > div[lang] a h3") .featured_snippet_href(QueryMethod::Manual(Box::new(|el: &ElementRef| { let url = el - .select(&Selector::parse("div[lang] a").unwrap()) + .select(&Selector::parse(".g > div[lang] a:has(h3)").unwrap()) .next() .and_then(|n| n.value().attr("href")) .unwrap_or_default();