How to Run Data Quality Checks on Web Scraping Projects
Scraped data can look fine and still be wrong. This guide shows simple checks at the fetch, parse and dataset layers so bad rows never reach your reports.
10 min readUpdated Nov 14, 2026By XPASS Editorial Team

Scraped data has a nasty habit of looking fine while being wrong. A script can run for weeks without raising an error and still fill your spreadsheet with empty prices, repeated rows or the text of an error page. The problem is rarely the code that crashed; it is the code that did not crash. This guide shows how to add simple data quality checks to a web scraping project so that bad rows are caught early, before they reach a report or a decision.
Everything here assumes lawful collection of publicly available data, in line with the target site's terms, its robots rules and local law. If you also compare results across countries, the companion guide on validating data collected from multiple regions goes deeper on that topic.
Why quality checks matter more than scraper speed
Beginners tend to measure a scraper by how fast it runs. Teams that rely on the output measure it by how often the data is wrong. A single silent failure can poison a month of trend lines: if a product price is stored as zero for three days, the average drops, the chart dips and someone draws a conclusion from a mistake.
There are three reasons quality needs its own checks rather than trust in the code.
- Websites change without notice. A class name is renamed, a price moves into a script tag, a banner is added. The scraper still runs; it simply extracts the wrong thing or nothing.
- Responses are not always what they seem. A request can succeed at the HTTP level while the body is a login prompt, a regional notice or a temporary error page. See the status code rules in RFC 9110 for what each code means, but remember that a 200 only says the server answered.
- Failures are cumulative. One bad row is easy to fix on the day. A thousand bad rows discovered at month end require re-collection, and the source may no longer show the old values.
Treat quality checks as part of the product, not as clean-up work for later.

The six dimensions of scraped data quality
It helps to have a short vocabulary for what "good" means. Most scraping problems fall into one of six dimensions.
| Dimension | Question it answers | Typical failure |
|---|---|---|
| Completeness | Are all expected rows and fields present? | Price field empty on 15 percent of rows |
| Validity | Do values have the right type, format and range? | Price stored as text such as "N/A" or a negative number |
| Consistency | Do values agree across fields and runs? | Currency symbol says one thing, currency code another |
| Freshness | Is the data as recent as claimed? | A cached page served from last week |
| Uniqueness | Is each entity recorded once per run? | The same product appears three times from pagination overlap |
| Accuracy | Does the value match what a person sees on the page? | Old price scraped instead of the sale price |
Accuracy is the hardest to check automatically, which is why the sampling step later in this guide matters. The other five can mostly be tested by code.
Layer 1: checks right after the fetch
The earliest place to catch a problem is before you parse anything. These checks are light because they only look at the response.
- Status code. Record it for every request. Treat 2xx as a candidate success, 3xx as something to follow and log, 4xx and 5xx as failures that need a reason code. Do not retry blindly; a 404 will not fix itself and repeated retries only add cost and load on the site.
- Body size. Keep a rough expected range for each page type. A product page that is usually 150 KB and suddenly arrives at 3 KB is suspicious.
- Content markers. Require one or two strings that must appear on a real page, such as a product title element or the text of a price container. Also keep a list of strings that signal the wrong page, such as "enable cookies", "access denied", "sign in to continue" or "temporarily unavailable".
- Final URL. After redirects, check that you landed where you expected. A product URL that redirects to the home page is not a product page.
- Language and region hints. If you expect English pages from a given location, check the language attribute or a known label. A different language often means a different regional version.
- Timing. Log how long each request took. A sudden rise in latency can explain a rise in timeouts and partial pages.
If a page fails any of these, do not send it to the parser. Store the reason, the URL, the time and the exit location, then move on.
Layer 2: checks right after parsing
Once the page looks right, check the extracted record. The aim is to refuse impossible records before they are stored.
- Required fields. Decide which fields every record must have, such as an identifier, a title and a price. A record without them is rejected, not saved half empty.
- Types and formats. A price should parse into a number, a date into a valid date, an identifier into the pattern you expect. Do the conversion explicitly and fail loudly when it cannot be done.
- Ranges. Set sensible bounds, for example a price above zero and below a ceiling that fits the category. Bounds do not need to be perfect; they only need to catch the extreme mistakes such as a price of 1 when it should be 1,000.
- Cross-field rules. A sale price should not be higher than the list price. A stock count should not be negative. A currency code should match the currency symbol you saw.
- Whitespace and encoding. Strip stray spaces and non-breaking spaces, and check that text with accents or non-Latin scripts did not turn into garbled characters. Garbled text usually means the encoding was guessed wrongly.
- Selector health. For each selector, track the share of pages where it found a value. If a selector that normally hits 99 percent drops to 40 percent, the layout probably changed.
A small schema definition, written once and applied to every record, is the most reliable way to enforce these rules. Whatever library you use, keep the rules in one place so a change is visible in version control.
Layer 3: checks on the whole dataset
Individual rows can all be valid while the dataset as a whole is wrong. Run a handful of checks on each completed run.
| Check | How to do it | What it catches |
|---|---|---|
| Row count | Compare with the expected count or the last run, with a tolerance band | Pagination stopped early, a category was skipped |
| Duplicates | Count repeated identifiers per run | Overlapping pages, repeated retries stored twice |
| Null rate | Share of empty values per field | A selector that quietly broke |
| Distribution drift | Compare median and spread of key fields with recent runs | Values scraped from the wrong element |
| Day-over-day change | Flag entities whose value changed more than a threshold | Real price moves worth a look, or parse errors |
| Freshness | Check the newest fetch time per source | A job that stopped running |
Do not make the thresholds too tight. A real promotion can change many prices in one day, so a flag should lead to a review, not an automatic deletion.
A worked example: tracking 200 product pages
Suppose you collect the public price of 200 products once a day from one retailer to support a small research project. A sensible set of checks looks like this.
Fetch layer. Require status 200, a body between 60 KB and 400 KB, the presence of the product title element, and the absence of the phrases on your wrong-page list. Pages that fail are retried at most twice, spaced out, and then logged as failed with a reason.
Parse layer. Each record must have an identifier, a title and a price. The price must be a number between 0.01 and 100,000. If a sale price exists it must be at most the list price. Otherwise the record is rejected.
Dataset layer. After the run, expect between 190 and 210 accepted records. Fewer than 190 raises a warning. Any identifier appearing twice is deduplicated and counted. If more than 5 percent of prices differ from yesterday by over 30 percent, the run is marked "needs review" and yesterday's values stay in the report until someone looks.
Sampling. Each week, pick ten records at random and compare them by eye against the live page. This is the only check that tests accuracy directly. Keep a note of what you found. If two weeks in a row show a mismatch, treat it as a defect in the scraper and not as noise.
None of this is complex. The value comes from running it every time and from keeping the evidence.
What to do when a check fails
A check that nobody acts on is just a log file. Decide in advance what happens to a failure.
- Quarantine, do not delete. Move rejected rows to a separate table with the reason, the raw snippet, the URL and the time. You will need them to debug.
- Keep the last good value. In reports, show the most recent valid value and mark it stale instead of showing a blank or a wrong number.
- Classify the cause. Fetch problems (blocked, timeout, wrong page), parse problems (layout change) and source problems (the site really shows an odd value) need different fixes.
- Alert on patterns, not single rows. One bad page is noise. Twenty bad pages from the same template is a broken selector. Send a message when a rate crosses a threshold.
- Fix, then re-run only what failed. Re-fetching everything wastes traffic. Re-process the quarantined URLs only.
- Write the lesson down. Add a new wrong-page phrase, a tighter range or a new test so the same fault is caught next time.
How the network path affects quality
The proxy or connection you use can influence the data you get, so quality checks should record it.
- Exit location changes content. Currency, language, shipping options and sometimes prices differ by region. Store the exit country or region with every row, and never mix regions in one trend line without labelling them.
- Connection type changes reliability. A residential exit, a datacenter exit and a mobile exit can behave differently with the same site. The guide on choosing between residential and datacenter for public data collection explains the trade-offs in general terms.
- Timeouts produce partial pages. If a connection drops mid-download, a truncated page may still parse into a record with missing fields. Your size and marker checks catch these.
- Sessions matter for some pages. If a site expects you to keep the same session while you move through a few pages, switching exit addresses mid-way can produce confusing results. Keep related requests together.
For background on how a proxy sits between your client and the target, the MDN article on proxy servers and tunneling is a clear reference. If you are still deciding what to buy for a small study, read the guide on choosing a proxy for a small market research project.
Limits and what to watch for
Quality checks reduce risk; they do not remove it. Keep these limits in mind.
- Checks only find what you thought to test. A new kind of failure will pass until you add a rule for it. Review the rule set when the site changes.
- Accuracy needs a human sometimes. Automated checks cannot tell that a number is plausible but wrong. Regular sampling is the safety net.
- The source can be wrong. If the site itself shows an error, your data will faithfully copy it. Note the source's reliability when you report findings.
- Over-strict rules hide real change. If every large price move is rejected, you will never see a genuine promotion. Flag for review instead of dropping.
- Respect the site. Do not increase request rates to re-collect failed pages quickly, and do not try to get around access controls. Follow the site's terms, honour its robots rules as described in RFC 9309 and keep your request pace modest.
- Keep records of method. If you publish results, be able to explain when and how the data was collected and which checks it passed.
Summary
Good scraping is less about extracting data and more about proving that the data is right. Check at three layers: after the fetch (status, size, markers, final URL), after parsing (required fields, types, ranges, cross-field rules) and across the dataset (row counts, duplicates, null rates, drift and freshness). Quarantine failures instead of deleting them, keep the last good value in reports, record the exit location with every row and sample real pages by eye every week. Start with a handful of rules for your most important fields and add one each time you find a new kind of fault. When you are ready to pick connections for your project, the proxy page shows what is on offer and what each plan includes.
Frequently asked questions
What is the most common data quality problem in web scraping?
The most common problem is a page that returns a normal-looking HTTP 200 response but contains something other than the expected content, such as a consent page, an error message or an empty template. Checking the body for expected markers catches it.
Where in the pipeline should I put quality checks?
Put them at three layers: after fetching (status, size, markers), after parsing (required fields, types, ranges) and after loading (row counts, duplicates, comparison with previous runs). Each layer catches different mistakes.
What should I do with rows that fail a check?
Do not delete them silently and do not overwrite good data. Move them to a quarantine table with the reason, keep the last good value in your reports and review the failures on a schedule.
Does a proxy change data quality?
It can. Different exit locations can return different languages, currencies and layouts, and a poor connection can cause timeouts. Record the exit region with each row so you can compare like with like.
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 Validate Data Collected From Multiple Regions
When the same page returns different data in different regions, is it real or a mistake? This guide shows how to check location, compare fields and keep a validation routine.
10 min read

Proxy Guides
How to Choose a Proxy for a Small Market Research Project
Small research projects do not need a large setup. Define your scope, compare proxy types, run a short pilot and decide from your own measurements.
10 min read

Proxy Guides
Residential or Datacenter Proxies for Public Data Collection
Residential and datacenter proxies behave differently for public data work. This guide explains the differences, the trade-offs and a simple way to test before you commit.
10 min read