Web scraping is the automated extraction of data from websites: a program requests pages, parses the returned HTML or JSON, and saves specific fields, such as prices or listings, in a structured format. It differs from web crawling, which follows links to discover and index pages; scraping pulls specific data out of the pages fetched.
A basic scraper sends an HTTP request to a target URL, receives the raw HTML (or JSON, for API-based sites), and parses out the specific data points needed: product prices, search rankings, contact information, and similar. At scale, scraping runs into rate limits, which cap how many requests a single IP address can make in a given window of time.
Types of Web Scraping Tools
- Code libraries: Scripts that send HTTP requests and parse the HTML, for example Python with an HTML parser.
- Browser automation: Tools such as Selenium or Playwright load the full page, including JavaScript-built content, then extract data from the rendered DOM.
- Official APIs: Where a site offers one, it returns structured data directly, with no HTML parsing.
Common Anti-Scraping Measures
Besides rate limits, sites use other ways to spot and slow scrapers:
- CAPTCHAs that ask the visitor to prove they're human.
- robots.txt files that state which paths automated crawlers may access.
- Honeypots: Hidden links that human visitors never see or click, used to identify and fingerprint bots.
- Device fingerprinting, which can re-identify a browser or device from its characteristics, even after cookies are cleared or when a VPN is used.