Repository navigation
Behaviour changes. (1) A run through a proxy now makes one pre-check
request before its first page request, inhttp_scraper.pyand all three
browser engines. A proxy that answers HTTP 407 or 402 ends the run
with exit 5 and<out>.latest_attempt.meta.json(status: failed,
stop_reason: proxy_auth_failed/proxy_balance_exhausted) instead of
failing every retry. (2) Through a local proxy, the browser engines no
longer download images, video/audio or fonts;--load-media(or
SLEEPNUMBER_LOAD_MEDIA=1) restores them. Runs without a proxy, over
--cdp-endpoint, and the HTML-onlyhttp_scraper.pyfetch are otherwise
unchanged. (3) A run through a local proxy now stops at 10 MB of proxy
traffic by default (--proxy-budget-mb,0= no cap), in every entry
point: it keeps its rows and exits 6 (5 with none) with
stop_reason: proxy_budget_exceeded, and it always writes
<out>.latest_attempt.meta.json.(4) Exit codes that used to misname the cause. The site's own 404
exits 4 (was 3, "blocked").selenium_scraper.pywith a proxy that
has a login and password exits 2 before starting a browser (was 3,
blocked_blocked).puppeteer_scraper.pyexits 5 with
stop_reason: browser_launch_failedwhen Chromium does not start (was a
traceback and 1). A page refused without a recognised vendor records
stop_reason: blocked, notblocked_blocked.
Added
-
proxy_meter.py: per-run proxy traffic meter and budget, in the three
browser engines andhttp_scraper.py, only through a local proxy.
Playwright sumsrequest.sizes(); pyppeteer and Selenium count CDP
Network.loadingFinished.encodedDataLengthplus each request's own size;
http_scraper.pycounts every response hop and its request. Over budget,
Playwright aborts new requests in a route, pyppeteer/Selenium block every
URL over CDP, and every entry point stops before its next request; the
--concurrencyworkers share one budget. New sidecar fields
proxy_bytes,proxy_budget_bytes,proxy_budget_exceeded; a closing
log lineProxy traffic: X.X MB of Y MB budget.--proxy-budget-mband
SLEEPNUMBER_PROXY_BUDGET_MB(in.env.example). -
CI only: every canary run passes
--proxy-budget-mb 10, its proxy
traffic goes to the step summary, and the job fails with
::error::stopped: proxy budget 10 MB exceededwhen a run hit the cap
(.github/proxy_traffic.py). -
Offline checks: the meter against known CDP and Playwright sizes,
http_scraper.pythrough a byte-counting stub proxy, the sidecars and
exit codes over budget, every engine driven past the budget, concurrent
workers sharing it, the canary step and its summary script. An opt-in
real-browser check (PROXY_METER_BROWSER=1) compares each driver's count
with a stub proxy's. -
proxy_check.py: the proxy pre-check (one CONNECT plusHEAD /robots.txt
on www.sleepnumber.com, no third-party service), shared by
http_scraper.pyand the browser engines, plus media blocking for the
three browser engines. The 407 message namesSLEEPNUMBER_PROXYand says
the gateway refused the credential (or the traffic balance is exhausted);
a 402 says the proxy traffic/balance is exhausted. Neither prints the
credential. A proxy that does not answer keeps the existing retry
behaviour. -
--load-mediaon the three browser engines, andSLEEPNUMBER_LOAD_MEDIA
in.env.example. -
Offline checks:
- a stub proxy that answers 407/402/200 or nothing;
http_scraper.pyand each engine driven to exit 5 on a 407, with no
page request and no browser;- the attempt sidecar;
- the Playwright route handler, the pyppeteer Fetch patterns and the
Selenium blocked-URL list; - when each engine installs blocking.
Changed
- CI only: the canary bills the
SLEEPNUMBER_PROXYexit, so it now runs weekly
(Mondays 11:23 UTC) instead of daily; a manual dispatch still runs it.
Fixed
-
The Docker image failed to build with playwright 1.65: its bundled node needs
libatomic.so.1, whichpython:3.12-slimlacks, soplaywright installexited 127. The Dockerfile now installslibatomic1first. -
The site's own 404 (for example
--mode product --category i8) is reported as not found, exit 4, with a message naming the URL. CloudFront writesx-cache: Error from cloudfronton every 4xx/5xx, the site's 404 included, and that header alone used to make the page a block (exit 3) inhttp_scraper.py, Playwright and pyppeteer. It now counts as a refusal only when the body carries none of the site's assets. A 5xx the application rendered is retried rather than reported as not found. -
selenium_scraper.pywith a proxy that has a login and password now stops with exit 2 before starting a browser and says why (chromedriver cannot send a proxy password). It used to start Chrome without the credential, get the proxy's 407 and report exit 3 as though the site had refused. A credential the gateway itself rejects still ends with exit 5,proxy_auth_failed. -
A page refused without a recognised vendor records
stop_reason: blocked, notblocked_blocked, in every engine. -
puppeteer_scraper.py: when Chromium does not start, the run ends with exit 5,stop_reason: browser_launch_failedand a pointer to--chromium-path, instead of a traceback and exit 1. pyppeteer's own exit hook, which could only raise "This event loop is already running", is no longer installed. -
http_scraper.pyaccepts--concurrencylike the browser engines. Every entry point now logs the same reason why it has no effect on this site, and runs sequentially. The Selenium and pyppeteer message no longer names a--mode transfersthat does not exist here. -
The proxy pre-check verifies the site's TLS certificate against
certifi, asrequestsdoes. With Python from python.org on macOS (no system root certificates), every pre-check used to end withsite: SSLCertVerificationErrorwhile the fetch itself worked. -
Proxy budgets and traffic under 1 MB are logged with two significant figures:
--proxy-budget-mb 0.05reads0.05 MB, not0.1 MB, and 0.04 no longer reads0.0 MB. -
The proxy example in the README,
.env.exampleandlanding.mduses the login as the 2Captcha dashboard shows it and theeu.proxy.2captcha.comgateway. The bareproxy.2captcha.comis not a gateway (the connection times out), and a-zone-resilogin was refused with HTTP 407. Pinning a US exit is shown as-zone-custom-region-us. -
The README says to keep engine virtualenvs outside the clone: the offline checks skip only a directory named
.venv, and third-party code in any other in-clone virtualenv fails them. -
The pyppeteer and Selenium proxy meter counts only
http:///https://requests and responses that came over the network. Chrome's own loads (thechrome://new-tab page,data:,blob:), cache hits (requestServedFromCache,fromDiskCache,fromPrefetchCache,fromServiceWorker) and Chrome's error page count nothing. A sibling repo's Selenium run had counted about 2.8 MB of new-tab scripts while its proxy carried about 6 KB. The pyppeteer block sent once the budget is spent now reaches the page's own event loop even when the budget runs out on another thread.