# Wayback Machine Scraper: Snapshots, History & Archived Pages (`winterlock/wayback-machine-scraper`) Actor

List every Internet Archive snapshot of a URL or a whole domain, find the closest capture to a date, track how a page changed over time, and download the archived HTML. Official CDX and availability APIs, no API key.

- **URL**: https://apify.com/winterlock/wayback-machine-scraper.md
- **Developed by:** [Alex Burton](https://apify.com/winterlock) (community)
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.00 / 1,000 snapshot rows

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Wayback Machine Scraper: Snapshots, History & Archived Pages

Everything the Internet Archive holds about a URL or a whole domain, from the official CDX and availability APIs. No API key, no scraping.

| Mode | What you get |
|---|---|
| **List snapshots** | Every capture of a URL or domain with its date, HTTP status, MIME type, size and content hash |
| **Closest snapshot** | The single capture nearest a date you name, ready to link to |
| **Page history** | Only the captures where the content actually changed, each labelled with what changed |
| **Download archived content** | The archived HTML or text itself, as originally captured |

### Why use this one

- **It reads the header row.** The CDX API returns a JSON array whose first row names the fields rather than holding data. Parsers that miss this emit a phantom snapshot of a page called `original` captured in the year `timestamp`, and shift every column if the Archive changes the default field order. This Actor maps each row against the header it was given.
- **It parses Wayback timestamps correctly.** `20020120142510` is all digits, so a naive date parser reads it as a unix epoch and reports the year 2604. These get their own parser here.
- **Page history is genuinely useful.** A page crawled daily for ten years gives thousands of identical captures. Collapsing on the content hash leaves only the real changes, and each row says whether the status, type or size moved.
- **Archived content comes back clean.** Downloads use the `id_` form of the snapshot URL, which returns the original bytes without the Archive's navigation toolbar injected into the HTML.
- **It pages past the limit.** Large queries continue with a resume key instead of silently stopping at the first page.

### How to use it

1. Choose **What to do**.
2. Paste your **URLs**, one per line.
3. Pick a **Match type**: `exact` for one page, `prefix` for a path, `domain` for a site and its subdomains.
4. Optionally set **From date** / **To date**, or turn on **Only successful captures**.
5. Click **Start**, then download as JSON, CSV, Excel or HTML.

#### Example input: every archived page on a domain in 2020

```json
{
  "mode": "snapshots",
  "urls": ["example.com"],
  "matchType": "domain",
  "fromDate": "2020",
  "toDate": "2020",
  "onlySuccessful": true,
  "maxSnapshotsPerUrl": 2000
}
```

#### Example input: how a pricing page changed

```json
{
  "mode": "pageHistory",
  "urls": ["https://example.com/pricing"],
  "maxSnapshotsPerUrl": 100
}
```

#### Example input: what did this page say in January 2020

```json
{
  "mode": "fetchSnapshot",
  "urls": ["https://example.com/"],
  "fromDate": "20200101",
  "toDate": "20200131",
  "copiesPerUrl": 1
}
```

### Output

**Snapshot**

```json
{
  "type": "snapshot",
  "query": "example.com",
  "url": "http://example.com:80/",
  "timestamp": "20020120142510",
  "archivedOn": "2002-01-20T14:25:10Z",
  "statusCode": 200,
  "ok": true,
  "mimeType": "text/html",
  "digest": "HT2DYGA5UKZCPBSFVCV3JOBXGW2G5UUA",
  "length": 1792,
  "snapshotUrl": "https://web.archive.org/web/20020120142510/http://example.com:80/",
  "rawSnapshotUrl": "https://web.archive.org/web/20020120142510id_/http://example.com:80/"
}
```

**Page history** adds `version` and `change`:

```json
{ "version": 4, "archivedOn": "2021-06-02T09:14:55Z", "change": "size 1792 to 2410 (+618 bytes)" }
```

**Closest snapshot**

```json
{
  "type": "availability",
  "query": "example.com",
  "available": true,
  "timestamp": "20260925000024",
  "archivedOn": "2026-09-25T00:00:24Z",
  "statusCode": 200,
  "snapshotUrl": "http://web.archive.org/web/20260925000024/https://example.com/"
}
```

### Capture order

The archive stores captures oldest first. **Download archived content** therefore
always takes the most recent capture inside whatever date range you set, which is
what "the archived page" almost always means. **List snapshots** and **Page
history** stay chronological so they can page through long histories; turn on
**Newest captures first** to take the most recent ones instead.

### Pricing

| Result | Price |
|---|---|
| Snapshot row | $2.00 per 1,000 |
| Downloaded archived page | $5.00 per 1,000 |

Downloading content costs more because each row is a second request for the page itself. Set a maximum spend per run in the run options and the Actor stops cleanly when it is reached.

### Limits to know about

These come from the Internet Archive, not from this Actor:

- **The Archive is a nonprofit running on donations.** Default concurrency is 2 on purpose. Please do not raise it far for large jobs.
- **The CDX index can be slow** on a broad `domain` query over a large site, and the Archive sometimes returns a timeout under load. The Actor retries with backoff and reports what it managed to collect.
- **Not everything is archived.** Pages blocked by robots.txt at crawl time, or later excluded at a site owner's request, will not appear even though the site existed.
- **`statuscode` can be empty** on revisit records, where the Archive stored a pointer to an identical earlier capture rather than the page itself. Those rows come back with a null status.
- **Downloaded content is the raw capture**, which for old pages may be in a legacy encoding. It is returned as text with whitespace tidied, not as rendered HTML.

### FAQ

**Do I need an API key?** No. Both APIs are public.

**Can I archive a page rather than read one?** No. This Actor only reads what the Archive already holds.

**Why do I get fewer rows than I asked for?** Either the page has fewer captures, or your filters excluded them. Turning off *Only successful captures* is the usual fix.

**What is the difference between the two snapshot URLs?** `snapshotUrl` opens the capture in the Wayback Machine with its toolbar, which is what you want in a browser. `rawSnapshotUrl` returns the original bytes, which is what you want in a script.

**Is this legal?** The Wayback Machine is a public archive with public APIs, used here as intended. Archived pages remain subject to the copyright of whoever wrote them.

### Feedback

Found a bug or need a field that's missing? Open an issue on the Actor's **Issues** tab.

# Actor input Schema

## `mode` (type: `string`):

List snapshots, find the closest capture to a date, track how a page changed, or download the archived content itself.

## `urls` (type: `array`):

One per line. A full URL, or a bare hostname to cover a whole site when combined with a match type below.

## `matchType` (type: `string`):

Exact matches that one URL. Prefix matches everything under a path. Host matches one hostname. Domain matches the hostname and all its subdomains.

## `fromDate` (type: `string`):

Earliest capture to include. A year (2015), a month (201503), a date (20150301) or a full timestamp all work.

## `toDate` (type: `string`):

Latest capture to include, in the same formats as From date.

## `newestFirst` (type: `boolean`):

For List snapshots and Page history. The archive is ordered oldest first, so a capped run returns a page's earliest captures; turn this on to take the most recent ones instead. Download archived content always takes the most recent capture in the date range you set.

## `onlySuccessful` (type: `boolean`):

Skip captures the Archive recorded as redirects or errors, keeping only HTTP 200 responses.

## `filters` (type: `array`):

Raw CDX filters, one per line, such as mimetype:text/html or !statuscode:404. A leading ! negates the match.

## `collapse` (type: `array`):

Collapse consecutive rows sharing a field, one per line. digest keeps only captures where the content changed; timestamp:6 keeps one per month.

## `nearestTo` (type: `string`):

For Closest snapshot. The date to search around, such as 20200101. Leave empty for the most recent capture.

## `maxSnapshotsPerUrl` (type: `integer`):

For List snapshots and Page history. Popular pages hold tens of thousands of captures, so this is the main control on run size and cost.

## `copiesPerUrl` (type: `integer`):

For Download archived content. 1 downloads the most recent capture in your date range; a higher number also downloads the captures before it, newest first. Each copy is one billed result.

## `maxContentCharacters` (type: `integer`):

For Download archived content. Longer pages are cut off at this length and flagged as truncated.

## `maxItems` (type: `integer`):

Stop the run after saving this many items. Leave empty for no limit.

## `maxConcurrency` (type: `integer`):

The Internet Archive is a nonprofit running on donations. Please leave this low.

## `proxyConfiguration` (type: `object`):

Not needed for ordinary runs. Turn on Apify Proxy only if the Archive rate-limits a very long batch.

## Actor input object example

```json
{
  "mode": "snapshots",
  "urls": [
    "example.com"
  ],
  "matchType": "exact",
  "newestFirst": false,
  "onlySuccessful": false,
  "maxSnapshotsPerUrl": 500,
  "copiesPerUrl": 1,
  "maxContentCharacters": 200000,
  "maxConcurrency": 2,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

## `results` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "urls": [
        "example.com"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("winterlock/wayback-machine-scraper").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "urls": ["example.com"] }

# Run the Actor and wait for it to finish
run = client.actor("winterlock/wayback-machine-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "urls": [
    "example.com"
  ]
}' |
apify call winterlock/wayback-machine-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,winterlock/wayback-machine-scraper"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/qpdVBIH8FKWwWcraX/builds/wZmclEeAd2oH9K3eo/openapi.json
