Collecting information from public web pages can help you research a market, monitor your own site, or build a dataset. The hard part is not just extracting fields: you also need permission to collect them, a low-impact way to make requests, and checks that catch changes before bad data reaches your workflow.
Start with an official API, data export, or feed whenever one meets your needs. If you plan to crawl pages, confirm that your use is permitted, keep the request scope small, and stop when a site signals that your automated access is not welcome.
Confirm permission before collecting
Read the site's terms and any applicable data-use or API rules. If the permitted use is unclear, ask the site owner before collecting. Consider privacy, copyright, and other legal requirements for your use case; public availability alone does not settle them.
Check robots.txt for crawler instructions and honor the rules that apply to your crawler. The Robots Exclusion Protocol in RFC 9309 explicitly says these rules are not access authorization. A sitemap can help you discover URLs, but it does not grant permission to collect them; see our guide to pinging a sitemap.
Choose a stable source and a narrow scope
Prefer a documented API or export because it usually gives you a more stable format than page markup. Before a crawl, write down the specific pages and fields you need, how often they need updating, and how you will use and retain the results. Collect only what that purpose requires, especially when pages may contain personal information.
If you are authorized to parse HTML, expect layouts and labels to change. Avoid depending on a single fragile page position; validate the fields you extract, handle missing values explicitly, and record the source URL and collection time so you can trace questionable records.
Keep requests within the site's limits
Identify any documented request limits and set a conservative pace for each host. Use a clear crawler identity, keep concurrency low, and increase it only when the site owner permits it and the service remains responsive. Scrapy's AutoThrottle documentation describes an option for adjusting crawl delays based on response latency.
Treat 429 Too Many Requests as a request to slow down. If the response includes Retry-After, wait for the stated period before trying again; otherwise, pause conservatively and reduce the request rate. The MDN reference for HTTP 429 explains this response. Repeated errors are a reason to stop and review the plan, not to distribute requests across proxy addresses to get around a limit.
Handle access barriers as stop signals
Some pages require a login, return 403 Forbidden, or display a CAPTCHA or anti-bot challenge. Do not bypass authentication, access controls, or those challenges. Ask for authorized access, use an approved API, or leave that data out. Browser automation can help with pages that are difficult to render only when your access is permitted and the site's rules allow it; it is not a way around a barrier.
Check the data before relying on it
Pages can disappear or change structure without notice. Validate required fields, types, and date formats; check for duplicates and unexpected empty results; and compare a sample with its source pages. Log failures and counts so a sudden change is visible. If the expected structure is missing, pause the run and review it rather than silently saving incomplete records.
Protect the collected data
Limit access to the dataset, set a retention period, and remove records you no longer need. Avoid collecting credentials or sensitive personal information. Before using or sharing results, confirm that the original source and your intended use allow it.
A responsible preflight checklist
- Is there an official API, feed, or export that fits the task?
- Have you checked the site's terms, data-use rules, and
robots.txt? - Are the pages and fields limited to what you need and are allowed to collect?
- Is the crawler identified, paced conservatively, and prepared to honor rate limits?
- Will it stop on access barriers, repeated errors, or unexpected page changes?
- Can you validate, protect, and delete the collected data appropriately?
Responsible collection is more reliable because it avoids building a workflow around unstable access or data you cannot use. For a broader overview of the topic, see our guide to data scraping.
Cover Photo by Emile Perron on Unsplash