commit 69446cf8a9cb1e959ccd4b5354c153dfbbe583ec
parent 875dd221b9f69df4987638b824117564e5bbfc83
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Tue, 20 Oct 2026 10:38:39 -0400
plans: release 37 lane C — the site extractors, as shipped
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Diffstat:
1 file changed, 114 insertions(+), 0 deletions(-)
diff --git a/plans/release-37/extractors.md b/plans/release-37/extractors.md
@@ -0,0 +1,114 @@
+# Release 37 lane C — `r37/extractors`: the site extractors (S3, as shipped)
+
+The plan of record (`plans/release-37/wayback-pages.md`, "What a record is" and "S3") makes a non-video Wayback
+capture a `Post` on platform `"webpage"`. This lane is S3: the site extractors, pure modules against the contract on
+main (`common/lib/waybackPages/types.ts`), registered in `SITE_EXTRACTORS`. Lane A's generic extractor, dispatcher and
+importer are not needed here; every module is tested directly. Rulings followed: no model anywhere (deterministic
+code); no network, disk, clock or randomness in an extractor; synthetic fixtures only (no real capture, no corpus
+content); the forum parser reused, not forked; no new dependency.
+
+**S3 status: done** — Tumblr, X/Twitter, XenForo, Google Docs and YouTube About, each `version: 1`.
+
+## What
+
+1. **`SITE_EXTRACTORS`** = `[gdoc, yt-about, x, xenforo, tumblr]`: the three host-matched first, XenForo by its
+ markup on any host, Tumblr last (its own host, or a custom domain whose markup is a Tumblr theme).
+2. **Tumblr** (`tumblr`): `*.tumblr.com` blogs (not www/assets/static/media hosts), and custom domains carrying
+ Tumblr's own markers (the controls iframe, its asset hosts, `tumblr-theme` meta, `com.tumblr` app links,
+ `tumblr-feed:`) with `/post/<id>` permalinks. Posts are found by permalink on the capture's own host, or the
+ theme's `article.post` / `id="post-<id>"` / `data-post-id`; a post's container is the largest element around its
+ permalink holding no other post's. A post page → its own post only; an index / archive / tagged / page-N page →
+ one `tumblr-post` draft per post, `itemId: "tumblr-<id>"` (the index's draft of a post equals its permalink's).
+ Date: `<time datetime>`, the permalink's title or text, a date-classed element, then (post page) meta. Tags from
+ `/tagged/` links; the reblog source (a foreign post link marked reblog/via/source) → `repostOf` on `"webpage"`,
+ `isRepost`; images as `media` with their original src; author = the blog name. No post → one `tumblr-index`
+ whole-page draft (`noContent` when empty).
+3. **X / Twitter** (`x`): twitter.com, mobile.twitter.com, x.com. The 2012–2022 desktop layouts (`div.tweet`) and the
+ legacy mobile one (`table.tweet`) → one `tweet` draft per tweet (`itemId: "tweet-<statusId>"`, url
+ `https://twitter.com/<handle>/status/<id>`), author/authorName, the content's time (data-time, the printed
+ line, else the id's snowflake), text with emoji alts, expanded links, mentions and hashtags as text, the
+ pic.twitter.com tail dropped; `media` from the photo containers; reply (`replyTo` — the chain on a status page,
+ the conversation root on a timeline), retweet (the retweet's own status by the retweeter, `repostOf` the
+ original), quote (`quoted`). A pinned repeat is one draft. The profile header (2014+ ProfileHeaderCard, 2012
+ profile-card, mobile profile-details) → one `x-profile` draft, `x-profile-<handle>-<captureTs>`. The JS app's
+ shell → one whole-page draft, `noContent`, kind by URL (profile/status); a notice page ("Account suspended") →
+ the same, quoting the notice.
+4. **XenForo** (`xenforo`): `data-template="thread_view"`, `<html id="XF">`, `.message--post`. The page goes through
+ `parseXenforoThreadPage` with the capture's original URL; each post → a `forum-post` draft with the parser's id
+ (the BARE post id — what `xenforoFetcher` stores), url, text, links, media, refs and `forum`, so a capture's posts
+ are byte-equal to a live channel's posts of the same page. A wall (login, check, captcha, not found) → one
+ `generic` noContent draft saying which.
+5. **Google Docs** (`gdoc`): `docs.google.com/document/…`. `mobilebasic` / `pub` (`?embedded=true`) / `preview` → one
+ `gdoc` whole-page draft: the title, the body (`#contents` / `.doc-content`) with headings and list items as lines,
+ Google's banner/header/footer dropped, links unwrapped from `/url?q=`. The `/edit` shell → `noContent`, the text
+ and links naming `https://docs.google.com/document/d/<id>/mobilebasic` (none for a `/d/e/` published id).
+6. **YouTube About** (`yt-about`): `/user/<x>`, `/c/<x>`, `/channel/<UC…>`, `/@handle` (bare, `/about`, `/featured`)
+ and `/<custom>/about`. The 2012–2016 layout (`.about-description`, `.about-stat`, `.about-channel-link`,
+ `country-inline`) and the 2017+ app (`ytInitialData` located, brace-matched, parsed — or unescaped first when
+ assigned as a JS string; renderers found by key: the About tab's full metadata, the 2023+ view model, the header,
+ the channel metadata) → one `yt-about` draft per capture, `yt-about-<UC id | URL name>-<captureTs>`: title,
+ description, links (unwrapped from /redirect), joined, subscribers, views, country, as text lines.
+7. **Shared** (`util.ts`): the tree helpers, `unwrapWaybackHtml` (toolbar + replay URLs), `unwrapRedirect`,
+ `absoluteUrl`, `statedUrl`, `renderBlock` (`forumBodyToText` over a pruned, absolutized copy), `parseEnglishDate`
+ (UTC), `isoFromIso`, `isoFromEpochSeconds`.
+
+## Interfaces exported
+
+`SITE_EXTRACTORS` (index.ts); per module the extractor (`tumblrExtractor`, `xExtractor`, `xenforoExtractor`,
+`gdocExtractor`, `ytAboutExtractor`) and its `extract*` function; helpers tests use: `isTumblrBlogHost`,
+`tumblrBlogName`, `parseXUrl`, `statusUrl`, `snowflakeIso`, `isXHost`, `googleDocId`, `mobilebasicUrl`,
+`isGoogleDocsUrl`, `youtubeChannelOf`, `jsonAfter`. No change to `types.ts`.
+
+## Files
+
+`common/lib/waybackPages/extractors/`: `index.ts` (imports + entries only), `util.ts`, `tumblr.ts`, `x.ts`,
+`xenforo.ts`, `gdoc.ts`, `ytAbout.ts` (new); tests `index.test.ts`, `tumblr.test.ts`, `x.test.ts`,
+`xenforo.test.ts`, `gdoc.test.ts`, `ytAbout.test.ts` (new, 34); `__fixtures__/` (new, synthetic): `capture.ts`,
+`xenforoCaptures.ts` (the forum parser's synthetic thread page, live and as Wayback's replay serves it), and 19 HTML
+pages — Tumblr ×5 (2012 classic post + index, 2014 article.post on a custom domain through the replay, a minimal
+theme's tagged page, an about page), X ×6 (2012 and 2015 profiles, 2016 status page, mobile profile, 2022 shell,
+suspended notice), Google Docs ×3 (mobilebasic, pub, edit shell), YouTube ×4 (2013 About, 2019 Polymer About, 2021
+channel page, 2024 @handle About with an escaped-string ytInitialData). `plans/FACTS.md` ("Release 37 lane C"),
+`editor/CHANGELOG.md`.
+
+## Commits
+
+| sha | what |
+|---|---|
+| `1a3a1026` | wayback pages: the five site extractors, util.ts, the registry, 19 synthetic fixtures; 34 tests |
+| `79e8a16c` | yt-about: the ytInitialData assignment, never a comparison of it (test) |
+| `356de67c` | FACTS ("Release 37 lane C"), CHANGELOG |
+| (this) | plans: this record |
+
+## Gates (through the session lock, from the worktree root)
+
+- `pnpm -r --no-bail --workspace-concurrency=1 exec tsc --noEmit` — clean (before `1a3a1026`, and again on the final
+ code before `79e8a16c`).
+- `pnpm --filter yt-dlp-transcript-common test` — **4729 tests, 4727 pass, 0 fail, 2 skipped** (branch start
+ 7778d441: 4695 / 4693 / 0 / 2; +34 here — tumblr 6, x 9, xenforo 3, gdoc 5, yt-about 8, registry 3).
+ `testing/fakes.test.ts` green inside it.
+- No CLI row, env key, file schema or setting changed: no docs check applies. No app, build or e2e spec touched.
+
+## Decisions
+
+- **No `itemId` on a shell or a version.** A noContent shell (X app, Docs editor) and a Google Doc are whole-page
+ records (`<captureTs>-<hash>`): an upsert is latest-wins, so a shell with a tweet's id would overwrite the record
+ a good capture made, and a doc is a new version at each capture. A YouTube About page keeps the brief's
+ `yt-about-<channel>-<captureTs>` (one per capture by construction).
+- **Tweet urls are twitter.com** (the brief's), while X channels write x.com; the refs carry `platform: "twitter"`
+ and the status id, which is what joins them.
+- **The forum item id is the bare post id**, as the live fetcher stores it (not "kf-<id>").
+- **A Tumblr reblog's ref is `"webpage"` / `tumblr-<id>`**, cast in tumblr.ts until lane A registers `"webpage"`.
+- **A mobile-layout retweet** carries no retweet id, so the tweet shown is recorded as the original's own.
+- **Every extractor returns ≥ 1 draft**, so the dispatcher never has to treat an empty list.
+- **A printed date is UTC** (pages name no zone); the snowflake is exact.
+
+## Found and left
+
+- Tumblr's 2022+ blog view (the React app on `www.tumblr.com/<blog>`) is not matched (its captures hold a shell);
+ such a page falls to the generic extractor.
+- XenForo 1 (`#messageList li.message`) is not read: the shared parser is XenForo 2.
+- A Tumblr theme that prints dates in a format `parseEnglishDate` does not know leaves `publishedAt` absent (the
+ record's time is then the capture's).
+- A Google Docs `/edit` capture whose `DOCS_modelChunk` script holds the text is still recorded as noContent; reading
+ the editor's model is a later version.