Most advice on not getting blocked is about not getting caught. This is the other kind. A block is usually a site’s reasonable response to traffic it can’t identify, can’t afford, or didn’t agree to. A collector that is identifiable, light and within the rules rarely has that problem, and when it does, the right response is a decision, not a workaround.
Key takeaways
- Look for an official API, feed or export first. It is cheaper, more stable and clearly permitted.
- Read and obey robots.txt for your crawler’s name, and check the site’s terms for the pages you need.
- Identify yourself honestly in the User-Agent, with a contact address.
- Keep the load small: one connection per domain, a fixed delay, HTML only, and caching.
- Honor 429 and
Retry-After. Treat 401 and 403 as a reason to stop and review, not to try again.
Why sites block crawlers
From a site’s side, automated traffic falls into a few groups: search engines it wants, partners it has agreements with, and everything else. Everything else costs money to serve, can degrade the site for paying customers, and sometimes is abusive. Bot management products exist to sort that traffic, and they err on the side of the site. If your collector is anonymous, fast and indistinguishable from abuse, it will be treated like abuse.
So the practical question is not “how do I avoid detection” but “how do I make my traffic easy to accept”. The rest of this article is the answer we work by.
The decision comes before the first request
How we decide whether and how to collect from a site
1. Use official sources first
Many sites publish the data you want in a form designed for machines: a public API, an affiliate or partner feed, a product export, or structured data in the page itself. Shopify stores, for example, often expose product JSON, which we covered in scraping Shopify stores via products.json. An official channel is the strongest form of permission you can get, and it is almost always cheaper than parsing pages. Our comparison of web scraping vs official APIs covers when each makes sense.
2. Read robots.txt and the terms
Fetch robots.txt before anything else and evaluate it for the product token your crawler announces. Under RFC 9309 a matching named group replaces the * group, and the longest matching rule wins. If the pages you need are disallowed, stop there. Then read the site’s terms for the pages you plan to collect; if they prohibit automated access, that is a legal question as much as a technical one. Our overview of web scraping law in the US covers the main issues.
3. Identify yourself
Send a User-Agent that names your crawler, links to a page explaining it, and gives a contact address, for example ExampleCollector/1.0 (+https://example.com/bot; data@example.com). RFC 9309 asks crawlers to describe their purpose in their identification string. A site that can name your crawler can write a robots.txt rule for it, rate-limit it precisely, or email you, all of which are better outcomes than a blanket block.
Do not borrow a browser’s or a search engine’s identity. It is dishonest, it removes the site’s ability to address you, and it turns a disagreement about load into one about deception.
4. Keep the load small
- One connection per domain and a fixed delay between requests. Start conservatively and increase only if responses stay fast and clean.
- Fetch HTML or JSON only. Don’t download images, scripts and fonts you don’t need. A browser-based collector loads them all by default; a plain HTTP client doesn’t.
- Cache and use conditional requests. Send
If-None-MatchorIf-Modified-Sincewhere the site supports them, and don’t refetch what hasn’t changed. - Use sitemaps for discovery rather than paginating every category.
- Run off-peak for the site’s main market.
The usual objection is speed. The arithmetic is less frightening than it sounds.
A polite crawl is slower than people expect, and often fast enough
Hours to fetch every product page once on one connection, at three request rates (log scales)
Data behind the chart
| Pages | 0.2 req/s (h) | 0.5 req/s (h) | 1 req/s (h) |
|---|---|---|---|
| 1,000 | 1.4 | 0.6 | 0.3 |
| 5,000 | 6.9 | 2.8 | 1.4 |
| 10,000 | 13.9 | 5.6 | 2.8 |
| 50,000 | 69.4 | 27.8 | 13.9 |
| 100,000 | 138.9 | 55.6 | 27.8 |
At one request every two seconds, a 10,000-page catalog takes about 5.6 hours on a single connection, which fits easily in a nightly window. At 100,000 pages it takes more than two days, which is the point to ask whether every page needs refreshing every run. Usually it doesn’t: incremental collection based on sitemaps and change rates can cut the daily page count dramatically.
5. Listen to the responses
A 429 means you are sending too much; a 503 means the server is struggling. Both may carry a Retry-After header, which is the server telling you how long to wait. Wait at least that long, then resume at a lower rate. Rising response times are an earlier warning than errors.
A 401 or 403 is different: the server understood the request and refused it. That is the moment to stop sending requests to the domain and decide deliberately, not to change something and try again.
What we don’t do
We don’t disguise our crawler, cycle through identities or networks to get around limits, defeat CAPTCHAs or challenge pages, or access anything behind a login without the account holder’s permission and the site’s terms allowing it. When a site refuses access, we look for an official source, ask the site, or tell the client the data isn’t available from that source.
6. Ask
It sounds naive, and it is often the fastest route to a clear answer. Many retailers will tell you whether a feed exists, which hours to avoid, or what rate they are comfortable with. A short email from an identifiable company, describing what you collect and how often, is a better long-term position than any amount of engineering around a refusal.
A checklist before the first request
| Check | Pass condition |
|---|---|
| Official source | Checked for API, feed, export or embedded structured data |
| robots.txt | Target paths allowed for your product token |
| Terms | Read; no prohibition on the access you plan, or legal sign-off |
| Data type | No personal data collected unless there is a lawful basis |
| Identification | Honest User-Agent with URL and contact |
| Rate | Per-domain limit, single connection to start, published limits respected |
| Footprint | HTML or JSON only; caching and conditional requests on |
| Stop rules | Automatic pause on repeated 429s and on any 401 or 403 |
Quick answers
How can I scrape a website without getting blocked?
Use official APIs or feeds where they exist, obey robots.txt, identify your crawler honestly, keep to one connection with a fixed delay, cache what you fetch, and slow down when the site returns 429 or 503.
What request rate is safe for scraping?
There is no universal number. Start with one connection and a delay of a few seconds, respect any published limit or Crawl-delay, and slow down if response times rise or the site returns 429.
Should I use a browser User-Agent when scraping?
No. Use a User-Agent that names your crawler and gives a contact URL or email. Impersonating a browser or search engine is dishonest and prevents the site from addressing your crawler directly.
What should I do if a site returns 403 to my scraper?
Stop requesting that domain and review. Look for an official API or feed, contact the site, or drop the source. Retrying or changing your setup to get past a refusal is not a legitimate fix.
How long does a polite crawl take?
At one request every two seconds on a single connection, about 5.6 hours per 10,000 pages, before retries. Incremental collection reduces how many pages need refreshing each run.
Data collection that sites can live with
We collect public product data with identified crawlers, per-domain limits and stop rules, and deliver it validated. See our services or talk to us.
