Ethics & Ground Rules
Go is a genuinely great language for fetching and processing data from the web — good HTTP client, easy concurrency, single-binary deployment. This section covers how to do that responsibly, because a scraper that ignores the rules below can get your IP banned, break a site for other users, or cross into legally risky territory.
Ground rules for this whole section
Section titled “Ground rules for this whole section”- Check the site’s Terms of Service first. Many sites explicitly prohibit automated scraping; others provide an official API specifically so you don’t have to. If an API exists, use it — it’s more stable and won’t get you blocked.
- Respect
robots.txt. It’s the site owner’s explicit statement of what they’re comfortable being crawled. Covered in detail in Respecting robots.txt & Rate Limits. - Identify yourself. Send a real
User-Agentwith a contact URL or email, e.g.MyCrawler/1.0 (+https://example.com/bot). This is the opposite of trying to look like a regular browser — a good crawler is identifiable so a site operator can reach out if there’s a problem, instead of just silently blocking you. - Rate-limit yourself. One request every few seconds from a single crawler is invisible to a site’s infrastructure. Hundreds of concurrent requests can degrade service for real users — treat someone else’s server the way you’d want yours treated.
- Only scrape data you’re allowed to store. Personal data, paywalled content, and copyrighted text all carry their own legal considerations independent of whether the scrape itself was “technically” possible.
- Never try to defeat anti-bot/anti-abuse protections (CAPTCHAs, Cloudflare Turnstile/Challenge pages, rate-limit walls) on a site you don’t own. Those exist because the site operator decided automated access isn’t welcome there — bypassing them isn’t a scraping “technique”, it’s circumventing someone else’s explicit decision about their own infrastructure. If a site is protected this heavily, that’s a strong signal to look for an official API or partnership instead.
What this section actually teaches
Section titled “What this section actually teaches”With those rules in place, the rest of this section covers the genuinely useful, durable skills:
- Fetching and parsing HTML with
net/httpandgoquery(Your First Scraper) - Structuring concurrent crawls safely with worker pools (Concurrent Crawling)
- Parsing
robots.txt, honoringCrawl-delay, and backing off on429/Retry-After(Respecting robots.txt & Rate Limits) - Getting the extracted data into a usable shape — CSV, JSON, or a database (Exporting Data)