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

List Internet Archive Wayback Machine snapshots for URLs or whole domains (date range, status, MIME, collapse by change/day/URL), get the closest capture to a date, and optionally download archived page text or HTML. From $0.20 per 1,000 snapshots.

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

## Pricing

Pay per event

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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: Archived Snapshots & Pages

List every **Wayback Machine snapshot** of a URL or a whole domain from the **Internet Archive**, with capture date, original HTTP status, MIME type and content digest, and optionally **download the archived page** itself as clean text or raw HTML. Filter by **date range**, **status code**, **MIME type** and URL regex, de-duplicate to **one capture per day/month/year** or **only captures where the content changed**, or jump straight to the **snapshot closest to a date**.

Uses the Internet Archive's official public APIs (CDX server, availability API, raw `id_` captures). No browser, no login, no start fee.

### What you can do with it

- **Find deleted pages:** match a whole domain, collapse by URL and get every page ever archived, including ones that no longer exist (404s, old blog posts, removed products).
- **Expired-domain and SEO research:** see how long a domain has been live, what it hosted, when it changed hands, and how many pages it had.
- **Content and price history:** collapse by *content changed* to get only captures where a page actually changed, then fetch them to compare copy, pricing or terms over time.
- **Competitor monitoring:** what did a competitor's pricing or landing page say on a given date? Use *Closest snapshot to date*.
- **Recover lost content:** download archived text or HTML of pages from a dead site.

### Input

| Field | What it does |
|---|---|
| `urls` | Page URLs or domains, one per line. |
| `matchType` | `exact` (default), `prefix`, `host` or `domain` (host + subdomains). |
| `from` / `to` | Date range: `YYYY`, `YYYY-MM` or `YYYY-MM-DD`. |
| `collapse` | `digest` (content changed), `hour`, `day`, `month`, `year`, or `url` (one per unique URL). |
| `statusCodes`, `mimeType`, `urlRegex` | Server-side filters, e.g. `["200"]`, `text/html`, `.*/product/.*`. |
| `newestFirst` | Latest captures first. |
| `closestTo` | Return only the single capture closest to this date, per URL. |
| `fetchContent`, `maxPagesFetched`, `contentFormat`, `maxContentChars` | Download archived pages (status-200 captures) as text or HTML. |
| `maxSnapshotsPerUrl`, `maxItems` | Caps (and cost control). `maxItems` is shared fairly: every URL gets an equal share, and URLs with fewer captures pass the rest on. |

Examples:

```json
{ "urls": ["example.com"], "collapse": "year", "from": "2005", "to": "2015" }
```

```json
{ "urls": ["oldsite.com"], "matchType": "domain", "collapse": "url", "statusCodes": ["200"], "mimeType": "text/html" }
```

```json
{ "urls": ["https://www.competitor.com/pricing"], "collapse": "digest", "fetchContent": true, "maxPagesFetched": 20 }
```

### Output

One item per snapshot:

```json
{
  "inputUrl": "https://www.python.org/", "url": "http://www.python.org:80/",
  "timestamp": "20120603061049", "archivedAt": "2012-06-03T06:10:49Z",
  "snapshotUrl": "https://web.archive.org/web/20120603061049/http://www.python.org:80/",
  "rawUrl": "https://web.archive.org/web/20120603061049id_/http://www.python.org:80/",
  "statusCode": 200, "mimeType": "text/html", "digest": "…", "length": 5810, "urlkey": "org,python)/",
  "title": "Python Programming Language – Official Website", "metaDescription": "Home page for Python…",
  "contentType": "text/html", "content": "About\nNews\nDocumentation…", "contentLength": 3510, "contentTruncated": false
}
```

`title`, `metaDescription`, `content*` appear only with *Fetch content*. `requestedDate` appears with *Closest snapshot to date*. `length` is the compressed size of the archived record. A per-URL summary (snapshots returned, pages fetched, whether *Max snapshots in total* cut a URL short) is saved to the key-value store as `SUMMARY`.

### Pricing

Pay per result, with lower prices on higher Apify plans, no start fee:

- **Snapshot listed:** **$0.50 per 1,000 snapshots** on the free plan, down to **$0.20 per 1,000** on Gold and above.
- **Page fetched** (only with *Fetch content*, only when the archived page was actually downloaded): **$2.00 per 1,000 pages** on the free plan, down to **$1.00 per 1,000** on Gold.

Filters, collapse and caps apply before you are charged. A run where the Wayback Machine has no captures at all fails clearly instead of silently returning an empty dataset; a filtered run with no matches succeeds with 0 results.

### Limits and notes

- The Internet Archive rate-limits its APIs, so the actor stays at about one request per second with automatic back-off. Big listings can take the archive a minute or more to answer; fetching page content is roughly one page per second.
- For a few very large sites the Wayback Machine does not allow prefix/host/domain listings. Those URLs return the captures of the exact URL instead, with a note in `SUMMARY`.
- Large domains can have millions of captures: use `collapse`, filters and `maxItems` (default 1,000).
- Only captures the Internet Archive has made public are returned; excluded sites return nothing.
- Content is returned for text formats (HTML, XML, JSON, plain text) up to 5 MB per page; binary captures are listed but not downloaded.
- Public data from the Internet Archive's documented public APIs.

# Actor input Schema

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

One per line: a page URL (`https://example.com/pricing`) or a domain (`example.com`). With *Match type* = prefix/host/domain, every archived URL under it is listed.

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

Which archived URLs count as a match. Use *domain* with *Collapse = url* to list every page ever archived on a site (find deleted pages).

## `from` (type: `string`):

Only captures on or after this date: `YYYY`, `YYYY-MM` or `YYYY-MM-DD`.

## `to` (type: `string`):

Only captures on or before this date: `YYYY`, `YYYY-MM` or `YYYY-MM-DD`.

## `collapse` (type: `string`):

Keep only the first capture per group. *Content changed* returns only captures whose content differs from the previous one: ideal for change history and price tracking.

## `statusCodes` (type: `array`):

Keep only captures with these original HTTP statuses, e.g. `200`, `301`, `404`, or `2xx`. Empty = all.

## `mimeType` (type: `string`):

Keep only this content type, e.g. `text/html`, `application/pdf`, `image/*`. Empty = all.

## `urlRegex` (type: `string`):

Keep only archived URLs matching this regular expression (whole URL), e.g. `.*/product/.*`. Useful with prefix/domain match.

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

Return the most recent captures first (with a cap, you get the latest N instead of the oldest N).

## `closestTo` (type: `string`):

Instead of listing, return the ONE capture of each URL closest to this date (`YYYY-MM-DD`). Uses the Wayback availability API.

## `fetchContent` (type: `boolean`):

Download the archived page for captures with status 200 (original bytes, no Wayback toolbar) and add `content`, `title`, `metaDescription`. Charged per page fetched.

## `maxPagesFetched` (type: `integer`):

Cap on archived pages downloaded in the whole run (only with *Fetch content*).

## `contentFormat` (type: `string`):

Plain text (scripts/styles removed) or the raw archived HTML.

## `maxContentChars` (type: `integer`):

Truncate each page's content to this many characters. 0 = no limit.

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

0 or empty = no limit.

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

Hard cap on results for the whole run (also caps your cost), shared fairly between your URLs: each gets an equal share and URLs with fewer captures pass the rest on. 0 = no limit.

## Actor input object example

```json
{
  "urls": [
    "example.com"
  ],
  "matchType": "exact",
  "collapse": "none",
  "newestFirst": false,
  "fetchContent": false,
  "maxPagesFetched": 10,
  "contentFormat": "text",
  "maxContentChars": 100000,
  "maxItems": 1000
}
```

# Actor output Schema

## `snapshots` (type: `string`):

One item per archived snapshot (Wayback Machine capture).

# 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("tidyharvest/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("tidyharvest/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 tidyharvest/wayback-machine-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,tidyharvest/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/68cSXt4NqNydGds4k/builds/d5cqgjju2xFOiHrg8/openapi.json
