Skip to content

fix: replace curl-impersonate with impit - #1

Merged
privatenumber merged 8 commits into
developfrom
refactor/ky-cookies
Mar 23, 2026
Merged

fix: replace curl-impersonate with impit#1
privatenumber merged 8 commits into
developfrom
refactor/ky-cookies

Conversation

@privatenumber

@privatenumber privatenumber commented Mar 22, 2026

Copy link
Copy Markdown
Owner

Replaces the curl_chrome145 external binary with impit — a Rust-based HTTP client with Chrome TLS fingerprint impersonation, distributed as a regular npm package with prebuilt binaries.

  • Delete curl-fetch.ts and npm-fetch.ts — replaced by impit in create-client.ts
  • All call sites: npmFetch(context, path)client.fetch(path)
  • Remove CurlFetch/CurlRequestInit/CurlResponseLike types
  • Rename NpmContextNpmInternalClient
  • Session file changes from .npm-pkg-settings.session.txt to .npm-pkg-settings.cookies.json
  • Smoke tests through createClient (GET + POST verified against Cloudflare)
  • Added: impit, tough-cookie, tough-cookie-file-store
  • Removed: nano-spawn

ky uses Node.js native fetch (undici) which has a distinct TLS
fingerprint (JA3/JA4) that Cloudflare detects and blocks with a
challenge page. impit uses a Rust-based TLS stack (patched rustls)
that impersonates Chrome's TLS handshake.

Uses chrome142 fingerprint which produces the same JA4 as
curl_chrome145: t13d1516h2_8daaf6152771_d8a2da3f94cd
- Delete create-fetch.ts — inline Impit creation into create-client.ts
- Delete npm-fetch.ts — bake base URL into context.fetch
- Simplify NpmContext.fetch type — drop NpmFetch/NpmFetchResponse
- All call sites: npmFetch(context, path) → context.fetch(path)
- Fix leading-slash edge case in URL resolution
- Smoke test uses bare Impit instance
…acks

- Smoke test now goes through createClient (not bare Impit) to catch
  misconfiguration. Tests both GET and POST requests.
- Add createClient fetch integration test for URL resolution
- Add list-packages test for missing field fallback defaults
- 87 tests total (was 82)
@privatenumber privatenumber changed the title refactor: replace curl-fetch with ky + ky-cookies refactor: replace curl-impersonate with impit Mar 23, 2026
@privatenumber
privatenumber marked this pull request as ready for review March 23, 2026 06:48
@privatenumber privatenumber changed the title refactor: replace curl-impersonate with impit fix: replace curl-impersonate with impit Mar 23, 2026
@privatenumber
privatenumber merged commit 3d24532 into develop Mar 23, 2026
2 checks passed
@privatenumber
privatenumber deleted the refactor/ky-cookies branch March 23, 2026 06:51
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