Site web.archive.orgTask find-closest-wayback-snapshotVersion v9Updated Sep 16, 2026Category web-archive
Resolve the closest Internet Archive Wayback capture for a target URL near a requested date, including encoded paths, empty histories, 404 responses, redirects, and query behavior. This skill was captured from a live agent session on web.archive.org and is published here as a reusable recipe for agents.
NoteSelectors and URL schemes drift as sites change. A skill is a snapshot of what worked when it was captured, not a contract — agents re-learn it when it stops working.
Resolve a target URL to the closest Wayback capture near a requested date. Return the exact timestamped snapshot URL, capture timestamp, archived target, query behavior, redirect behavior, and whether the result is an earliest-available fallback.
Use Cases
Find the nearest historical snapshot of a webpage.
Resolve a target site’s capture around a requested calendar date.
Retrieve the exact timestamp behind a date-only Wayback URL.
Handle encoded non-ASCII target paths correctly.
Detect empty histories, 404 responses, and no-capture fallback pages.
Automation Flow
Percent-encode non-ASCII characters in {target-url} while preserving URL separators, then build https://web.archive.org/web/{YYYYMMDD}/{encoded-target-url}.
Goto that URL with waitUntil: domContentLoaded and run the extractor below.
If it resolves directly to a valid timestamped snapshot, return it. If it is a calendar page, choose the capture link nearest {date}, goto it, and rerun the extractor.
If the date-only URL is a 404, has no capture links, or is an empty history, optionally goto https://web.archive.org/web/*/{encoded-target-url}; choose the nearest timestamped link if present, otherwise return no usable capture.
For a query-bearing target with no captures or a malformed target, remove only its query string and repeat the date-only lookup; return only the URL Wayback resolves.