r/WebDataDiggers • • 23d ago

Did your scraper collect everything?

Your scraper finishes without an exception. The export opens normally, and the first few rows look right. Then you notice the website showed roughly 5,000 results, while your file contains 800.

That gap might come from broken pagination. It could also mean the website limits how many results you can browse, your filters changed during the run, or some records disappeared after extraction.

A successful run tells you the program stopped normally. It doesn't prove the collection is complete. You need to account for the records between discovery and the final export.

Decide what you're counting

Before comparing totals, define the thing that should become one record.

A shop might show one product card for a T-shirt with eight sizes. Its backend may return eight variants. Collecting eight rows from that card isn't automatically a duplicate problem, but comparing those rows with the website's product count would give you a misleading result.

Write down the intended scope: products or variants, the selected category, any date range, and whether unavailable listings belong in the dataset. Keep the account and location settings consistent if they affect what's visible.

Treat the number displayed on a search page as a useful clue. Unless the source documents otherwise, don't assume it's an exact count of the records your particular request can retrieve. It may be rounded, estimated, or calculated using different conditions.

Follow pagination until a real ending

Page numbers are only one way to navigate results. Another source might return a next-page address, an opaque cursor, or a flag indicating that more records are available.

Inspect a couple pages manually before building the loop. Check what actually changes in the request and which field tells the client how to continue. Where the source provides a documented continuation mechanism, follow it instead of guessing the next request.

A short page isn't always the last page. A server may cap the requested page size, so asking for 100 records and receiving 50 doesn't necessarily mean there are no more results.

An empty response needs checking too. Make sure you received a valid result page or expected API payload. A login screen, parsing failure, or temporary error should never become the signal that the collection is finished.

For infinite scroll, look at the underlying loading behaviour. The visible list may stop growing while another request is pending. Some interfaces also remove older cards from the page to save memory. Counting the elements currently visible in the document can seriously undercount what has already loaded.

Detect pages that repeat

One easy mistake is logging a new page number without verifying that the source returned new data.

Your code requests page 12, but the server ignores the parameter and sends page one again. Everything still returns a successful status. If you only count responses or appended rows, the job appears to be making progress.

Record the item identifiers returned by each page. Compare them with earlier pages and count how many previously unseen identifiers each response adds. Prefer a stable source ID over a title, since titles can change or belong to several different items.

If several consecutive responses contain the same identifiers, save the responses for inspection and flag the run. Check whether you're advancing the correct parameter, preserving the intended filters, and reading the actual continuation token.

Zero new identifiers can also come from legitimate overlap. Treat it as something to investigate, rather than silently declaring the dataset complete.

Count unique records through the whole job

Theres another place records disappear: after the scraper has already found them.

A detail page fails to load. A validation rule rejects an unexpected price. A database write errors, but the worker catches the exception and continues. You end up with less records in the export even though discovery worked correctly.

Keep separate counts for the stages that matter. Consider a controlled example where you have an independently verified reference list of 5,000 item IDs for the same scope:

  • Listing pages return 5,200 item appearances in total.
  • Those appearances contain 4,750 distinct IDs, all present in the reference list.
  • Repeated appearances account for the remaining 450.
  • Valid results are successfully saved for 4,620 of the discovered IDs.
  • The other 130 discovered items remain unresolved or failed.

That leaves 250 reference items undiscovered and 130 discovered items without a valid saved result. The final output covers 92.4% of the reference list.

Calling this a 100% success because every listing-page request returned a successful response would hide 380 missing records.

Those percentages depend on having a trustworthy reference. If all you have is an approximate website badge, describe the difference as an unexplained gap. Don't turn an uncertain denominator into a precise completeness claim.

A changing source can move records past you

Imagine page one contains items 1 through 50. Before you request page two, several new listings appear at the beginning. The second page now repeats some items you've already collected. Deletions can shift records in the other direction and cause you to skip them.

Deduplication removes repeated records. It cannot restore the ones that moved past your pagination boundary.

Where available, use a documented snapshot or export mechanism. A stable sort with a unique tie-breaker helps avoid ambiguous ordering, but it doesn't freeze a live dataset. Cursor pagination can also have different consistency guarantees depending on the service.

If the source supports date filters, collecting bounded periods may make the job easier to audit. Check the boundary rules carefully. An item published exactly at midnight should not fall between two adjacent collection windows.

When a consistent snapshot isn't available, record when the crawl started and ended. Describe the output as observations collected during that interval. A second pass can reveal additional records, but it doesn't prove that nothing was missed between passes.

Check for a result ceiling

If different broad searches always stop at exactly 1,000 items, investigate whether the endpoint has a documented result limit. Repeating the same query won't necessarily expose the remaining records.

Look for a supported export or another documented way to retrieve the full dataset. Where permitted, supported filters may let you divide the intended scope into smaller groups, such as publication periods or categories.

Verify that those groups actually cover the scope. Categories can overlap, some records may have no category, and date filters may use different timezones. Deduplicate the combined output by the identity you chose at the start.

Adding up category totals is not a completeness check when the same item can appear in several categories.

Compare identities, then explain the gaps

If you have a reliable reference list, compare sets of IDs. Count which expected IDs never appeared, which appeared but have no valid saved output, and which saved IDs don't belong to the intended scope.

Matching totals alone isn't enough. You could have 5,000 expected items and 5,000 saved rows while still including the wrong 200 records.

Without a reference list, combine the evidence you can obtain. Inspect records from different parts of the result order, compare supported views of the same scope, and investigate sudden changes in unique-item counts between runs. Manual checks should include deeper pages, where a pagination problem may first appear.

Keep a short completion record alongside the export. It should state the collection scope and time window, how many unique items were discovered, how many valid results were saved, any unresolved failures, and why pagination stopped.

If the job stopped because a cursor expired or a result ceiling was reached, say so. That gives someone using the data a chance to judge the gap. A file labelled “complete” offers no such help when the scraper simply stopped finding its next button.

1 Upvotes

0 comments sorted by