feat(HNT-2891): select the Zyte extraction mode per domain - #24
Draft
mmiermans wants to merge 1 commit into
Draft
Conversation
mmiermans
force-pushed
the
claude/hnt-2086-corpus-section-items
branch
from
July 6, 2026 17:08
2ce2154 to
a212372
Compare
mmiermans
force-pushed
the
claude/hnt-2086-extraction-mode
branch
from
July 6, 2026 17:08
f93e84f to
3f46f63
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Goal
HNT-2891
Add
resolveExtractFrom, which picks the Zyte extraction source for a URL and product so the crawler pays for cheap plain-HTTP extraction where the legacy quality gates already proved it works and uses full browser rendering everywhere else. This builds on the crawl-common utils slice by using itsgetRegistrableDomainfunction to collapse subdomains onto one lookup key. docs/ARCHITECTURE.md in #14 shows where the extraction step sits in the crawl flow.Implementation decisions
httpResponseBodyfor an allowlist of domains andbrowserHtmlfor everything elseresolveExtractFromlooks the registrable domain up in a per-product cheap-domain set and returnshttpResponseBodyon a hit, otherwisebrowserHtmlhttpResponseBodyis a plain HTTP fetch with no headless browser, so it is materially cheaper per Zyte call, but it fails on a JavaScript-heavy publisher. The allowlist is the set of domains the legacy crawler quality gates already proved extract correctly over plain HTTP, andbrowserHtmlrenders JavaScript so any other publisher still yields a full article. content-monorepo'scurated-corpus-apiusesextractFrom: 'browserHtml'as its Zyte default, which matches our fallback.browserHtmland accept the higher Zyte costbrowserHtmlfor every domain not on the cheap allowlist, so most crawled domains, mainly international publishers the legacy gates never evaluated, take the more expensive browser-rendering patharticleandarticleListsets, so a domain cleared for article extraction is not automatically cleared for article-list extractiongetRegistrableDomain(url)from crawl-common, sowww.and other subdomains collapse to one entrybrowserHtmlfor an unknown or unparseable URLbrowserHtmlzyte-cheap-domains.tsholds the two lists as plain arrays ported from the legacy content-ml-services quality gates (zyte_domains.py)theguardian.com, which sits in both cheap lists and so takes the plainhttpResponseBodypath for both the article and article-list products. This keeps its crawl behavior the same as the existing content-ml-services solution, which lists it in both of itshttpResponseBodydomain sets, and that parity is the reason for the choice. The Guardian bot protection also returns HTTP 451 to Zyte'sbrowserHtmlbrowser fetch, so the cheap path is the one that reliably extracts.