Skip to content
rewget GitHub

Home / Use cases / Downloads behind Cloudflare or a JS challenge

Protected downloads

Downloads behind Cloudflare or a JS challenge

Fetch a file from a site that serves a JavaScript challenge instead of the file to plain HTTP clients.

The problem

Some sites put a JavaScript interstitial in front of downloads. Plain wget and curl receive the challenge HTML, not the file — so your script quietly saves a few kilobytes of challenge page instead of the artifact you wanted.

How rewget solves it

JS-challenge download
$ rewget https://protected.example/model-weights.bin
[stage 1: wget] 403 → escalating
[stage 2: rquest/chrome131] 403 → escalating
[stage 3: chromium] challenge solved → 200 OK

Questions

+ Why did plain wget save a tiny HTML file instead of my download?

That file is the JavaScript challenge page. wget cannot execute it, so it saves the interstitial. rewget's stage 3 runs the challenge in real Chromium and then fetches the actual file.

+ Is a browser launched for every download?

No. Stage 3 (Chromium) only starts when stages 1 and 2 both fail, and the working stage is then cached per domain.

Try it on your own blocked URL