Archilyzer · Source

archilyzer

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

commit 56390a44c818aa6940b8d477f596684ab5cbbf87
parent cd0a77058439413f2a0d618fc1cad17b907543f9
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Tue, 20 Oct 2026 10:38:30 -0400

wayback pages: yt-about takes the ytInitialData assignment, never a comparison of it

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

Diffstat:
Mcommon/lib/waybackPages/extractors/ytAbout.test.ts | 3+++
Mcommon/lib/waybackPages/extractors/ytAbout.ts | 2+-
2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/common/lib/waybackPages/extractors/ytAbout.test.ts b/common/lib/waybackPages/extractors/ytAbout.test.ts @@ -33,6 +33,9 @@ test("jsonAfter: brace-matched past braces inside strings; an escaped string lit assert.deepEqual(jsonAfter(`ytInitialData = '\\x7b\\x22a\\x22:1\\x7d';`, /ytInitialData\s*=\s*/), { a: 1 }); assert.equal(jsonAfter(`ytInitialData = {"a": nope};`, /ytInitialData\s*=\s*/), null); assert.equal(jsonAfter(`nothing here`, /ytInitialData\s*=\s*/), null); + // A comparison is not the assignment. + const page = `<script>if (window.ytInitialData == null) { var junk = {"x":1}; }</script><script>var ytInitialData = {"metadata":{"channelMetadataRenderer":{"title":"X","description":"Said here."}}};</script>`; + assert.equal(extractYtAbout({ html: page, capture: captureOf("https://www.youtube.com/@X/about", "20240101000000") })[0].text, "X\nSaid here."); }); test("the 2013 About page: description, links, joined, counts, country", () => { diff --git a/common/lib/waybackPages/extractors/ytAbout.ts b/common/lib/waybackPages/extractors/ytAbout.ts @@ -268,7 +268,7 @@ export function extractYtAbout(input: PageExtractInput): PageRecordDraft[] { const url = new URL(base); const fromUrl = youtubeChannelOf(url) ?? undefined; const data = - jsonAfter(html, /(?:var\s+ytInitialData|window\[\s*["']ytInitialData["']\s*\]|ytInitialData)\s*=\s*/) ?? null; + jsonAfter(html, /(?:var\s+ytInitialData|window\[\s*["']ytInitialData["']\s*\]|ytInitialData)\s*=(?!=)\s*/) ?? null; const root = parseHtml(html); const about = (data ? fromInitialData(data, base) : null) ?? fromOldLayout(root, base); const channel = about?.channelId ?? fromUrl ?? url.pathname.replace(/\W+/g, "-");