01Why scrapers get blocked
Websites watch for traffic that does not look like a person. The first thing they check is cheap and fast: how many requests come from one IP, and what kind of network that IP belongs to. A few hundred requests a minute from one hosting address is easy to spot and easy to block.
After that come slower checks: missing browser headers, no cookies, JavaScript that never runs, CAPTCHAs. Proxies deal with the first kind. The second kind is fixed in your scraper, and both have to be right.
02Which network to use
Start with the cheapest network that works, and only move up when the target forces you. Run a few hundred test requests on each and compare the share of good responses.
A common setup runs both: the bulk of URLs over datacenter, and the ones that come back blocked retried over residential.
03Rotating or sticky
For crawling separate pages, rotate: every request gets a new IP and the load spreads on its own. Hold an IP only when a sequence must look like one visitor, such as a search followed by its result pages, or anything after a login.
| Job | Username |
|---|---|
| Crawl product pages | USERNAME-country-us |
| Page through one search | USERNAME-country-us-session-q123-lifetime-30 |
| Data behind a login | USERNAME-country-us-session-acct1-lifetime-1440 |
04A starting point in Python
import requests
PROXY = "http://USERNAME-country-us:PASSWORD@dc.fullstackproxy.com:38417"
HEADERS = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 "
"(KHTML, like Gecko) Chrome/131.0 Safari/537.36",
"Accept-Language": "en-US,en;q=0.9",
}
def fetch(url):
for attempt in range(3):
try:
r = requests.get(url, headers=HEADERS, timeout=30,
proxies={"http": PROXY, "https": PROXY})
if r.status_code == 200:
return r.text
except requests.RequestException:
pass # a new connection on the next try means a new IP
return NoneFor bigger crawls, the Scrapy guide and async Python guide show the same setup with concurrency.
05Keeping the cost per page down
Both GB networks bill by traffic, so the size of each page is the cost. Plain HTML is usually tens of kilobytes; the same page in a headless browser with images and scripts can be several megabytes.
- Fetch the HTML or the site’s JSON API directly when you can, instead of rendering the page.
- In headless browsers, block images, fonts and video.
- Do not re-download pages that have not changed: check
ETagorLast-Modified. - Ask for compressed responses (most clients do by default).
The bandwidth guide goes through each of these with code.
06Scraping responsibly
Collect public data, keep request rates reasonable, and respect the law and the terms that apply to you. Do not use proxies to get into accounts or systems you are not allowed into. Our Acceptable Use Policy sets out what is not allowed on the network.