What Is Web Scraping, and How to Start with Public Data
Web scraping means collecting data from web pages with software. This guide explains how it works and how to start responsibly with public data and polite requests.
10 min readUpdated Nov 14, 2026By XPASS Editorial Team

Every day, people copy information from web pages into spreadsheets: product names, prices, event dates, job listings, weather readings. Web scraping is the same activity done by a program instead of by hand. The program requests a page, reads what comes back, picks out the fields it cares about and stores them in a tidy format such as a CSV file or a database table. Done well, it turns hours of copying into a repeatable process. Done carelessly, it can overload a site, break its rules or collect data you should not have.
This guide is for people who are new to the subject. It explains what web scraping is, how it works at a technical level, what "public data" means in practice, how to check whether you are allowed to collect something, and how to start a small project responsibly. Throughout, the emphasis is on lawful use, respect for the target site's terms and a light touch on its servers.
What web scraping actually does
A web page is delivered to your browser as text, usually HTML, plus supporting files. Your browser turns that text into the page you see. A scraper skips the visual step and works with the text directly. The process has four stages:
- Request. The program sends an HTTP request to a URL. HTTP itself is defined in RFC 9110, and the request includes a method such as GET, headers describing the client, and sometimes a body.
- Response. The server answers with a status code, headers and a body. The body may be HTML, JSON, XML or something else.
- Extraction. The program parses the body and picks out the pieces it needs, for instance the text inside a price element, or the values of fields in a JSON document.
- Storage. The extracted values are saved in a structured format, with a timestamp and the source URL so you can trace where they came from.
Many beginners think scraping is mostly about the extraction step. In practice, the reliability of the whole pipeline matters more: handling errors, spacing out requests, storing raw responses and detecting when a page changes its layout.

Scraping, crawling and APIs
These words are often used loosely, so it helps to separate them.
| Term | Meaning | Typical use |
|---|---|---|
| Scraping | Extracting specific data from pages | Prices, listings, headlines |
| Crawling | Following links to discover many pages | Building an index of a site |
| API access | Requesting structured data from an official interface | Stable, documented data feeds |
When a site offers an official API that provides the data you need, use it. APIs return structured data, change less often than page layouts, and usually describe usage rules and limits. Scraping HTML is a fallback for cases where no suitable API exists. Another useful habit is to check whether the site publishes the data in a downloadable form, such as an open data file or a feed.
What "public data" means
Public data is information that the site makes available to any visitor without logging in, and that is not personal or sensitive. A product catalogue with listed prices, a public weather page or a government statistics table are typical examples. Several cautions apply even then:
- Public does not mean unrestricted. A site's terms of use may limit automated access or reuse of its content, even when anyone can view the page.
- Personal data needs special care. Names, contact details and other information about individuals may fall under privacy laws such as data protection regulations. Collecting it requires a lawful basis and careful handling, and for beginners the simplest rule is to avoid it.
- Content may be protected by copyright. Facts like a price are generally treated differently from creative text and images, but the rules vary between countries. If you plan to republish content, take advice.
- Anything behind a login is not public. Do not use someone else's account or try to get around access controls.
None of this is legal advice. If your project is commercial or touches personal data, consult a qualified professional familiar with the laws that apply to you.
Check the rules before you write code
Before you request a single page, spend ten minutes on these checks:
- Read the terms of use. Look for sections on automated access, scraping, data reuse and API usage. If scraping is prohibited, do not do it, and look for an official data source or ask the site owner for permission.
- Read robots.txt. This file sits at the root of a site, for example
/robots.txt. It lists paths that automated clients are asked not to visit and sometimes mentions crawl delays. The Robots Exclusion Protocol is standardized in RFC 9309. It is a convention, not an access-control system, but responsible scrapers follow it. - Look for an API or data download. Search the site's documentation or developer pages.
- Identify yourself. Use a descriptive
User-Agentstring and, where appropriate, include contact information so the site owner can reach you if there is a problem. - Decide what you need. Write down the exact fields and the volume. Collecting less is easier to defend, easier to store and gentler on the site.
If any check tells you not to proceed, respect that. Working around rate limits, CAPTCHAs or access controls is not a legitimate approach and can create legal and ethical problems.
Start small: a first project
A good first project is small, visible and low risk. For example, collect the titles and publication dates from the public news page of an organization that permits it, or the listed price of a few products from a catalogue whose terms allow it.
Follow these steps:
- Pick one page type. Choose a single kind of page, such as a product page, with a consistent layout.
- Fetch one page by hand. Use a command-line tool or your browser's developer tools to see the raw response. Note the status code and whether the data appears in the HTML or comes from a separate JSON call.
- Write the extraction. Use a parser to select the elements that hold your fields. Prefer stable selectors, such as an element with a clear name or a structured data block, over fragile ones that depend on layout.
- Add basic politeness. Wait between requests, identify yourself and cap the number of pages per run.
- Handle errors. Check the status code. Retry transient errors a limited number of times with a growing delay, and stop on errors that will not go away.
- Store the results. Save the values with the source URL and timestamp. Keep a copy of the raw response for a short period so you can debug when the page changes.
- Run it small first. Test on ten pages, check the output by eye, then increase gradually.
Resist the temptation to scale up right away. A scraper that works on ten pages is a prototype; a scraper that runs for weeks needs monitoring, logging and a plan for when the site changes.
Be polite to the server
A scraper is a guest on someone else's machine. Behave accordingly:
- Space requests so you never put noticeable load on the server. If robots.txt or the documentation gives a delay, follow it.
- Cache what you have already fetched, and ask only for what you need. Conditional requests using
ETagorLast-Modifiedheaders, defined in RFC 9110, let the server reply briefly when nothing has changed. - Avoid peak hours for large jobs where possible.
- Stop when the site asks you to. A response asking you to slow down is a signal to reduce your rate, not to find a way around it.
- Do not collect more than the project needs.
Politeness also keeps your own costs down. Fewer, smaller requests mean less traffic, and the guide on calculating traffic from API responses shows how to measure and budget it.
Where a proxy fits in
Many beginners assume a proxy is the first thing they need. It is not. A small, polite project can run from a single connection. A proxy becomes useful for specific, legitimate reasons, for example:
- Checking how a public page looks from another region, such as a localized price or language version.
- Separating the network traffic of a data-collection job from other traffic on your own connection.
- Running collection from a stable, dedicated address range that you can document and, if needed, share with a site owner who asks.
A proxy is a relay: your request goes to the proxy, which forwards it to the target. The MDN article on proxy servers and tunneling explains the mechanics. A proxy does not change the rules. You still must follow the target's terms of use, obey robots.txt, respect rate limits and comply with the law where you live and where the data is hosted. If you reach the point of needing one, see the proxy page for what is on offer, and plan your usage with a monitor like the one described in building a low-traffic alert system.
A plain example
Suppose you want to track the listed price of five books in a public online catalogue that permits automated access. A responsible plan could look like this:
- Read the catalogue's terms and robots.txt, and confirm there is no price API you should use instead.
- Fetch one product page and find where the price appears. Note that it is inside an element with a clear name.
- Write a script that visits the five product URLs once a day, waits a few seconds between pages, and identifies itself in the
User-Agentheader. - Save the title, price, currency, URL and timestamp to a CSV file.
- Add a check: if the price field is missing or the status is not successful, record the problem and stop, rather than retrying endlessly.
- After a week, look at the file. Are the prices changing? Are there gaps? Fix the problems before adding more products.
That small project already teaches the core skills. For a broader look at turning such data into insight, the article on collecting public product prices for market research is a natural next step.
Limits and what to watch for
- Pages change. A redesign can break your extraction overnight. Build checks that notice when expected fields disappear.
- Dynamic content. Some pages load data with JavaScript after the first response. You may need to find the underlying JSON call or use a browser-automation tool, but only if the site's terms allow it.
- Data quality. Scraped data can include duplicates, missing values and inconsistent formats. Validate and clean it before relying on it.
- Legal and ethical risk. Terms, copyright and privacy laws differ by country. Get advice for anything commercial or involving personal data.
- Maintenance cost. A scraper is software that needs upkeep. If an official data source appears later, switch to it.
- Overreach. More data is not always better. Collect what answers your question, and delete what you no longer need.
Summary
Web scraping is the automated collection of data from web pages, using the same HTTP requests a browser makes. The responsible way to begin is to choose public, non-personal data, read the site's terms and robots.txt, prefer an official API when one exists, identify yourself, space out requests and start with a small prototype. A proxy is an optional tool for specific lawful needs and never a way around a site's rules. Once your project is stable and you want to see what a proxy service offers, take a look at the proxy page.
Frequently asked questions
What is web scraping?
Web scraping is the automated collection of data from web pages or web APIs. A program requests a page, reads the response and extracts the fields it needs, such as titles, prices or dates, then stores them in a structured format.
Is web scraping legal?
It depends on what you collect, how you collect it, the site's terms, and the laws that apply to you. Public data is a safer starting point than private or personal data, but you should always read the terms of use and consider legal advice for commercial projects.
What is robots.txt and should I follow it?
Robots.txt is a file in which a site publishes rules about which paths automated clients should not crawl. It is described in the Robots Exclusion Protocol, RFC 9309. Responsible scrapers read it and follow it, along with the site's terms.
Do I need a proxy to start scraping?
Not at the beginning. A small, polite project often runs from a single connection. A proxy becomes relevant later, for example when you need to see how a public page looks from a different region, and it must always be used lawfully and within the site's terms.
Should I use an API instead of scraping HTML?
Yes, whenever an official API provides the data you need. APIs are more stable, return structured data and usually state clear usage rules.
References
About the author

Bob Kanokphon Thongdee
- Founder of XPASS VPN
- Co-founder of eSIMonline.asia
- More than 7 years in online marketing
- Founder of Cojourney Visa and Cojourney Travel
Need a proxy for this?
XPASS Proxy sells residential proxy traffic by the gigabyte, with the price shown before you pay.
See proxy plansKeep reading

Proxy Guides
How to Build an Alert System for When Proxy Traffic Runs Low
A proxy job that silently runs out of traffic fails at the worst moment. This guide shows how to track usage, set thresholds and send alerts that people act on.
9 min read

Proxy Guides
How to Collect Public Product Price Data for Market Research
Price data is only useful if it answers a clear question. This guide covers planning, responsible collection, cleaning and storage of public product prices.
10 min read

Proxy Guides
How to Calculate Proxy Traffic from API Responses in Data Collection Jobs
Proxy traffic is measured in bytes, not requests. This guide shows how to measure API responses, add overhead and retries, and build a realistic traffic estimate.
9 min read