Programmatic examples for accessing, parsing, and reconstructing early web archives. All endpoints return WARC-compliant payloads.
Retrieve timestamped page captures using the Archive Gateway. Supports range queries and format negotiation.
const { ArchiveClient } = require('@1990-archive/sdk');
const client = new ArchiveClient({ apiKey: process.env.ARC_KEY });
// Fetch all captures for a specific URL between 1996-1999
async function getSnapshots() {
const res = await client.capture.query({
url: 'http://www.geocities.com/~retro_user',
start: '1996-01-01',
end: '1999-12-31',
format: 'warc/raw'
});
console.log(`Found ${res.total} snapshots`);
return res.payloads.slice(0, 3);
}
getSnapshots().then(snapshots => {
snapshots.forEach(s => console.log(s.timestamp, s.size));
});
Legacy pages heavily relied on <frameset> and nested tables. Use the structural resolver to flatten layouts into modern DOM trees.
legacy_flatten flag automatically rewrites FRAME boundaries into <div> containers while preserving original inline styles.
from archive_parser import LegacyHTMLResolver
from bs4 import BeautifulSoup
def flatten_frameset(raw_html: str) -> str:
resolver = LegacyHTMLResolver(mode="strict_1998")
tree = resolver.parse(raw_html, flatten_frames=True)
# Extract main content frame
main_frame = tree.select_one("#main_content_frame")
if not main_frame:
raise ValueError("Missing primary frameset target")
# Convert deprecated attributes to CSS
main_frame.align = main_frame.get("align")
main_frame.style = f"text-align: {main_frame.align}"
return str(main_frame)
# Usage
# processed = flatten_frameset(warc_record.content)
Early web assets often contained embedded control blocks. The asset extractor isolates animation frames and sequence data.
import { AssetExtractor } from '@1990-archive/decoder';
async function decodeAnimatedGIF(buffer) {
const extractor = new AssetExtractor('gif89a');
const metadata = await extractor.analyze(buffer);
if (metadata.isAnimated) {
console.log(`Frame count: ${metadata.frameCount}`);
console.log(`Loop count: ${metadata.loopCount}`);
// Extract first frame as PNG for archival
const firstFrame = await extractor.decodeFrame(0, { format: 'png' });
return firstFrame.buffer;
}
return null;
}
// MIDI sequence parser example
// const tracks = await AssetExtractor.parseMIDI(midiBuffer);
Use the official CLI tool to download WARC bundles, convert them to static HTML, and verify cryptographic signatures.
# Initialize project and download seed list
1990-archive init my-project
1990-archive crawl --url-list seeds_1997.txt --output ./captures
# Convert WARC bundles to renderable static HTML
1990-archive convert ./captures/*.warc --format html5 --flatten-frames
# Verify archive integrity using SHA-256 manifests
1990-archive verify ./captures --manifest manifests.json
# Generate diff report against Wayback baseline
1990-archive diff ./captures --baseline wayback:1998 --output report.md