diff options
| author | Igor Soarez <igor@soarez.org> | 2026-08-03 22:09:48 +0100 |
|---|---|---|
| committer | Igor Soarez <igor@soarez.org> | 2026-08-03 22:09:48 +0100 |
| commit | 7a8f261ec50b9c15bc37ba8ae1f0022c392111d3 (patch) | |
| tree | 2157aaa360c41577910267fb513a9980920cc743 /src/engines.ts | |
| parent | 97b7804d02d0a8ffc9afdc64069069baf93ef392 (diff) | |
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.
Diffstat (limited to 'src/engines.ts')
| -rw-r--r-- | src/engines.ts | 8 |
1 files changed, 5 insertions, 3 deletions
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/`, }, |
