From 7a8f261ec50b9c15bc37ba8ae1f0022c392111d3 Mon Sep 17 00:00:00 2001 From: Igor Soarez Date: Mon, 3 Aug 2026 22:09:48 +0100 Subject: Take Brave snippets by position rather than by class name Brave's source name was leaking into every snippet ("Medium March 27, 2025 - ..."), because the .sitename/.netloc selectors guessed for it match nothing. Rather than guess again, use the ordering: an engine rendering "source / breadcrumb / title / description" puts all its metadata before the title, so everything after the title line is the description. Class names churn; that ordering does not. The named selectors stay as the fallback for when the title is not on a line of its own. Verified against Brave, and Google/DuckDuckGo/Bing re-checked for regressions. --- src/engines.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/engines.ts') diff --git a/src/engines.ts b/src/engines.ts index 79462fc..a71b9c8 100644 --- a/src/engines.ts +++ b/src/engines.ts @@ -190,9 +190,11 @@ const BRAVE: EngineDefinition = { item: '.snippet[data-type="web"]', link: "a[href]", title: ".title", - // No dedicated description element; the item's text is - // "source | breadcrumb | title | description", so subtract the first three. - subtract: [".title", "cite", ".sitename", ".netloc"], + // No dedicated description element. The item's text is + // "source | breadcrumb | title | description", so the extractor keeps only + // the lines after the title. These selectors are the fallback for when the + // title is not on a line of its own. + subtract: [".title", "cite"], unwrap: "none", selfHostPattern: String.raw`^https?://(search\.)?brave\.com/`, }, -- cgit v1.3.1