Update CSS selector for extracting titles in DuckDuckGo parser

Replaced the overly complex CSS selector with a simplified "h2" selector for extracting titles. This change improves maintainability and ensures accurate title extraction from the updated DOM structure.
This commit is contained in:
Steve Dudenhoeffer 2025-01-16 21:37:38 -05:00
parent 67a3552747
commit e8de488d2b

View File

@ -105,7 +105,7 @@ func (c Config) Search(ctx context.Context, b extractor.Browser, query string) (
return fmt.Errorf("failed to get link: %w", err)
}
titles := n.Select("div:nth-child(2) > div:nth-child(1) > div:nth-child(2) > p:nth-child(1)")
titles := n.Select("h2")
if len(titles) != 0 {
r.Title, _ = titles[0].Text()