Learning how to scrape a website is not only a programming exercise. A dependable scraper must respect access rules, control request volume, handle changing layouts, and prove that the collected data is accurate. This practical checklist walks through a responsible workflow for planning, requesting, parsing, validating, and maintaining a web scraper.
Overview
Web scraping is the automated process of requesting web pages or public data endpoints, extracting useful fields, and storing the results for analysis or another application. The safest approach is to treat scraping as a controlled data pipeline rather than a script that repeatedly downloads pages.
Before writing code, define the smallest dataset that meets your goal. Record the target URLs, fields, expected formats, collection frequency, and acceptable failure rate. If a public JSON endpoint provides the same information more consistently than rendered HTML, it may be the better technical choice. See how to discover public JSON endpoints for a practical way to investigate that option.
A responsible workflow has five stages:
- Scope: Identify the pages, fields, and purpose of the collection.
- Review: Check robots.txt, terms, authentication requirements, privacy concerns, and available access methods.
- Request: Use a clear user agent, conservative concurrency, timeouts, retries, and rate limits.
- Parse: Extract fields with selectors or structured responses that are as specific and stable as possible.
- Validate: Detect missing values, duplicates, unexpected formats, layout changes, and incomplete runs.
These stages apply whether you use a lightweight Python HTTP client, a browser automation framework such as Playwright or Puppeteer, or a scheduled crawler for technical SEO work.
Checklist by scenario
Before scraping a new website
- Write down the business or research purpose and the minimum fields required.
- Confirm that the pages are publicly accessible and do not require bypassing authentication, paywalls, access controls, or technical barriers.
- Read the site’s terms and any published collection guidance. This article is a technical checklist, not legal advice; obtain appropriate review when personal data, regulated information, or commercial use is involved.
- Request
https://example.com/robots.txtand inspect the directives relevant to your crawler’s user-agent. Treat robots.txt as an important signal about preferred crawler access, not as a replacement for reviewing other rules or obligations. - Look for a documented API, export, sitemap, feed, or public JSON response that could reduce load and improve consistency.
- Choose a small sample of URLs and manually inspect the expected fields before building the full parser.
For a simple static-page scraper
- Use a descriptive user-agent that identifies the project and provides a contact method where appropriate.
- Set connection and read timeouts so a stalled page cannot hold the entire job open.
- Throttle requests with a deliberate delay or a token-bucket-style limiter. Start conservatively and increase volume only when the site’s response behavior and your permission allow it.
- Limit concurrent requests per host. A queue with a fixed worker count is easier to audit than unrestricted asynchronous calls.
- Retry only transient failures, such as selected server errors or timeouts. Use exponential backoff with a maximum retry count, and do not repeatedly retry a clear denial or a rate-limit response.
- Cache successful responses during development so you do not repeatedly request the same pages while refining selectors.
For JavaScript-rendered pages
- First determine whether the required data is available in the initial HTML, embedded state, a sitemap, or a public data request. Browser automation adds execution time and operational complexity.
- Use Playwright or Puppeteer only when rendering is necessary for the permitted task.
- Wait for a meaningful page condition, such as a known content element or network state, rather than relying only on a fixed sleep.
- Block unnecessary assets when appropriate for your workflow, but do not interfere with controls or attempt to evade access restrictions.
- Keep browser sessions bounded and close pages cleanly after each job.
For technical SEO crawling
- Capture status code, final URL, title, canonical, robots directives, heading data, and relevant link or metadata fields.
- Respect crawl limits and avoid treating every discovered URL as equally important. Normalize URLs and control query-parameter expansion.
- Separate discovery from extraction so a newly found link cannot cause an uncontrolled crawl.
- For structured data, save the original JSON-LD before parsing it. The JSON-LD schema markup audit can help organize required-field and validation checks.
- For social metadata, include a focused audit of Open Graph and Twitter Card tags rather than downloading unnecessary page resources.
What to double-check
Robots.txt and access signals
Fetch robots.txt from the correct origin and account for the protocol and hostname you are accessing. Record the file used for the run, because crawler directives can change. Check the applicable user-agent group, disallowed paths, allowed paths, and any crawl-delay guidance. Do not assume that a path being technically reachable means unrestricted collection is appropriate.
Rate limiting and request behavior
Rate limiting should be explicit in code and visible in logs. Track request timestamps, response status, latency, retries, and the number of active workers. A basic policy might use one request at a time with a delay, then adjust only after observing stable responses. If responses indicate throttling, stop or slow down instead of trying to work around the control.
Use bounded retries. A retry policy that multiplies traffic during an outage can harm both the target site and your own job. Store failed URLs for a later, separate review rather than hiding them inside a large automated retry loop. The guide to HTTP errors in web scrapers provides a useful way to distinguish access denials, rate limits, server failures, and timeouts.
Data quality
Validate each record at the point of extraction. Require stable identifiers where available, normalize whitespace and URL formats, and validate dates, prices, currencies, and numeric fields against expected types. Keep the source URL and collection timestamp with each record so results can be traced later.
Measure more than the number of downloaded pages. Compare expected and actual record counts, flag empty fields, detect duplicate identifiers, and sample raw pages against parsed output. For a deeper workflow, see the web scraping data validation guide.
Troubleshooting table
| Problem | Likely causes | Practical response |
|---|---|---|
| 403 or access denied | Request policy, missing context, or prohibited access | Stop automated retries, review permissions and terms, and look for an approved endpoint or contact path. |
| 429 or repeated throttling | Request rate or concurrency is too high | Pause, reduce concurrency, increase delays, and honor any published guidance. |
| Duplicate pages | Tracking parameters, alternate URL forms, or pagination loops | Normalize URLs, define canonical keys, filter known parameters, and cap crawl depth. |
| Missing fields | Selector drift, optional content, or a different template | Save the raw response, classify the template, add validation, and review a sample manually. |
| Changed layout | Class names, nesting, or page components changed | Use stable attributes where possible, add fixture tests, and fail visibly when required fields disappear. |
| Timeouts or server errors | Slow service, network problems, or temporary outage | Use bounded backoff, preserve failed URLs, and rerun later instead of increasing pressure. |
Common mistakes
Starting with a full crawl. A small representative sample exposes selector and permission problems at much lower cost. Begin with a dry run and inspect raw responses.
Using brittle selectors. Long CSS paths and visual text labels often change. Prefer stable attributes, semantic structure, structured data, or documented endpoints, while still testing for drift.
Ignoring empty results. A parser that returns an empty string can look successful. Treat required-field failures as visible errors and record the affected URL.
Mixing discovery, extraction, and storage. Separate these responsibilities so you can rerun parsing from cached input, deduplicate records, and test changes safely.
Collecting more personal data than necessary. Minimize fields, restrict access to stored data, define retention rules, and avoid collecting sensitive information unless the purpose and permissions clearly support it.
Skipping tests. Save representative HTML or JSON fixtures and compare expected output after parser changes. The guide to testing web scrapers with Python covers fixtures, golden files, and continuous integration checks.
When to revisit
Review this checklist before every new scraping project, before a major seasonal planning cycle, and whenever the target site, scraper library, browser version, or data model changes. Recheck robots.txt and site terms when the collection scope or frequency changes. Also revisit the workflow after a new 403 or 429 pattern, a sharp drop in record counts, a layout redesign, or a change in the data’s intended use.
A practical maintenance routine is to schedule a small canary run before the full job. Compare status codes, response times, field completeness, duplicate rates, and record counts with the previous successful run. Keep alerts focused on meaningful changes rather than every individual failed URL.
Before launching your next run, complete this short final checklist:
- Confirm the purpose, scope, access rules, and required fields.
- Test a small sample and save representative raw responses.
- Set timeouts, rate limits, concurrency caps, and bounded retries.
- Validate required fields, identifiers, formats, duplicates, and completeness.
- Log failures and pause when the target site signals that your traffic is unwelcome.
- Document the date, code version, configuration, and assumptions for the next review.
Responsible scraping is an ongoing engineering practice. A modest, observable crawler that produces trustworthy data is more useful than a fast script that creates access problems or silently returns incomplete results.