# Incremental crawling: check for changes before you refetch

Incremental crawling revisits a site, checks known pages for changes and looks for new ones. Two dated crawls of one docs site, 17 hours apart, show the cost.

Canonical: https://spider.cloud/learn/incremental-crawling/

Incremental crawling means revisiting a site you crawled before, looking for new pages and checking each known page for a change before you process it again. Where the server can say a page is unchanged, the crawler skips downloading it.

To do that, the crawler keeps a record from the earlier run: the addresses it saw and a way to tell whether each one changed.

The other approach is a full recrawl: start at the front page every time and fetch everything again. It is simpler to build, and on a site that rarely changes it mostly hands you a second copy of what you had. A scraping job that runs every day stays cheap for you and light on the site by crawling incrementally, which is why it has a place in the [web scraping guide](/web-scraping/). The run further down shows what a full recrawl of one documentation site returned after 17 hours. It measures the repeat, not a saving.

## What a crawler keeps between runs

An incremental crawl starts from a record of the last one. For each address it usually holds:

- the address, written one way, so the same page is not stored under two names. The [canonical URL page](/learn/canonical-url/) covers how a site names its own pages.
- when it was fetched and the status that came back.
- the `ETag` or `Last-Modified` value the server sent, if it sent one.
- a fingerprint of the content you kept, such as a hash, so a changed page can be told from an unchanged one even when the server sends no validator.

With that record, the next pass sorts every address into one of four groups: added, missing, changed and unchanged. Missing means this run did not return the address. It is not proof the page is gone, because a capped crawl can skip a page that still exists, so fetch a missing address once more before you count it as removed. When the server sends a change signal the crawler can use, only added and changed pages need a full download. When it sends none, the crawler may have to download an unchanged page just to compare it, as the next section explains.

This clip sets the two crawls side by side and compares them by address.

Check for changes before you refetch. 54 s, no sound. The words are on screen, and the captions button shows them at your own text size.

Read the transcript

Check for changes before you refetch. One docs site crawled twice, with nothing carried between the runs.

The same crawl ran twice. Each returned 25 pages, one twice. run 1, 20 Nov, 18:47 UTC: 25 pages in 30.5 s, 24 distinct addresses. run 2, 21 Nov, 11:42 UTC: 25 pages in 29.1 s, 24 distinct addresses. 16 h 55 min: between the two crawls. 24: distinct addresses in each. 1: page each run returned twice.

The order differs between runs. Compare by address, not line by line. The first 6 addresses of each run, in the order they arrived. Run 1: /, /community/vulnerabilities/, /community/release-process/, /community/support/, /community/recommended/, /. Run 2: /, /community/updates/, /community/faq/, /community/recommended/, /user/install/, /dev/authors/. 1: of the first 6 places hold the same address. 24: of 24 addresses are in both runs.

Nothing was added, missing or changed. All 24 came back the same. Between the runs: 0 added, 0 missing, 0 changed, 24 unchanged. 29.1 s: the second crawl took. 24: addresses fetched again in full.

A full recrawl fetched every unchanged page again. Each address, next run: compared with run 1. changed: Fetch and process it. missing: Fetch once more first. same: Keep the stored copy. This run: same.

Read the full page. The page is at spider.cloud/learn/incremental-crawling.

## How a crawler learns that a page changed

The cheapest way is to ask the server. HTTP has conditional requests: the client sends back the validator from its last visit, and a server that supports them answers with a short reply when nothing changed. In a December 2024 post on the Search Central blog, Google explains how its crawlers use this: when the `ETag` the crawler sends matches the current one, "your server should return an HTTP 304 (Not modified) status code with no HTTP body". The same post names the sites that gain most: "Especially if you have a large site with rarely-changing content under individual URLs, allowing caching locally may help your site be crawled more efficiently." A conditional request is still one request per address. What it saves is the page body.

The sitemap can help too. Each entry may carry a `lastmod` date, and the sitemaps.org protocol says "the date must be set to the date the linked page was last modified, not when the sitemap is generated." Not every site keeps to that, so a newer date is a reason to fetch, not proof of a change. The protocol says even less for `changefreq`: "Please note that the value of this tag is considered a hint and not a command." The [sitemaps page](/learn/sitemaps/) covers reading the file.

When the server sends no validator and the sitemap has no dates, the fallback is to fetch the page and compare it with your stored copy. That catches the change, but the fetch still happens. It saves only the work you do afterwards, such as parsing, indexing or sending text to a model.

None of these finds pages that were added. A `304` or a `lastmod` date speaks for an address you already know. New addresses come from the sitemap, or from links on pages that did change, such as an index or a release notes page. A crawler that only revisits its old list never sees them. Listings that put new items on page one are covered on the [pagination page](/learn/pagination/).

## A docs site crawled twice, 17 hours apart

For the test we used the documentation for Python's Requests library, a site written to be read. We crawled it twice with the same body, first on 2026-11-20 at 18:47 UTC and again on 2026-11-21 at 11:42 UTC. The second request carried no state from the first: no stored list, validator or hash, only the same body sent again. The body caps the crawl at 30 pages, waits 1000 milliseconds between requests, uses `http`, which runs no JavaScript, and names the client in `user_agent`. To try it, put an API key in `SPIDER_API_KEY`.

```bash
curl -s https://api.spider.cloud/crawl \
  -H "Authorization: Bearer $SPIDER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url": "https://requests.readthedocs.io/en/latest/", "limit": 30, "request": "http", "return_format": "markdown", "delay": 1000, "user_agent": "examplebot/1.0 (+https://example.com/bot; bot@example.com)"}'
```

Each page comes back as an object holding its `url`, `status`, `error` and `content`. These are the first six pages of each run, in the order they arrived.

```text
run 1af0a7f684e959fa, 2026-11-20 18:47 UTC, 25 pages in 30.5 seconds
200  https://requests.readthedocs.io/en/latest/
200  https://requests.readthedocs.io/en/latest/community/vulnerabilities/
200  https://requests.readthedocs.io/en/latest/community/release-process/
200  https://requests.readthedocs.io/en/latest/community/support/
200  https://requests.readthedocs.io/en/latest/community/recommended/
200  https://requests.readthedocs.io/en/latest/

run eae68f7c2df39953, 2026-11-21 11:42 UTC, 25 pages in 29.1 seconds
200  https://requests.readthedocs.io/en/latest/
200  https://requests.readthedocs.io/en/latest/community/updates/
200  https://requests.readthedocs.io/en/latest/community/faq/
200  https://requests.readthedocs.io/en/latest/community/recommended/
200  https://requests.readthedocs.io/en/latest/user/install/
200  https://requests.readthedocs.io/en/latest/dev/authors/
```

Every page in both runs had status 200 and a null `error`. We kept the first 2000 characters of each page's `content`. This is the top of the release history on the `/community/updates/` page, below its title lines, and it read the same in both runs.

```text
# Release History
## dev
* [Short description of non-trivial change.]
## 2.34.2 (2026-05-14)
```

## What changed between the runs

Each run returned 25 pages and 24 distinct addresses, because the start page came back twice. In the first run the repeat is the sixth line above. With the repeat dropped, the comparison comes out like this.

| Count                                | Run 1 | Run 2 |
| ------------------------------------ | ----- | ----- |
| Pages returned                       | 25    | 25    |
| Distinct addresses                   | 24    | 24    |
| Addresses added since run 1          |       | 0     |
| Addresses missing from run 2         |       | 0     |
| Addresses whose kept content changed |       | 0     |

The two runs hold the same 24 addresses in a different order. The second run's second page is the release history, while the first run's second page is the vulnerability disclosure page. Comparing the responses line by line would report changes that are not there. Compare them as sets keyed by address.

So the second crawl took 29.1 seconds and returned the same 24 addresses, and the saved content of every one was unchanged. Those 29.1 seconds are the time of a full recrawl. Neither run sent a conditional request, so the test measured no time or cost saved. What it shows is the repeat that incremental crawling is meant to cut. A crawler holding a validator for each page would still ask about all 24, but on a server that supports conditional requests, each unchanged page could come back as a `304` with no body.

Some things the run cannot tell you. It kept no response headers, so it does not show whether this site sends `ETag` or `Last-Modified`. Check that with one request before you design around it. It compared only the first 2000 characters of each page, so a change further down would not show here. And 17 hours is one interval on one site. A documentation site tends to change when the library ships a release, which makes the release history the page to watch. Its newest entry was 2.34.2, dated 2026-05-14, in both runs.

## How often to come back

Match the interval to how the site changes, not to how often you can run a job. A site can tell you itself: the Google post suggests servers "Set the value of the max-age field to the expected number of seconds the content will be unchanged." That value says how long a cached copy stays fresh. Until it runs out, a crawler can put off asking about that page again. It is not a crawl schedule, and it does not promise that the page stays unchanged for that long.

Every pass costs the site requests, even when nothing changed. Read the site's robots.txt again before each pass, as the [robots.txt page](/learn/robots-txt/) describes, and check that its terms allow copying on a schedule, not only once. The [crawl budget page](/learn/crawl-budget/) covers what a page limit leaves out, which matters here too: an address missing from one capped run may still exist. How search engines decide when to come back is on the [how search crawlers work page](/learn/how-search-crawlers-work/).

## Do this, avoid this

### Do this

- Store each address with its fetch time, status, any ETag or Last-Modified value, and a hash of the content you kept.
- Drop repeated addresses before you compare two runs, then compare them as sets.
- Send the stored validator on the next visit, and keep your saved copy when the answer is 304.
- Read the sitemap and the index pages on every pass so new addresses get found.

### Avoid this

- Comparing two runs line by line. The order pages arrive in changes between runs.
- Deleting a stored page the first time a capped run leaves it out.
- Hashing parts of a page that change on every load, such as a timestamp, so every page looks changed.
- Skipping a page only because its sitemap date is old.

## Try it on a second day

Send the body above to a site you are allowed to read, and save each address with a hash of its content. Send it again a day later and count what was added, what is missing and what changed. Fetch each missing address once more before you count it as removed. If all three counts are zero, as ours were, keep a discovery pass on the sitemap and index pages so new addresses still turn up.

For the addresses you already hold, test conditional requests in two steps. First fetch one page and save the `ETag` or `Last-Modified` value from its response. Then request the same address again with that value in `If-None-Match` or `If-Modified-Since`, and check whether the answer is `304`. Use conditional requests only on a server that passes both steps. Our run kept no headers, so it cannot tell you whether this site does.

## Sources

1. [Google Search Central Blog, Crawling December: HTTP caching, 9 December 2024](https://developers.google.com/search/blog/2024/12/crawling-december-caching) Read November 21, 2026
2. [sitemaps.org, Sitemaps XML format](https://www.sitemaps.org/protocol.html) Read November 21, 2026
