# Wayback Machine Archive Scraper (`andok/wayback-machine-scraper`) Actor

Fetch historical snapshots of any webpage from the Internet Archive. Perfect for digital forensics and tracking deleted content.

- **URL**: https://apify.com/andok/wayback-machine-scraper.md
- **Developed by:** [Andok](https://apify.com/andok) (community)
- **Categories:** Developer tools, Other
- **Features:** Limited permissions
- **Stats:** 201 total users, 30 monthly users, 100.0% runs succeeded, 2 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.47 / 1,000 snapshot retrieveds

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 for Historical Snapshots

Retrieve historical web page snapshots from the Internet Archive for compliance checks, competitive due diligence, and content recovery. Feed it a list of URLs and get back every archived snapshot with timestamps, status codes, and archive links — or optionally fetch the full HTML of the latest snapshot. Built on the official Wayback CDX API for accurate, structured results.

### Features

- **Bulk URL processing** — check snapshot history for dozens of URLs in a single run
- **Date range filtering** — narrow results to a specific time window with `from` and `to` parameters
- **Deduplication** — collapse identical snapshots by digest to reduce noise
- **Status code filtering** — only return snapshots with specific HTTP status codes (default: 200)
- **HTML retrieval** — optionally fetch the archived HTML content for the most recent snapshot
- **Concurrent processing** — configurable parallelism for faster batch runs
- **Structured metadata** — every snapshot includes timestamp, original URL, MIME type, and archive URL

### Input

| Field | Type | Required | Default | Description |
|-------|------|----------|---------|-------------|
| `urls` | `array` | Yes | `["https://example.com"]` | List of URLs to look up in the Wayback Machine |
| `url` | `string` | No | — | Single URL (backwards compatible, merged with `urls`) |
| `from` | `string` | No | — | Start date for snapshot range (format: `YYYY` or `YYYYMMDDhhmmss`) |
| `to` | `string` | No | — | End date for snapshot range (format: `YYYY` or `YYYYMMDDhhmmss`) |
| `limit` | `integer` | No | `50` | Maximum snapshots to return per URL (1-5000) |
| `collapse` | `string` | No | `digest` | Collapse parameter to deduplicate snapshots (e.g. `digest`, `timestamp:8`) |
| `filterStatus` | `string` | No | `statuscode:200` | HTTP status filter for snapshots (e.g. `statuscode:200`) |
| `includeHtml` | `boolean` | No | `false` | Fetch the archived HTML content for the latest snapshot (experimental) |
| `timeoutSeconds` | `integer` | No | `20` | Per-request timeout in seconds (1-120) |
| `concurrency` | `integer` | No | `5` | Number of URLs to process in parallel (1-25) |

#### Input Example

```json
{
  "urls": ["https://example.com", "https://news.ycombinator.com"],
  "from": "2023",
  "to": "2025",
  "limit": 10,
  "includeHtml": false
}
```

### Output

Each dataset item represents one input URL with its snapshot history. Key fields:

- `inputUrl` (`string`) — the URL that was looked up
- `snapshotCount` (`number`) — total number of matching snapshots found
- `snapshots` (`array`) — list of snapshot objects with `timestamp`, `original`, `statuscode`, `mimetype`, `length`, and `archiveUrl`
- `latestSnapshot` (`object`) — the most recent snapshot, or `null` if none found
- `latestHtml` (`string`) — archived HTML content (only when `includeHtml` is enabled)
- `checkedAt` (`string`) — ISO timestamp of when the check was performed
- `error` (`string`) — error message if the lookup failed, otherwise `null`

#### Output Example

```json
{
  "inputUrl": "https://example.com",
  "snapshotCount": 3,
  "snapshots": [
    {
      "timestamp": "20250110153022",
      "original": "https://example.com",
      "statuscode": 200,
      "mimetype": "text/html",
      "length": 1256,
      "archiveUrl": "https://web.archive.org/web/20250110153022/https://example.com"
    }
  ],
  "latestSnapshot": {
    "timestamp": "20250110153022",
    "original": "https://example.com",
    "statuscode": 200,
    "mimetype": "text/html",
    "length": 1256,
    "archiveUrl": "https://web.archive.org/web/20250110153022/https://example.com"
  },
  "latestHtml": null,
  "checkedAt": "2025-01-20T12:00:00.000Z",
  "error": null
}
```

### Pricing

| Event | Cost |
|-------|------|
| Snapshot Retrieved | Pay-per-event (see actor pricing page) |

### Use Cases

- **Compliance & legal** — retrieve historical versions of terms of service, privacy policies, or product pages
- **Competitive due diligence** — review how a competitor's website evolved over time before a deal or partnership
- **Content recovery** — recover lost or deleted web pages from the Internet Archive
- **SEO auditing** — check when a page was last crawled and compare historical content changes
- **Brand monitoring** — verify historical claims or track how a brand's messaging changed
- **Research & journalism** — access archived versions of news articles or government pages

### Related Actors

| Actor | What it adds |
|-------|-------------|
| [Google News Scraper](https://apify.com/andok/google-news-scraper) | Monitor current news coverage alongside historical archive lookups |
| [Broken Links Checker](https://apify.com/andok/broken-links-checker) | Find dead links on your site, then recover them via Wayback Machine |
| [Sitemap Extractor](https://apify.com/andok/sitemap-extractor) | Extract all URLs from a sitemap to feed into bulk Wayback lookups |

### Notes

- The Wayback Machine CDX API is free but may throttle under heavy load. Use the `concurrency` setting conservatively for large batches.
- The `includeHtml` option is experimental and may fail for very large pages or pages with complex JavaScript rendering.

# Actor input Schema

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

List of URLs to look up in the Wayback Machine. Each URL will return its archived snapshot history.

## `url` (type: `string`):

Optional single URL for backwards compatibility. Will be merged with the URLs list above.

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

Start date for the snapshot range. Accepts YYYY (e.g. 2020) or full timestamp YYYYMMDDhhmmss.

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

End date for the snapshot range. Accepts YYYY (e.g. 2025) or full timestamp YYYYMMDDhhmmss.

## `limit` (type: `integer`):

Maximum number of snapshots to return for each URL. Higher values increase run time.

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

Deduplicate snapshots using the Wayback CDX collapse parameter. Use "digest" to skip identical page versions, or "timestamp:8" to keep one per day.

## `filterStatus` (type: `string`):

Filter snapshots by HTTP status code. Default "statuscode:200" returns only successful snapshots. Remove to include redirects and errors.

## `includeHtml` (type: `boolean`):

Fetch the full archived HTML content for the latest snapshot of each URL. Experimental — may fail for very large pages.

## `timeoutSeconds` (type: `integer`):

Per-request timeout for Wayback Machine API calls in seconds.

## `concurrency` (type: `integer`):

Number of URLs to process in parallel. Lower values are safer for large batches to avoid rate limiting.

## Actor input object example

```json
{
  "urls": [
    "https://apple.com"
  ],
  "limit": 50,
  "collapse": "digest",
  "filterStatus": "statuscode:200",
  "includeHtml": false,
  "timeoutSeconds": 20,
  "concurrency": 5
}
```

# Actor output Schema

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

No description

## `resultsCsv` (type: `string`):

No description

## `run` (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": [
        "https://apple.com"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("andok/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": ["https://apple.com"] }

# Run the Actor and wait for it to finish
run = client.actor("andok/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": [
    "https://apple.com"
  ]
}' |
apify call andok/wayback-machine-scraper --silent --output-dataset

```

## MCP server setup

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