Skip to content

Instantly share code, notes, and snippets.

@jrosell
Last active March 13, 2026 09:03
Show Gist options
  • Select an option

  • Save jrosell/0eb2bc34c7c6e80e39c66583aadf22cb to your computer and use it in GitHub Desktop.

Select an option

Save jrosell/0eb2bc34c7c6e80e39c66583aadf22cb to your computer and use it in GitHub Desktop.
Crawl an entire site using cloudflare. Keep in mind, that the free tier only gets 100 pages. You can read more info than the official docs here: https://github.com/jbobbink/seo-and-crawling-skills/blob/main/cloudflare-crawl/SKILL.md
# Get your API Key with Broser rendering permissions here: https://dash.cloudflare.com/profile/api-tokens
CLOUDFLARE_ACCOUNT_ID="<your_cloudflare_account_id>"
CLOUDFLARE_API_TOKEN="<your_cloudflare_api_token>"
curl -X POST "https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/browser-rendering/crawl" \
-H "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
-H 'Content-Type: application/json' \
-d '{
"url": "https://www.thediar.com/"
}' > crawl_submit.json
CLOUDFLARE_JOB_ID=$(jq -r '.result' crawl_submit.json)
curl -X GET "https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/browser-rendering/crawl/$CLOUDFLARE_JOB_ID" \
-H "Authorization: Bearer $CLOUDFLARE_API_TOKEN" > crawl_result.json
cat crawl_result.json
# Don't worry if you first get: {"success":false,"errors":[{"code":1001,"message":"Crawl job not found"}]}
# I waited some hours and I finally get the expeteed result here:
jq '.result.records' crawl_result.json |more
@jrosell
Copy link
Author

jrosell commented Mar 13, 2026

cloudlarecrawl

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment