Skip to content

Search filter: Brave Search, Yahoo and Swisscows; fix DuckDuckGo html - #38

Merged
codepurse merged 2 commits into
mainfrom
feature/more-search-engines
Oct 29, 2026
Merged

codepurse merged 2 commits into
mainfrom
feature/more-search-engines

Conversation

@codepurse

Copy link
Copy Markdown
Owner

A user asked for more engines in the Search Result Filter, citing uBlacklist. This adds Brave Search, Yahoo and Swisscows, and fixes DuckDuckGo's html version, where the filter did nothing at all.

Engines

Each entry was read off the live page (October 2026) and checked there with the real extension loaded: a hide rule, a colour rule, the notice, and a real click reaching the "why?" marker. Afterwards it was checked again in the user's own Chrome.

  • Brave Search: div.snippet[data-type="web"] in #mixed-main, one .title, direct links. The result and title selectors follow uBlacklist's SERPINFO for Brave (MIT), credited in the code.
  • Yahoo: #web div.algo, one h3, direct links. Checked on search.yahoo.com, uk. and fr.; the regional sites put the link inside the h3, so resultUrl() now takes the heading's link whether it wraps the heading or sits inside it.
  • Swisscows: article.item in .web-results, one h1. Two new optional engine fields:
    • site: searching from Swisscows' home page shows the results without loading a page, so the script stays idle on that host until a results URL appears, instead of quitting on the home page.
    • markerIn: "footer": Swisscows pins its own buttons (like, share, more) absolutely into each result's top-right corner, where the marker floated on top of one.

DuckDuckGo html (two bugs, both broken on main)

  • Searched from its own box, the form POSTs to /html/, so the address has no ?q= and the engine test failed. It now accepts /html/.
  • Opened from a ?q= link, every result link is protocol-relative (//duckduckgo.com/l/?uddg=…), and resultUrl() refused anything not starting with http, before resolve could unwrap it. It now accepts //… links.

Lite is not covered: each result is four <tr>s of one table with nothing around them to hide, so there is no block for the filter to work on.

Fixes found while checking

  • Hidden count: taken from the page after every pass instead of kept as a running total. Brave swaps its server-rendered results for fresh copies as its script starts, and the total said "hid 4" over two hidden results. Swisscows replaces one search's results with the next without loading a page.
  • Colour bar: the padding and negative margin are now !important as a pair. Yahoo's stylesheet won the margin alone, which pushed coloured results 10px to the right; Bing's won both, which left the bar pressed against the text. Measured live afterwards on Bing, DuckDuckGo, DuckDuckGo html, Yahoo, Brave and Swisscows: the text no longer moves.
  • Notice rewritten every frame (second commit, pre-existing on main): updateNotice() rewrote the notice on every pass, and each write triggered the observer, which queued another pass. While anything was hidden, the filter ran on every animation frame for as long as the page was open: 453 notice mutations in two seconds on a Bing page at rest, on main. It's 0 now. Text is written only when it differs, and the By site list is rebuilt only when its rows change.

Tests

npm test: 776 pass. test/search-filter-serp-test.mjs gains seven pages:

  • DuckDuckGo html, opened from a link and after a POSTed search
  • Brave, and Brave re-rendering its results
  • Swisscows with its corner buttons, and a home-page search followed by a second search
  • Yahoo with its margin-winning CSS

It also gains a check that the notice is not written at rest. Each new case was confirmed to fail with its fix undone.

Not in this PR

  • Qwant: "not yet available in your country" from this network, in every browser tried, so its markup could not be read. No entry was added.
  • Startpage and Ecosia (optional): both serve bot checks; skipped rather than worked around.
  • Google was not re-checked live after the colour-bar change (it served its unusual-traffic page); the fixture test covers it.

Notes

  • Injection budget (build.yml): 163,245 of 165,000 bytes per top frame, up from about 160,745. The next engine will likely need the decision build.yml describes: register the script for search hosts instead of <all_urls>.
  • Changelog: an unreleased 1.5.2 entry, since main is at 1.5.1 and the Pro branch uses 1.6.0. Rename it or fold it into 1.6.0 if this ships with Pro.

codepurse and others added 2 commits October 29, 2026 15:52
New engine entries, each read off the live page (October 2026) and
checked there with the real extension: a hide rule and a colour rule,
the notice, and a real click reaching the marker.

- Brave Search: div.snippet[data-type="web"] in #mixed-main. Result and
  title selectors follow uBlacklist's SERPINFO for Brave (MIT).
- Yahoo: #web div.algo with one h3; the regional sites put the link
  inside the h3, so resultUrl() now takes the heading's link either way.
- Swisscows: article.item in .web-results. Searching from its home page
  shows results without a page load, so an engine can name its `site`:
  the script stays there, idle, until a results page appears. Its own
  buttons fill each result's top-right corner, so `markerIn` puts the
  marker in the footer instead of on top of one.

DuckDuckGo html: a search typed on the page POSTs to /html/, leaving no
?q= for the engine test; and opened from a ?q= link, every result link
is the protocol-relative //duckduckgo.com/l/?uddg=..., which resultUrl()
refused as not absolute. Neither page was filtered at all; both are now.
Lite is not covered: each result spans four rows of one table, with no
element around them to hide.

The hidden count is now taken from the page after every pass instead of
kept as a running total. Brave swaps its first results for fresh copies
as its script starts, and the running total said "hid 4" over two
hidden results; Swisscows replaces one search's results with the next.

The colour bar's padding and negative margin are !important as a pair.
Yahoo's stylesheet won the margin alone (text pushed 10px right), Bing's
won both (bar pressed against the text).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
updateNotice() runs after every pass and rewrote the notice's text (and
rebuilt the open "By site" list) each time, even with nothing changed.
The notice sits in the page the MutationObserver watches, so each write
queued another pass, which wrote it again: while anything was hidden,
the filter ran on every animation frame for as long as the page was
open. Measured live with the extension loaded: 453 notice mutations in
two seconds on a Bing page at rest, on main as well as this branch; 0
after this change, on Bing and Brave.

Text is now written only when it differs, and the By site list is
rebuilt only when its rows change. The SERP test watches the notice for
200ms at rest on the pages that have a frame clock (headless Chrome
draws no frames without one, so the loop cannot show elsewhere).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codepurse
codepurse merged commit 33b99c5 into main Oct 29, 2026
1 check passed
@codepurse
codepurse deleted the feature/more-search-engines branch October 29, 2026 13:59
codepurse added a commit that referenced this pull request Oct 30, 2026
Brings in the Google Search cleanup (#36), Brave, Yahoo and Swisscows in
the Search Result Filter (#38) and the 1.5.1 release merges.

One conflict, in common/changelog.js: both sides added a new entry at
the top. Both are kept, 1.6.0 above 1.5.2, so neither release loses its
notes. npm test 892, test:pro 59.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant