Archilyzer · Source

archilyzer

Archilyzer
git clone https://archilyzer.pages.dev/source/archilyzer.git
Log | Files | Refs | README | LICENSE

commit 166b950dfd66f02988141e0add2a955419531320
parent fa73181d3c40021cfe3ba2875f85dd8cd71fa072
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Tue, 20 Oct 2026 10:49:44 -0400

wayback pages: a nearest import fetches the capture by the URL the archive recorded (CDX's original)

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

Diffstat:
Mcommon/controller/importPage.ts | 16++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/common/controller/importPage.ts b/common/controller/importPage.ts @@ -207,28 +207,32 @@ export async function importPage(opts: { try { let ts: string; + // The URL as the archive captured it: CDX's `original` for a nearest + // lookup (it may differ from the one typed: http/https, a trailing slash). + let original = ask.originalUrl; if (ask.kind === "nearest") { log(`Looking up the capture of ${ask.originalUrl} nearest ${ask.at} (CDX).`); const near = await client.closestCapture(ask.originalUrl, ask.at, { signal: opts.signal }); if (!near) return { ...base, error: `the Wayback Machine holds no capture of ${ask.originalUrl} that recorded a page (HTTP 200)` }; ts = near.timestamp; + original = near.original; log(`Nearest capture: ${near.timestamp} (${near.original}).`); } else { ts = ask.captureTs; } - if (/^\d{14}$/.test(ts) && (await hasStoredCapture(channelRoot, ts, ask.originalUrl))) { - log(`The capture ${ts} of ${ask.originalUrl} is already in ${opts.slug}; nothing fetched.`); + if (/^\d{14}$/.test(ts) && (await hasStoredCapture(channelRoot, ts, original))) { + log(`The capture ${ts} of ${original} is already in ${opts.slug}; nothing fetched.`); return { ...base, ok: true, already: true, captureTs: ts, - originalUrl: ask.originalUrl, - waybackUrl: waybackPageUrl({ captureTs: ts, originalUrl: ask.originalUrl }), + originalUrl: original, + waybackUrl: waybackPageUrl({ captureTs: ts, originalUrl: original }), }; } - log(`Fetching ${waybackRawUrl({ captureTs: ts, originalUrl: ask.originalUrl })}`); - const cap = await client.getCapture(ts, ask.originalUrl, { raw: true, signal: opts.signal }); + log(`Fetching ${waybackRawUrl({ captureTs: ts, originalUrl: original })}`); + const cap = await client.getCapture(ts, original, { raw: true, signal: opts.signal }); if (cap.finalTs !== ts || cap.originalUrl !== ask.originalUrl) { log(`The archive answered with the capture ${cap.finalTs} of ${cap.originalUrl}.`); const video = videoPageOf(cap.originalUrl);