Skip to content

Introduction to Web Scraping Ethics & robots.txt

diagram the checks to make before a scraper sends its first request mermaid
Most of what separates acceptable scraping from the other kind is decided before any code runs. robots.txt states what the site asks automated clients not to touch, the terms may say more, and an API -- if one exists -- is both kinder and more reliable than parsing HTML that was never meant as an interface.
  • Prefer official APIs when available
  • Respect Terms of Service
  • Rate-limit requests
  • Identify your scraper (User-Agent)
  • Don’t scrape private data

robots.txt is a convention that tells crawlers which paths are allowed/disallowed.

It’s not a security feature, but a strong signal.

Use delays and backoff:

polite_delay.py
import time
import random
 
 
def polite_sleep(base=1.0):
    time.sleep(base + random.random())
  • keep concurrency low
  • cache responses
  • handle 429/503
  • rotate proxies only if permitted and ethical

pch.coffeeTagline

pch.coffeeCta

pch.feedbackHeading

pch.feedbackSubheading