An ordinary page with words enough to read.
// Release 37: the dispatcher over the REGISTERED site extractors (lane C's) // with their synthetic fixtures — each capture reaches its own extractor, an // unknown page reaches the generic one — and their drafts as page records // (an item's own id; a shell or a document one record per capture). // // Run with: pnpm --filter yt-dlp-transcript-common exec tsx --test lib/waybackPages/extract.test.ts import test from "node:test"; import assert from "node:assert/strict"; import { chooseExtractor, extractPage } from "./extract"; import { SITE_EXTRACTORS } from "./extractors/index"; import { captureOf, fixture } from "./extractors/__fixtures__/capture"; import { draftToPost, isWholePageRecord } from "./toPost"; import { pageRecordId } from "./types"; const input = (file: string, url: string, ts: string) => ({ html: fixture(file), capture: captureOf(url, ts) }); test("a registered site's capture reaches its extractor; an unknown page reaches generic", () => { const cases: [string, string, string, string][] = [ ["tumblr-2012-classic-post.html", "http://teapot-notes.tumblr.com/post/20000000001/on-spouts", "20120601000000", "tumblr"], ["x-2016-status.html", "https://twitter.com/TeapotFan/status/697374449464250369", "20160211000000", "x"], ["yt-about-2013.html", "http://www.youtube.com/user/teapotchannel/about", "20131001000000", "yt-about"], ]; for (const [file, url, ts, want] of cases) { const i = input(file, url, ts); assert.equal(chooseExtractor(i).name, want, file); const res = extractPage(i); assert.equal(res.extractor.name, want, file); assert.equal(res.fallback, undefined, file); assert.ok(res.drafts.length > 0, file); } const unknown = { html: "
An ordinary page with words enough to read.