curl-to-scrapy

Convert a curl command into Scrapy code for the shell and for your spider.

Options
Browser impersonation

The curl_cffi snippet always impersonates the browser picked here.

Scrapy shell

How to convert a curl command to Scrapy

  1. Open the page you want to scrape and open DevTools (F12), then the Network tab.
  2. Reload the page and find the request that returns the data. Filtering by Fetch/XHR often finds the JSON API behind the page.
  3. Right-click the request and choose Copy → Copy as cURL. Both the bash and Windows (cmd) formats work.
  4. Paste it above. Run the Scrapy shell snippet to try the request, then copy the Spider into your project.

What you get

FAQ

Is it safe to paste curl commands with cookies or tokens?

Yes. The converter runs entirely in your browser and nothing you paste is sent anywhere. The code is open source, so you can check, or download the repo and open index.html offline.

How is this different from scrapy.Request.from_curl()?

Request.from_curl() builds a request object at runtime and ignores options it doesn't understand. This tool gives you readable code to edit (headers, a cookies dict, form or JSON payloads), a full spider, a curl_cffi check script and warnings about anything that won't translate exactly.

Why does the request work in my browser but get a 403 in Scrapy?

Often the site checks the TLS or HTTP/2 fingerprint, not just headers. Run the generated curl_cffi script: if it succeeds while plain Scrapy fails, enable the scrapy-impersonate option for the spider.

Which Scrapy versions are supported?

The spider targets current Scrapy and its start() method. Tick “Also support Scrapy < 2.13” to add start_requests() for older versions. The generated code is tested against the real Scrapy, scrapy-impersonate and curl_cffi libraries.