/** * Wayback Machine utilities for archiving and retrieving URLs. * * Provides functions to submit URLs to the Internet Archive's Wayback Machine, * check for existing archives, and retrieve historical snapshots. */ export interface ArchivedUrl { original: string; archived: string; } export interface UrlFormatOptions { /** Include id_ suffix for raw content without Wayback toolbar (default: true) */ raw?: boolean; } export interface WaybackOptions extends UrlFormatOptions { maxRetries?: number; userAgent?: string; } export interface SnapshotOptions extends UrlFormatOptions { limit?: number; from?: string; to?: string; } /** * Submit a URL to Wayback Machine for archiving. * * Uses the Save Page Now API to create a new snapshot. * Returns the archived URL with id_ suffix for direct access, or null on failure. * * @param url * @param options * @example * ```ts * const result = await submitToArchive("https://example.com"); * if (result) { * console.log(result.archived); // https://web.archive.org/web/20260117.../https://example.com * } * ``` */ export declare const submitToArchive: (url: string, options?: WaybackOptions) => Promise; /** * Check if a URL has been archived and get the latest snapshot. * * Uses the Wayback Availability API to find the closest available snapshot. * * @param url * @param options * @example * ```ts * const result = await checkArchived("https://example.com"); * if (result) { * console.log("Already archived:", result.archived); * } * ``` */ export declare const checkArchived: (url: string, options?: WaybackOptions) => Promise; /** * Get multiple historical snapshots for a URL. * * Uses the CDX Server API to retrieve snapshot history. * Results are returned in reverse chronological order (most recent first). * * @param url * @param options * @example * ```ts * // Get last 5 snapshots * const snapshots = await getSnapshots("https://example.com", { limit: 5 }); * for (const snapshot of snapshots) { * console.log(snapshot.archived); * } * * // Get snapshots from 2024 * const snapshots2024 = await getSnapshots("https://example.com", { * from: "20240101", * to: "20241231", * }); * ``` */ export declare const getSnapshots: (url: string, options?: SnapshotOptions) => Promise; /** * Parse the timestamp from a Wayback Machine archived URL. * * @param archivedUrl * @example * ```ts * const timestamp = parseTimestamp("https://web.archive.org/web/20260117111255id_/https://example.com"); * // Returns "20260117111255" * ``` */ export declare const parseTimestamp: (archivedUrl: string) => string | null; /** * Format a Wayback timestamp as a readable date string. * * @param timestamp * @example * ```ts * formatTimestamp("20260117111255"); // "2026-01-17 11:12:55" * ``` */ export declare const formatTimestamp: (timestamp: string) => string; /** * Parse a Wayback timestamp into a Date object. * @param timestamp */ export declare const parseTimestampToDate: (timestamp: string) => Date | null; /** * Format the age of a snapshot as a human-readable string. * * @param timestamp * @example * ```ts * formatAge("20260115111255"); // "2 days ago" * formatAge("20251117111255"); // "2 months ago" * ``` */ export declare const formatAge: (timestamp: string) => string; //# sourceMappingURL=wayback.d.ts.map