# Wayback Machine Snapshots (historical page captures) (`flets_sv/wayback-machine-snapshots`) Actor

Get the capture history of any URL or domain from the Internet Archive: snapshot list, old page content and lost URLs. Pay per event.

- **URL**: https://apify.com/flets_sv/wayback-machine-snapshots.md
- **Developed by:** [FlEtsv](https://apify.com/flets_sv) (community)
- **Categories:** Other, Developer tools
- **Features:** Limited permissions
- **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.

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 Snapshots

### ¿Qué hace? / What it does

Consulta el historial de capturas de Internet Archive (Wayback Machine) para una URL o para un dominio entero. Tiene cuatro modos: listar las capturas de una URL, listar las URLs archivadas de un dominio, extraer el texto de una captura concreta y comparar el texto de dos fechas. Sirve para recuperar contenido antiguo, localizar URLs que ya no existen pero siguen archivadas y auditar cómo cambió una página.

Queries the Internet Archive (Wayback Machine) capture history for a single URL or a whole domain. It has four modes: list the captures of one URL, list the archived URLs of a domain, extract the text of a specific capture, and compare the text at two dates. It helps recover old content, find URLs that no longer exist but are still archived, and audit how a page changed.

### Input / Entrada

**Español**

- **modo**: `capturas`, `urls-dominio`, `contenido` o `comparar`.
- **urls**: páginas a consultar en los modos `capturas`, `contenido` y `comparar`.
- **dominio**: dominio a consultar en modo `urls-dominio`, por ejemplo `books.toscrape.com`.
- **fecha** (AAAA-MM-DD): captura cuyo texto se quiere en modo `contenido`. Vacía: la más reciente.
- **fechaA** y **fechaB** (AAAA-MM-DD): las dos capturas a comparar en modo `comparar`. Son obligatorias en ese modo.
- **maxResultados**: tope de capturas o URLs por consulta en capturas y urls-dominio (por defecto 100, es decir, como máximo 0,10 USD por consulta con el precio de 0,001 USD por captura). Al cobrarse por resultado, acota el coste de la ejecución; súbelo solo si necesitas más. Con `modoVigilancia` limita lo emitido por consulta en cada ejecución; lo que quede fuera sale en la siguiente.
- **modoVigilancia** (solo en `capturas` y `urls-dominio`): si está activo, guarda lo ya emitido en el store `wayback-machine-snapshots-vigilancia`. En ejecuciones posteriores, lo ya visto no se emite ni se cobra; solo salen capturas o URLs nuevas. En los modos `contenido` y `comparar` se ignora.

**English**

- **modo**: `capturas`, `urls-dominio`, `contenido` or `comparar`.
- **urls**: pages to query in `capturas`, `contenido` and `comparar` modes.
- **dominio**: domain to query in `urls-dominio` mode, for example `books.toscrape.com`.
- **fecha** (YYYY-MM-DD): capture whose text is wanted in `contenido` mode. Empty: the most recent one.
- **fechaA** and **fechaB** (YYYY-MM-DD): the two captures to compare in `comparar` mode. Both are required in that mode.
- **maxResultados**: cap on captures or URLs per query in capturas and urls-dominio modes (default 100, i.e. at most $0.10 per query at $0.001 per capture). Since billing is per result, it bounds the cost of a run; raise it only if you need more. With `modoVigilancia` it caps what is emitted per query in each run; anything left out comes out in the next run.
- **modoVigilancia** (only in `capturas` and `urls-dominio`): when on, it keeps what was already emitted in the `wayback-machine-snapshots-vigilancia` store. In later runs, anything already seen is neither emitted nor charged; only new captures or URLs come out. It is ignored in `contenido` and `comparar`.

Ejemplos / Examples: `ejemplos/capturas.json`, `ejemplos/urls-dominio.json`, `ejemplos/vigilancia.json`, `ejemplos/contenido.json`, `ejemplos/comparar.json`.

### Output / Salida

El resultado se guarda en el dataset por defecto de la ejecución, con un registro por captura, URL o comparación. En `capturas` y `urls-dominio` cada registro incluye `modo`, `consulta`, `urlkey`, `url`, `timestamp`, `fecha`, `urlArchivo` y los metadatos de la captura. En `contenido` añade `urlOriginal`, `texto` y `caracteres`. En `comparar` devuelve `capturaA`, `capturaB`, `porcentajeCambio`, `anadidos` y `quitados`.

Results are stored in the default dataset of the run, with one record per capture, URL or comparison. In `capturas` and `urls-dominio` each record includes `modo`, `consulta`, `urlkey`, `url`, `timestamp`, `fecha`, `urlArchivo` and the capture metadata. In `contenido` it adds `urlOriginal`, `texto` and `caracteres`. In `comparar` it returns `capturaA`, `capturaB`, `porcentajeCambio`, `anadidos` and `quitados`.

### Pricing / Precios

Se cobra por evento:

- `captura-consultada` (0,001 USD): un evento por cada captura o URL archivada devuelta en los modos `capturas` y `urls-dominio`.
- `contenido-descargado` (0,002 USD): un evento por cada captura cuyo texto se descarga. Es uno en `contenido` y dos en `comparar`.

Los precios están en `.actor/pay_per_event.json`.

Billing is per event:

- `captura-consultada` (0.001 USD): one event for each capture or archived URL returned in `capturas` and `urls-dominio` modes.
- `contenido-descargado` (0.002 USD): one event for each capture whose text is downloaded. It is one in `contenido` and two in `comparar`.

Prices are defined in `.actor/pay_per_event.json`.

### Casos de uso / Use cases

- **Recuperar contenido antiguo**: modo `contenido` con una fecha para obtener el texto de una página tal como estaba.

- **Encontrar URLs perdidas de un dominio**: modo `urls-dominio` para listar páginas archivadas que ya no están enlazadas.

- **Auditar cambios entre dos fechas**: modo `comparar` con `fechaA` y `fechaB` para ver qué texto se añadió o se quitó.

- **Vigilar capturas nuevas**: modo `capturas` o `urls-dominio` con `modoVigilancia` activo, para pagar solo por lo nuevo en cada ejecución.

- **Recover old content**: `contenido` mode with a date to get a page's text as it was.

- **Find lost URLs of a domain**: `urls-dominio` mode to list archived pages that are no longer linked.

- **Audit changes between two dates**: `comparar` mode with `fechaA` and `fechaB` to see what text was added or removed.

- **Watch for new captures**: `capturas` or `urls-dominio` mode with `modoVigilancia` on, so each run pays only for what is new.

### Validación local / Local validation

Para probar el Actor sin red ni token de Apify, compila y ejecuta el script en seco. Usa capturas fijas y tres pasadas: una normal y dos de vigilancia. Sale con error si hay duplicados, campos vacíos o si la segunda pasada de vigilancia emite algo.

To test the Actor without network access or an Apify token, build it and run the dry-run script. It uses fixed captures and three passes: one normal and two with vigilancia. It exits with an error if there are duplicates, empty fields, or if the second vigilancia pass emits anything.

```
npm run build -w actors/wayback-machine-snapshots && node actors/wayback-machine-snapshots/scripts/en-seco.mjs
```

### Limits / Límites

- Las consultas dependen de la disponibilidad de Internet Archive; los tiempos de respuesta pueden variar.

- Los datos son históricos: una captura puede no reflejar el estado actual de la página.

- El estado de `modoVigilancia` guarda como máximo las últimas 10000 capturas vistas por consulta.

- Queries depend on Internet Archive availability; response times may vary.

- The data is historical: a capture may not reflect the current state of the page.

- The `modoVigilancia` state keeps at most the last 10000 seen captures per query.

### FAQ / Preguntas

**¿Necesito cuenta en Internet Archive?** No. / **Do I need an Internet Archive account?** No.

**¿Qué pasa si una URL no tiene capturas?** El Actor no devuelve registros para esa URL. / **What if a URL has no captures?** The Actor returns no records for that URL.

**¿Qué pasa si cambio de modo con vigilancia activa?** El estado se guarda por combinación de modo, URLs y dominio. Cambiar esos campos empieza un estado nuevo. / **What happens if I change the mode while vigilancia is on?** State is kept per combination of mode, URLs and domain. Changing those fields starts a new state.

# Actor input Schema

## `modo` (type: `string`):

Qué consulta hacer: capturas de una URL, URLs de un dominio, texto de una captura o diferencias entre dos fechas.

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

Páginas cuyo historial de capturas se quiere consultar.

## `dominio` (type: `string`):

Dominio cuyas URLs archivadas se quieren listar (solo para el modo urls-dominio).

## `fecha` (type: `string`):

Fecha (AAAA-MM-DD) de la captura cuyo texto se quiere (solo para el modo Texto de una captura). Vacía: la más reciente.

## `fechaA` (type: `string`):

Fecha (AAAA-MM-DD) de la primera captura a comparar (solo para el modo Comparar dos fechas).

## `fechaB` (type: `string`):

Fecha (AAAA-MM-DD) de la segunda captura a comparar (solo para el modo Comparar dos fechas).

## `maxResultados` (type: `integer`):

Tope de capturas o URLs por consulta (solo para Capturas de una URL y URLs de un dominio). Como se cobra por resultado (0,001 USD por captura o URL), sirve para acotar el coste de una ejecución. Por defecto son 100, así que una ejecución de prueba cuesta como máximo 0,10 USD; súbelo solo si necesitas más resultados. Con el modo de vigilancia limita lo que se emite por consulta en cada ejecución (lo que quede fuera sale en la siguiente).

## `modoVigilancia` (type: `boolean`):

Solo para Capturas de una URL y URLs de un dominio: guarda lo ya emitido y, en las siguientes ejecuciones, solo emite y cobra capturas o URLs nuevas.

## Actor input object example

```json
{
  "modo": "capturas",
  "urls": [
    "https://books.toscrape.com/"
  ],
  "dominio": "books.toscrape.com",
  "fecha": "",
  "fechaA": "",
  "fechaB": "",
  "maxResultados": 100,
  "modoVigilancia": false
}
```

# Actor output Schema

## `resultados` (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://books.toscrape.com/"
    ],
    "fecha": "",
    "fechaA": "",
    "fechaB": ""
};

// Run the Actor and wait for it to finish
const run = await client.actor("flets_sv/wayback-machine-snapshots").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://books.toscrape.com/"],
    "fecha": "",
    "fechaA": "",
    "fechaB": "",
}

# Run the Actor and wait for it to finish
run = client.actor("flets_sv/wayback-machine-snapshots").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://books.toscrape.com/"
  ],
  "fecha": "",
  "fechaA": "",
  "fechaB": ""
}' |
apify call flets_sv/wayback-machine-snapshots --silent --output-dataset

```

## MCP server setup

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

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/1MIizvFGWhUiAAkSe/builds/MnKs7C4buspZHFTfX/openapi.json
