Introducing crul

✦ 2026-03-16

Peter Steinberger (of OpenClaw fame) maintains the sweet-cookie (archive) library. It vends an npm artefact for fishing cookies out of various web browsers and making them available in the various Javascript runtimes. I think he uses sweet-cookie to bridge the gap between websites and APIs that require cookie-based authentication and OpenClaw.

I thought it’d be super useful if we could do the same thing with cURL. That is, authenticate cURL requests directly from the browser’s cookie store. So I’ve just published the first release of crul (pronounced “cruel”). Let me show you how it works:

Say you’re logged into a website in your web browser, and you want to access that site through cURL. crul makes that super easy:

npx @kieranhunt/crul --browsers firefox --url "https://news.ycombinator.com"
# Netscape HTTP Cookie File
# https://curl.se/docs/http-cookies.html
# This file was generated by crul.
# Edit at your own risk.


#HttpOnly_news.ycombinator.com	FALSE	/	TRUE	0	user	kieranhunt&SECRET

That spits out a Netscape HTTP Cookie File. Perfectly compatible with cURL. Avoid the intermediate step of saving the file to disk by piping the output directly into cURL:

curl \
  -b <(npx @kieranhunt/crul --browsers firefox --url "https://news.ycombinator.com") \
  --silent \
  "https://news.ycombinator.com/upvoted?id=kieranhunt" \
  | htmlq '.titleline > a' --text
  
# Show HN: C++ AWS MSK IAM Auth Implementation – Goodbye Kafka Passwords
# Two Starkly Similar Novels and the Puzzle of Plagiarism
# Browning Fever: A story of fandom, literary societies, and impenetrable verse
# Alphabet’s Sidewalk Labs seeks share of property taxes for Toronto smart city
# Cipherli.st – Strong Ciphers for Apache, Nginx and Lighttpd

crul’s CLI parameters map one-to-one to sweet-cookie’s GetCookiesOptions type. I’d like to make it so that anything you can do with sweet-cookie you can also do with crul.

Find it @ KieranHunt\/crul on GitHub or @kieranhunt/crul on npm.