Archilyzer · Source

archilyzer

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

commit cee3a6ae41aad64b16296e410ac90953d424b67c
parent 05118299509c98ee202ebd05bcaacb1eb1e04415
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Thu, 15 Oct 2026 07:36:10 -0400

editor, export, scripts: find-copy, wayback-lookup and archive-search by YouTube id over ops (release 29 E2) — `pnpm ops find-copy {article | articles | siteId, dryRun?}` runs the lookups and starts ONE fetch-windows job on the archive.org clip queue for every copy found; `wayback-lookup {url | slug, id}`; `archive-search {youtubeId}` answers each mirror's direct file URL; fetch-windows refuses a gone recording's window at its door unless the item names a copy's URL, and a replay keeps the copy; Bluesky in capture-posts' help; OPERATING.md; COMMANDS.md regenerated; the report-site fixture cites a stream deleted since (g01) and its spec checks "Source deleted" on the card and the moment page

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

Diffstat:
MCOMMANDS.md | 6++++--
MOPERATING.md | 13+++++++++++--
Meditor/app/api/ops/_research.test.ts | 48++++++++++++++++++++++++++++++++++++++++++++++++
Meditor/app/api/ops/archive-search/route.ts | 33+++++++++++++++++++++++++++++++--
Aeditor/app/api/ops/find-copy/route.ts | 40++++++++++++++++++++++++++++++++++++++++
Aeditor/app/api/ops/wayback-lookup/route.ts | 50++++++++++++++++++++++++++++++++++++++++++++++++++
Meditor/app/channels/[slug]/videos/fetchWindowsAction.test.ts | 26++++++++++++++++++++++++++
Meditor/app/channels/[slug]/videos/fetchWindowsAction.ts | 18++++++++++++++++++
Aeditor/app/channels/[slug]/videos/findCopyAction.ts | 71+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Meditor/app/jobs/jobReplayRegistry.ts | 3+++
Mexport/app/lib/reports.test.ts | 3++-
Mexport/e2e-report/report-site.spec.ts | 27++++++++++++++++++++++-----
Mexport/fixtures/report-site/fixture.ts | 28+++++++++++++++++++++++++---
Aexport/fixtures/report-site/public/m/demo-channel/gone99/1200.00-1210.00/moment.json | 57+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mexport/fixtures/report-site/public/m/index.json | 3++-
Mexport/fixtures/report-site/public/pages/demo-factcheck/page.json | 25+++++++++++++++++++++++--
Mexport/fixtures/report-site/public/pages/index.json | 2+-
Mexport/fixtures/report-site/source/demo-factcheck/report.json | 12++++++++++--
Mscripts/archilyzer-ops.mjs | 49+++++++++++++++++++++++++++++++++++++++++++++----
19 files changed, 489 insertions(+), 25 deletions(-)

diff --git a/COMMANDS.md b/COMMANDS.md @@ -113,7 +113,7 @@ Drives a running editor over HTTP (`/api/ops/*`, the same actions its pages run) | `retry-bucket` | retry-bucket runs one bucket of a channel's report as one job, past any lane hold: {"slug", "bucket"}. "ids": \[...\] runs only those videos, and every one must be in the bucket (a stray id is refused, named); a job run with ids is not replayable, as a checkbox selection in the UI is not. | | | `transcribe-bucket` | transcribe-bucket transcribes a channel's "downloaded, not transcribed" bucket on the transcription queue, as the channel page's Transcribe button does: {"slug"}. "ids": \[...\] narrows it the same way as on retry-bucket. | | | `fetch-posts` | fetch-posts fetches a social channel's new posts: {"slug"}. "full": true re-walks the whole timeline; "older": true walks back from the oldest archived post through search (X; needs a login), saving its place for the next run, down to "floor": "YYYY-MM-DD" when given; "from": "YYYY-MM-DD" starts the walk afresh there, replacing its saved place (and a "complete") — for a gap above one surviving old post. "limit": N caps the posts one run reads; "pages": N caps the pages (a forum thread: its latest N pages). "full" and "older" together are refused. An older walk over an account that shows no posts (nothing archived, and the last timeline fetch read none) is refused unless "force": true. A drained fetch stops at its next resume point and the next run resumes. | | -| `capture-posts` | capture-posts captures archived posts of a social channel (X, forum): a screenshot of each through the connected X profile (a forum thread: its host's forum profile), and its attached media through gallery-dl (a forum thread: the same profile), into the channel's posts-media/&lt;id&gt;/: {"slug", "ids": \[...\]}. Every id must be in the channel's posts archive. "shots": false or "media": false skips that half; posts already captured are skipped unless "force": true. A post that links to an X Article also gets the article (article.json, .md, .png and its images) unless "articles": false; both halves off with "articles": true reads only the articles. Paced like a post fetch, on its queue. | | +| `capture-posts` | capture-posts captures archived posts of a social channel (X, forum, Bluesky): a screenshot of each through the connected X profile (a forum thread: its host's forum profile; Bluesky: a headless browser with no login on bsky.app, the shot cropped to the post), and its attached media through gallery-dl (a forum thread: the same profile; Bluesky: its images from the CDN), into the channel's posts-media/&lt;id&gt;/: {"slug", "ids": \[...\]}. Every id must be in the channel's posts archive. "shots": false or "media": false skips that half; posts already captured are skipped unless "force": true. A post that links to an X Article also gets the article (article.json, .md, .png and its images) unless "articles": false; both halves off with "articles": true reads only the articles. Paced like a post fetch, on its queue. | | | `publish` | publish runs publish stages on the editor's publish queue, one at a time, under one run id: {"verb": …}. "index" updates the index; "build" builds "siteId"/"siteIds" (forced; the index first when stale; "runner": "docker" builds every site in containers; "allowMissingMedia": true lets a report citation with no prepared media through compose, local builds only); "deploy" ships their built bundles (production, "preview": "&lt;branch&gt;", or "to": "local"; "force" redeploys a bundle already shipped there); "hub" / "homepage" build them, {"deploy": true} deploys after; "now" is Publish now (the stale index, then each policy target); "stale" builds every stale site. The answer lists every job ({target, kind, jobId}) and --wait follows them all. A site never built is refused: "no build of &lt;id&gt; in &lt;dir&gt; — archilyzer publish build &lt;id&gt;". `get publish` is the status. | | | `build-index`, `build-site`, `build-deploy`, `deploy-site`, `build-hub`, `deploy-hub`, `build-homepage`, `deploy-homepage` | build-index, build-site, build-deploy, deploy-site, build-hub, deploy-hub, build-homepage and deploy-homepage are publish's aliases, with their old bodies and answers ("skipData" is accepted and ignored). | `pnpm ops build-deploy --json '{"siteIds":["anilyzer","jeralyzer"]}' --wait`<br>`pnpm ops build-site --json '{"siteId":"anilyzer"}' --wait`<br>`pnpm ops deploy-site --json '{"siteId":"anilyzer","preview":"tags-exclude"}' --wait`<br>`pnpm ops build-hub --wait`<br>`pnpm ops build-hub --json '{"deploy":true}' --wait`<br>`pnpm ops deploy-hub --wait`<br>`pnpm ops build-homepage --json '{"deploy":true}' --wait`<br>`pnpm ops deploy-homepage --json '{"preview":"refresh"}' --wait` | | `build-site`, `build-deploy`, `deploy-site` | build-site, build-deploy and deploy-site all take "siteId" (one) or "siteIds" (a list). | | @@ -142,9 +142,11 @@ Drives a running editor over HTTP (`/api/ops/*`, the same actions its pages run) | `cleanup` | cleanup runs one of a channel's cleanup sweeps as a job: {"slug", "sweep": "transcribed" (audio of transcribed videos — the /cleanup total) \| "extra-formats" \| "wrong-format" \| "failed-transcriptions" (clears the list; deletes nothing)}. Do-not-clean videos are skipped; `get cleanup <slug>` says what each would reclaim. | `pnpm ops cleanup --json '{"slug":"x","sweep":"transcribed"}' --wait` | | `web-search` | web-search searches the web (DuckDuckGo's HTML page) and answers the results: {"query", "n"?: 6 (at most 20)} -&gt; {results: \[{title, url, snippet}\]}. Read only, through the editor's one web queue: one request at a time, 3 s apart, backing off on a 429 or 503. For context; a web page is never cited as what someone said. | `pnpm ops web-search --json '{"query":"second shop opening","n":5}'` | | `web-fetch` | web-fetch reads one web page as plain text: {"url", "maxChars"?: 12000 (at most 60000)} -&gt; {page: {url, finalUrl, status, contentType, title?, text, truncated}}. http and https only; a private or loopback host (by name, by address, or by what its name resolves to, every redirect checked) is refused before any request, and so is a page that is not text (a PDF, an image). Read only, on the same web queue as web-search. | `pnpm ops web-fetch --json '{"url":"https://example.com/news/item","maxChars":4000}'` | -| `archive-search` | archive-search searches archive.org (its advanced-search syntax) and answers the items: {"query", "limit"?: 50 (at most 500)} -&gt; {found, items: \[{identifier, title?}\]}, in identifier order. One request through the editor's archive.org client, paced and backed off as an import is. Read only; import-archive-org with "query" imports what a search finds. | `pnpm ops archive-search --json '{"query":"title:(kitchen) AND mediatype:movies","limit":20}'` | +| `archive-search` | archive-search searches archive.org (its advanced-search syntax) and answers the items: {"query", "limit"?: 50 (at most 500)} -&gt; {found, items: \[{identifier, title?}\]}, in identifier order. One request through the editor's archive.org client, paced and backed off as an import is. Read only; import-archive-org with "query" imports what a search finds. {"youtubeId", "limit"?: 10} looks for mirrors of one YouTube upload instead: items naming the id in their identifier, title, description or original URL, each read for its files -&gt; {query, found, items: \[{identifier, title?, file, url, source, size?}\], skipped: \[{identifier, why}\]}: each mirror's direct video file URL, an original preferred. | `pnpm ops archive-search --json '{"query":"title:(kitchen) AND mediatype:movies","limit":20}'`<br>`pnpm ops archive-search --json '{"youtubeId":"dQw4w9WgXcQ"}'` | | `archive-item` | archive-item answers one archive.org item's files from its metadata: {"item"} -&gt; {item: {identifier, url, title?, date?, mediatype?, creator?, collections, restricted, mediaFiles, mediaBytes, files: \[{name, format?, source?, size?, seconds?, media, restricted, original?}\]}}. media marks the originals an import takes (one record each); restricted, what archive.org will not hand out. Read only; nothing is downloaded. | `pnpm ops archive-item --json '{"item":"example-item"}'` | | `import-post` | import-post imports ONE post by its URL into a posts channel of its platform: {"slug", "url"} — an X status (x.com/&lt;handle&gt;/status/&lt;id&gt;) or a Bluesky post (bsky.app/profile/&lt;handle&gt;/post/&lt;id&gt;, or its at:// URI). Read through the channel's own fetcher (gallery-dl for X, with the channel's login; the public AppView for Bluesky) as an import-post job on the platform's queue. Refused, before any job: a URL that is not a post, a channel that is not a posts channel of that platform or whose fetcher cannot read one post, a post the URL names as another account's, the platform held or cooling down. A post already archived is not read again; one the platform says is another account's is not written. The log ends with @@import-post {ok, slug, url, id, written, already?, post?, error?}. | `pnpm ops import-post --json '{"slug":"demo-x","url":"https://x.com/example/status/1700000000000000001"}' --wait` | +| `wayback-lookup` | wayback-lookup answers the Wayback Machine's captures of a page (its CDX API): {"url"} or a record's {"slug", "id"} (its metadata's page, else its availability check's, else the playlist's), "okOnly"?: only the captures that recorded a 200, "limit"?: 100 (at most 500) -&gt; {url, found, captures: \[{timestamp, status, mimetype?, replayUrl}\]}, oldest first. One request through the editor's Wayback client, with archive.org's manners (one at a time, 2 s apart, 429s waited out). Read only. | `pnpm ops wayback-lookup --json '{"slug":"demo-channel","id":"dQw4w9WgXcQ","okOnly":true}'` | +| `find-copy` | find-copy looks for a copy of every gone recording (deleted or private) a report cites, and fetches the cited windows from it: {"article"} \| {"articles": true} \| {"siteId"}, "dryRun"?. Per recording, one at a time: the Wayback Machine (the newest capture of its page that recorded a 200), then archive.org (a mirror naming its YouTube id, an original video file preferred). Every copy's windows go to ONE fetch-windows job on the archive.org clip queue, the copy's URL as each window's page, so the clips land in the recording's own clips/ with the copy (wayback or archive.org, and its URL) in each window's provenance. A recording with no copy is left: its moments show their words only, marked "Source deleted". -&gt; {recordings: \[{slug, id, gone, watchUrl, youtubeId, windows, tried: \[{from, found, url?, detail?, error?}\], copy?, outcome: fetch \| text-only \| error}\], items, stopped?, jobId?, refused?}. dryRun answers the lookups and starts nothing. | `pnpm ops find-copy --json '{"article":"demo-article","dryRun":true}'`<br>`pnpm ops find-copy --json '{"article":"demo-article"}' --wait` | | `report-draft` | report-draft runs a generation over an article's iteration as a report-draft job: {"task": "sweep" \| "revise-report" \| "revise-video" \| "research" \| a media draft, "article", ...} -&gt; {jobId, iteration, warnings?}. A sweep takes "question" and "channels" (and "from"/"to"): a new iteration; a revision takes "iteration" (the one it revises) and "feedback": a new iteration. A media draft — "narrate", "cut", "onscreen", "teaser", "flips", "threads", "youtube" — takes "iteration" (a done one; "entries"? entry ids, "force"? re-drafts a field that is a draft already; narrate "cards"?) and is a step on it: it drafts fields of the iteration's video manifest, never one the operator wrote. "copyOf" N runs iteration N again on "model". "extractorModel" is an API sweep's extractor (a Claude model id; default settings.generation.models.extractor). "model" defaults to settings.generation's route for the task (one routed to code needs a model named). A Claude model runs on draft:api, capped at "maxUsd" (default by task, never above caps.max), and is refused when the day's API total has reached caps.daily; a local model runs on draft:local, through the GPU arbiter, and is unloaded when it ends. The corpus is "source" (a handle), "build" (a composed build), or the newest build holding the channels. `job cancel <id>` stops it. The log ends with @@report-draft {article, iteration, task, status, summary, usd, minutes}; --wait prints it. A research run takes "question" ("channels"? "from"/"to"?) and "autonomy" (propose \| limits \| auto; default settings.generation.research): it searches the corpus, the web and archive.org and proposes acquisitions (archive.org imports, videos, new channels — always on no site —, posts, transcription, persisting), each with its reason and evidence, enqueuing what its autonomy and the settings' caps allow through the editor's own actions; the rest waits in the iteration's proposals.json. A sweep with "iteration" N CONTINUES research run N: its question, over its channels and every channel a done acquisition wrote into, the sweep's parent N; refused while N still waits, unless "force" (what is done so far). "seed" (a new sweep's, on a Claude model) is cited markdown in the /sweep shape — umtool's research board: kept as the iteration's seed.md, the report starts from it, and the sweep verifies and extends it. "ids" (a sweep's) restricts it to those recordings: an enumeration reads only their pages and answers only their rows, a read of another is refused. A "refresh" re-fetches an iteration's scope and folds in what changed: "iteration" (default: the current report's) — its question, its recorded enumerations and every channel its citations touch. One job on draft:refresh: the editor's own sync / refresh-report / transcribe-bucket (what landed) per video channel and fetch-posts per posts channel (a platform held or cooling down is skipped; transcribe-bucket is skipped, and said, while transcription is paused or no worker is enabled), then a local build of the site holding them (never a deploy); the enumerations again (new and changed recordings) and every cited quote read again (changed words, en vs en-orig, a source gone); nothing changed ends no-change, $0 — or partial, naming what a capped search did not reach. Else, within the caps ("model", "maxUsd", "extractorModel"; past one it ends held-by-cap with the delta and the estimate), a sweep restricted to the new recordings and a revision of the report: a new refresh iteration, refresh.json beside it. "fetch": false skips the fetch and the build; "dryRun": true answers {plan} and writes nothing. Its log ends with @@report-draft {…, refresh: {status, newIds, changed, drifted, deleted, summary}}. | `pnpm ops report-draft --json '{"task":"sweep","article":"demo-article","question":"What does she say about the shop?","channels":["demo-channel"]}' --wait`<br>`pnpm ops report-draft --json '{"task":"revise-report","article":"demo-article","iteration":1,"feedback":"Drop the second finding."}'`<br>`pnpm ops report-draft --json '{"task":"research","article":"demo-article","question":"Where did the shop story start?","autonomy":"propose"}' --wait`<br>`pnpm ops report-draft --json '{"task":"sweep","article":"demo-article","iteration":1}'`<br>`pnpm ops report-draft --json '{"task":"refresh","article":"demo-article"}' --wait`<br>`pnpm ops report-draft --json '{"task":"refresh","article":"demo-article","dryRun":true}'`<br>`pnpm ops report-draft --json '{"task":"triage","article":"co-host-watch","question":"Who co-hosts?","channels":["demo-channel"],"terms":"co-host"}' --wait` | | `research-approve` | research-approve settles a research run's acquisitions: {"article", "iteration", "ids"?: \["p01", …\], "approve"?: true \| false, "note"?} -&gt; {outcomes: \[{id, status?, jobId?, note?, error?}\], research: {phase, autonomy, limits, spent, proposals, waitingOn: {approval, jobs}, continuedBy, autoContinue?}}. It first refreshes every enqueued acquisition from its jobs (all done: done; one failed: failed, naming it). approve: true runs each proposal through the editor's own action (past the run's autonomy and caps, never past a standing rule); false rejects it, note saying why. No ids: the run's state now. The phase is wait (approvals or jobs pending), ready (nothing pending: continue with report-draft {"task": "sweep", "iteration": N}) or continued. An `auto` run is continued by the editor itself once ready; autoContinue says how (continued by, held for a build, refused by a cap, and why). Refused while the run's job is going. | `pnpm ops research-approve --json '{"article":"demo-article","iteration":1,"ids":["p01","p03"],"approve":true}'` | | `bench-verdicts` | bench-verdicts runs the verdict bench as a bench-verdicts job: {"models": \["…"\], "run"?, "reports"?: \["&lt;article&gt;"\], "window"? (seconds, default 60), "maxUsd"? (default 5), "limit"?} -&gt; {jobId, run}. Every claim of the registry's fact-checks (or of "reports") with the operator's verdict and a citation with cues is asked of each model, one claim per call (the claim, its quotes, the transcript within the window; never the findings or the verdict), and scored against the rulings. On draft:local when any model is local (through the GPU arbiter; unloaded at the end), else draft:api; the run stops at maxUsd, and an API run is refused past caps.daily. A "run" that exists continues (answered pairs are skipped). Results stay local, in .generation/bench/verdicts/&lt;run&gt;/ (umtool's /bench). The log ends with @@bench-verdicts {run, status, items, skipped, spentUsd, stopped?}. | `pnpm ops bench-verdicts --json '{"models":["claude-sonnet-5-5","qwen3:8b"],"maxUsd":5}' --wait` | diff --git a/OPERATING.md b/OPERATING.md @@ -134,6 +134,8 @@ pnpm ops tag-videos --file ids.json pnpm archilyzer reports convert sweep <sweep.md> --out <report.json> pnpm ops fetch-windows --json '{"siteId":"example-site","dryRun":true}' pnpm ops fetch-windows --json '{"siteId":"example-site"}' --wait +pnpm ops find-copy --json '{"siteId":"example-site","dryRun":true}' +pnpm ops find-copy --json '{"siteId":"example-site"}' --wait pnpm ops reports-prepare --json '{"siteId":"example-site"}' --wait pnpm ops reports-export --json '{"siteId":"example-site","formats":["html","md"]}' --wait ``` @@ -143,8 +145,15 @@ pnpm ops reports-export --json '{"siteId":"example-site","formats":["html","md" report-to-video manifest. - `fetch-windows` with `siteId` fetches every clip window the site's published reports cite that the disk does not hold, one paced job per platform; a re-run resumes. -- `reports-prepare` cuts the cited clips and copies the cited post captures, then exports; it fails naming each - citation that lacks media. Offline: `pnpm archilyzer reports prepare <siteId>`, +- A cited recording deleted or made private on its platform cannot be fetched from its page. `find-copy` (a site's + `siteId`, an `article`, or `"articles": true`) looks for a copy of each — a Wayback Machine capture of its page, + then an archive.org mirror naming its YouTube id — and fetches the cited windows from it as one fetch-windows job; + each window's provenance names the copy. `wayback-lookup` and `archive-search` `{"youtubeId"}` are the lookups on + their own. +- `reports-prepare` cuts the cited clips and copies the cited post captures (Bluesky posts too: `capture-posts`), + then exports; it fails naming each citation that lacks media — except a moment whose source is gone (a deleted or + private recording with no copy on disk, a deleted post never captured), which is a warning: the page shows its + words only, marked "Source deleted". Offline: `pnpm archilyzer reports prepare <siteId>`, `pnpm archilyzer reports export <siteId>`. - One cited moment's media, from an agent: the MCP's `fetch_clip`. diff --git a/editor/app/api/ops/_research.test.ts b/editor/app/api/ops/_research.test.ts @@ -50,3 +50,51 @@ test("import-post: refused before any job — not a post URL, not a posts channe assert.equal(noUrl.status, 400); assert.deepEqual(await corpus.listJobIds(), before, "nothing was queued"); }); + +// Release 29 E2: archive-search's YouTube-id mode, wayback-lookup and find-copy +// — refused at the door before anything reaches archive.org. +test("archive-search: youtubeId or query, not both; an id is an id", async () => { + const search = await route("archive-search"); + const both = await callPost(search, { query: "x", youtubeId: "dQw4w9WgXcQ" }); + assert.equal(both.status, 400); + assert.match(String(both.body.error), /either "query" or "youtubeId"/); + const bad = await callPost(search, { youtubeId: "not an id" }); + assert.equal(bad.status, 400); + assert.match(String(bad.body.error), /is not a YouTube id/); +}); + +test("wayback-lookup: a URL or a record, not both; an http(s) URL; a record with no known page is a 404", async () => { + const lookup = await route("wayback-lookup"); + const none = await callPost(lookup, {}); + assert.equal(none.status, 400); + assert.match(String(none.body.error), /"url" \(a page\) or "slug" and "id"/); + const both = await callPost(lookup, { url: "https://a.example/x", slug: "test-youtube", id: "x" }); + assert.equal(both.status, 400); + const ftp = await callPost(lookup, { url: "ftp://a.example/x" }); + assert.equal(ftp.status, 400); + assert.match(String(ftp.body.error), /http\(s\) URL/); + const big = await callPost(lookup, { url: "https://a.example/x", limit: 501 }); + assert.equal(big.status, 400); + // A record of no channel: no page to look up (a YouTube channel's record would + // be given its watch URL from its id, and asked of the real Wayback — never + // in a test). + const unknown = await callPost(lookup, { slug: "no-such-channel", id: "no-such-video" }); + assert.equal(unknown.status, 404); + assert.match(String(unknown.body.error), /no page is known for no-such-channel\/no-such-video/); +}); + +test("find-copy: exactly one of article, articles, siteId; an unknown one is refused before any lookup", async () => { + const find = await route("find-copy"); + const before = await corpus.listJobIds(); + assert.equal((await callPost(find, {})).status, 400); + const two = await callPost(find, { article: "a", siteId: "b" }); + assert.equal(two.status, 400); + assert.match(String(two.body.error), /send one of "article"/); + const noArticle = await callPost(find, { article: "no-such-article", dryRun: true }); + assert.equal(noArticle.status, 400); + assert.match(String(noArticle.body.error), /no article "no-such-article"/); + const noSite = await callPost(find, { siteId: "no-such-site" }); + assert.equal(noSite.status, 400); + assert.match(String(noSite.body.error), /No site "no-such-site"/); + assert.deepEqual(await corpus.listJobIds(), before, "nothing was queued"); +}); diff --git a/editor/app/api/ops/archive-search/route.ts b/editor/app/api/ops/archive-search/route.ts @@ -4,21 +4,50 @@ import { ARCHIVE_ORG_SEARCH_MAX_ROWS, searchArchiveOrgItems, } from "yt-dlp-transcript-common/controller/archiveOrgImport"; -import { OpsInputError, ops, opsFail, optPositiveInt, reqString } from "../_lib"; +import { findArchiveOrgMirrors } from "yt-dlp-transcript-common/controller/findCopy"; +import { OpsInputError, ops, opsFail, optPositiveInt, optString, reqString } from "../_lib"; export const dynamic = "force-dynamic"; // POST { query, limit? } -> { ok: true, query, found, items: [{ identifier, title? }] } +// | { youtubeId, limit? } -> { ok: true, youtubeId, query, found, +// items: [{ identifier, title?, file, url, source, size? }], +// skipped: [{ identifier, why }] } // // An archive.org search (its advanced-search syntax), read only: ONE request // through the editor's polite archive.org client — the same client, gap and // back-off an import uses (controller/archiveOrgImport.ts) — the first // `limit` items (default 50, at most 500) in identifier order. Nothing is // written; `import-archive-org` with `query` imports what a search finds. +// +// `youtubeId` (release 29 E2) looks for MIRRORS of one YouTube upload: items +// naming the id in their identifier, title, description or original URL +// (controller/findCopy.ts), each read for its files (one request each), and +// answers each mirror's direct video file URL +// (`https://archive.org/download/<identifier>/<file>`, an original preferred). +// An item that does not name the id, is restricted, or holds no file the +// upload can be told by is `skipped`, with why. `limit` defaults to 10 here. const ARCHIVE_SEARCH_DEFAULT_LIMIT = 50; +const MIRROR_DEFAULT_LIMIT = 10; export async function POST(request: Request) { - return ops(request, ["query", "limit"], async (body) => { + return ops(request, ["query", "limit", "youtubeId"], async (body) => { + const youtubeId = optString(body, "youtubeId")?.trim(); + if (youtubeId !== undefined && body.query !== undefined) { + throw new OpsInputError('send either "query" or "youtubeId", not both'); + } + if (youtubeId !== undefined) { + if (!/^[A-Za-z0-9_-]{6,20}$/.test(youtubeId)) throw new OpsInputError(`"${youtubeId}" is not a YouTube id`); + const limit = optPositiveInt(body, "limit") ?? MIRROR_DEFAULT_LIMIT; + if (limit > ARCHIVE_ORG_SEARCH_MAX_ROWS) throw new OpsInputError(`"limit" is at most ${ARCHIVE_ORG_SEARCH_MAX_ROWS}`); + try { + const r = await findArchiveOrgMirrors(youtubeId, { limit }); + return NextResponse.json({ ok: true, youtubeId, query: r.query, found: r.found, items: r.mirrors, skipped: r.skipped }); + } catch (e) { + if (e instanceof ArchiveOrgRequestError) return opsFail(e.message, 502); + throw e; + } + } const query = reqString(body, "query"); const limit = optPositiveInt(body, "limit") ?? ARCHIVE_SEARCH_DEFAULT_LIMIT; if (limit > ARCHIVE_ORG_SEARCH_MAX_ROWS) { diff --git a/editor/app/api/ops/find-copy/route.ts b/editor/app/api/ops/find-copy/route.ts @@ -0,0 +1,40 @@ +import { NextResponse } from "next/server"; +import { findCopyAction } from "../../../channels/[slug]/videos/findCopyAction"; +import { OpsInputError, ops, opsFail, optBool, optString } from "../_lib"; + +export const dynamic = "force-dynamic"; + +// POST { article } | { siteId } | { articles: true }, dryRun? +// -> { ok, dryRun, host, recordings: [{ slug, id, gone, watchUrl, youtubeId, +// windows, tried: [{ from, found, url?, detail?, error? }], copy?, +// outcome: fetch | text-only | error }], items, stopped?, jobId? } +// +// A COPY OF EVERY GONE RECORDING THE REPORTS CITE (release 29 E2, +// controller/findCopy.ts): of one article (`article`), every published +// article (`articles`), or a site's reports (`siteId`), the cited windows +// whose recording is deleted or private ("unfetchable: gone"). Per recording, +// one at a time: the Wayback Machine (a capture of its page that recorded a +// 200, the newest) then archive.org (a mirror naming its YouTube id, an +// original video file preferred). The windows of every copy found go to ONE +// fetch-windows job on the archive.org clip queue, each with the copy's URL as +// its page, so the clips land in the recording's own clips/ with the copy in +// their provenance. A recording with no copy is left: its moments show their +// words only ("source deleted"). `dryRun` answers the lookups and starts +// nothing. The lookups run in the request, paced. +export async function POST(request: Request) { + return ops(request, ["article", "siteId", "articles", "dryRun"], async (body) => { + const article = optString(body, "article")?.trim(); + const siteId = optString(body, "siteId")?.trim(); + const articles = optBool(body, "articles") === true; + if ([article, siteId, articles || undefined].filter(Boolean).length !== 1) { + throw new OpsInputError('send one of "article" (an article id), "articles": true or "siteId"'); + } + const r = await findCopyAction({ + ...(article ? { article } : {}), + ...(siteId ? { siteId } : {}), + dryRun: optBool(body, "dryRun") === true, + }); + if (!r.ok) return opsFail(r.error); + return NextResponse.json(r); + }); +} diff --git a/editor/app/api/ops/wayback-lookup/route.ts b/editor/app/api/ops/wayback-lookup/route.ts @@ -0,0 +1,50 @@ +import { NextResponse } from "next/server"; +import { ArchiveOrgRequestError } from "yt-dlp-transcript-common/lib/archiveOrgClient"; +import { getPaths } from "yt-dlp-transcript-common/lib/paths"; +import { recordWebpageUrl, waybackLookup } from "yt-dlp-transcript-common/controller/findCopy"; +import { OpsInputError, ops, opsFail, optBool, optPositiveInt, optString, reqSlug, reqVideoId } from "../_lib"; + +export const dynamic = "force-dynamic"; + +// POST { url } | { slug, id }, okOnly?, limit? -> { ok: true, url, found, +// captures: [{ timestamp, status, mimetype?, replayUrl }] } +// +// The Wayback Machine's captures of a page (its CDX API, release 29 E2): a +// URL as given, or a record's page — its metadata's webpage_url, else the one +// its availability check recorded, else the playlist's. Oldest first; +// `okOnly` keeps only the captures that recorded a 200; `limit` at most 500 +// (default 100). ONE request through the editor's Wayback client, with +// archive.org's manners (one at a time, a 2 s gap, the project's User-Agent, +// 429s waited out a few times, then a 502). Read only; nothing is fetched. +// `find-copy` is what fetches a gone recording's windows from a capture. +const MAX_LIMIT = 500; + +export async function POST(request: Request) { + return ops(request, ["url", "slug", "id", "okOnly", "limit"], async (body) => { + const given = optString(body, "url")?.trim(); + const hasRecord = body.slug !== undefined || body.id !== undefined; + if (given && hasRecord) throw new OpsInputError('send either "url" or "slug" and "id", not both'); + let url: string; + if (given) { + if (!/^https?:\/\/[^\s]+$/.test(given)) throw new OpsInputError(`"url" must be an http(s) URL`); + url = given; + } else if (hasRecord) { + const slug = reqSlug(body, "slug"); + const id = reqVideoId(body, "id"); + const found = await recordWebpageUrl(getPaths(), slug, id); + if (!found) return opsFail(`no page is known for ${slug}/${id} (no metadata, availability check or playlist entry names one)`, 404); + url = found; + } else { + throw new OpsInputError('"url" (a page) or "slug" and "id" (a record) is required'); + } + const limit = optPositiveInt(body, "limit") ?? 100; + if (limit > MAX_LIMIT) throw new OpsInputError(`"limit" is at most ${MAX_LIMIT}`); + try { + const r = await waybackLookup(url, { okOnly: optBool(body, "okOnly") === true, limit }); + return NextResponse.json({ ok: true, url, found: r.captures.length, captures: r.captures }); + } catch (e) { + if (e instanceof ArchiveOrgRequestError) return opsFail(e.message, 502); + throw e; + } + }); +} diff --git a/editor/app/channels/[slug]/videos/fetchWindowsAction.test.ts b/editor/app/channels/[slug]/videos/fetchWindowsAction.test.ts @@ -153,3 +153,29 @@ test("a held window a queued saved-video job will already cut is answered in inF reg.forceRelease("HOLDER"); } }); + +// Release 29 E2: a recording gone from its platform (lib/sourceGone.ts) has no +// page to fetch from — refused at the door — unless the item names a copy's +// URL (find-copy), which is the only way such a window is fetched. +test("a gone recording's window is refused at the door unless the item names a copy's URL", async () => { + const dir = path.join(ROOT, "channels", SLUG, "data", "deleted1"); + await mkdir(dir, { recursive: true }); + await writeFile(path.join(dir, "metadata.info.json"), JSON.stringify({ id: "deleted1", webpage_url: "https://www.youtube.com/watch?v=deleted1" })); + await writeFile(path.join(dir, "availability.json"), JSON.stringify({ checkedAt: "2026-10-01T00:00:00.000Z", availability: "deleted" })); + const plain = await fetchWindowsAction({ items: [{ slug: SLUG, id: "deleted1", from: 1, to: 3 }], requestedBy: "test", dryRun: true }); + assert.ok(plain.ok); + if (!plain.ok) return; + assert.equal(plain.groups.length, 0); + assert.equal(plain.unresolved.length, 1); + assert.match(plain.unresolved[0].error, /says the video is deleted.*find-copy/); + const copy = "https://web.archive.org/web/20260125093000/https://www.youtube.com/watch?v=deleted1"; + const viaCopy = await fetchWindowsAction({ + items: [{ slug: SLUG, id: "deleted1", from: 1, to: 3, webpageUrl: copy }], + requestedBy: "find-copy", + dryRun: true, + }); + assert.ok(viaCopy.ok); + if (!viaCopy.ok) return; + assert.deepEqual(viaCopy.unresolved, []); + assert.deepEqual(viaCopy.groups.flatMap((g) => g.items.map((i) => i.webpageUrl)), [copy]); +}); diff --git a/editor/app/channels/[slug]/videos/fetchWindowsAction.ts b/editor/app/channels/[slug]/videos/fetchWindowsAction.ts @@ -19,6 +19,7 @@ import { isFetchMaxHeight, } from "yt-dlp-transcript-common/lib/clipWindow"; import { findContainingClipWindow } from "yt-dlp-transcript-common/lib/clipWindow-server"; +import { sourceGoneState } from "yt-dlp-transcript-common/lib/sourceGone-server"; import { savedWindowSource } from "yt-dlp-transcript-common/lib/savedVideoWindow-server"; import type { ChannelConfig } from "yt-dlp-transcript-common/lib/channelConfig"; import { @@ -222,6 +223,23 @@ async function planFetchWindows( groups.set(queueKey, group); continue; } + // A RECORDING GONE FROM ITS PLATFORM (lib/sourceGone.ts) has no page to + // fetch a window from: refused here, before any request — unless the item + // names a copy's URL (`webpageUrl`: find-copy's Wayback capture or + // archive.org file, release 29 E2), which is the only way such a window is + // fetched. + if (!item.webpageUrl?.trim()) { + const gone = await sourceGoneState(videoDir); + if (gone) { + unresolved.push({ + item, + error: + `The source says the video is ${gone}: there is no page to fetch a window from. ` + + "pnpm ops find-copy looks for a copy (Wayback, archive.org) and fetches from it.", + }); + continue; + } + } const url = item.webpageUrl?.trim() || (await findVideoSourceUrl(paths, item.slug, dirId, config)); diff --git a/editor/app/channels/[slug]/videos/findCopyAction.ts b/editor/app/channels/[slug]/videos/findCopyAction.ts @@ -0,0 +1,71 @@ +"use server"; + +import { getPaths } from "yt-dlp-transcript-common/lib/paths"; +import { getSite, isValidSiteId, listSiteIds } from "yt-dlp-transcript-common/lib/site"; +import { clipWindowQueueKey } from "yt-dlp-transcript-common/lib/queueKeys"; +import { platformQueueKey } from "yt-dlp-transcript-common/lib/platform"; +import { articlesWorkHost, siteReportHost, type ReportHost } from "yt-dlp-transcript-common/publish/reportHost"; +import { runFindCopy, type FindCopyResult } from "yt-dlp-transcript-common/controller/findCopy"; +import { fetchWindowsJobAction } from "./fetchWindowsAction"; + +// FIND A COPY OF THE GONE RECORDINGS A REPORT CITES, and fetch their windows +// from it (release 29 E2; the lookups are controller/findCopy.ts). The windows +// of every copy found go to ONE fetch-windows job on the archive.org clip +// queue — Wayback captures and archive.org files are both archive.org's — so +// they are fetched one at a time, paced, one stream. + +export type FindCopyActionResult = + | { ok: false; error: string } + | (FindCopyResult & { + ok: true; + dryRun: boolean; + // The fetch-windows job, when one started. + jobId?: string; + // Why the fetch did not start, when it did not. + refused?: string; + }); + +// The archive.org clip queue: every copy's windows, one job, one stream. +const FIND_COPY_QUEUE = clipWindowQueueKey(platformQueueKey("archiveorg")); + +export async function findCopyAction(req: { article?: string; siteId?: string; dryRun?: boolean }): Promise<FindCopyActionResult> { + const paths = getPaths(); + let host: ReportHost; + try { + if (req.article) { + host = await articlesWorkHost(paths, [req.article], { only: true }); + } else if (req.siteId) { + if (!isValidSiteId(req.siteId)) return { ok: false, error: `"${req.siteId}" is not a valid site id` }; + if (!listSiteIds(paths).includes(req.siteId)) return { ok: false, error: `No site "${req.siteId}"` }; + host = siteReportHost(paths, getSite(req.siteId, paths)); + } else { + host = await articlesWorkHost(paths); + } + } catch (e) { + return { ok: false, error: (e as Error).message }; + } + let refused: string | undefined; + const r = await runFindCopy({ + paths, + host, + dryRun: req.dryRun, + startFetch: async (items) => { + const res = await fetchWindowsJobAction({ items, requestedBy: "find-copy", manifest: host.id, queueKey: FIND_COPY_QUEUE }); + if (!res.ok) { + refused = res.error; + return null; + } + // Nobody reads the stream: the job's log is on disk. + void res.stream.cancel().catch(() => {}); + return res.jobId; + }, + }); + const { fetch: jobId, ...found } = r; + return { + ok: true, + dryRun: req.dryRun === true, + ...found, + ...(typeof jobId === "string" ? { jobId } : {}), + ...(refused ? { refused } : {}), + }; +} diff --git a/editor/app/jobs/jobReplayRegistry.ts b/editor/app/jobs/jobReplayRegistry.ts @@ -8,6 +8,7 @@ // Server-only: reached through the retry actions in actions.ts ("use server"), // so it is never bundled to the client. import { getPaths } from "yt-dlp-transcript-common/lib/paths"; +import { coerceClipCopy } from "yt-dlp-transcript-common/lib/clipWindow"; import { readChannelSnapshot } from "yt-dlp-transcript-common/controller/channelSnapshot"; import type { JobSpec, ReplayBucket } from "yt-dlp-transcript-common/jobs/jobSpec"; import type { StreamActionResult } from "yt-dlp-transcript-common/jobs/streamCommand"; @@ -113,6 +114,8 @@ function windowItems(v: unknown): FetchWindowsItem[] { reason: str(r.reason), pad: num(r.pad), webpageUrl: str(r.webpageUrl), + // find-copy's copy (release 29 E2): a replay records it again. + copy: coerceClipCopy(r.copy), }); } return out; diff --git a/export/app/lib/reports.test.ts b/export/app/lib/reports.test.ts @@ -77,6 +77,7 @@ test("params: every report and every moment, as the index files list them", () = { moment: ["demo-channel", "abc123", "3126.00-3151.00"] }, { moment: ["demo-podcast", "ep-042", "610.50-628.00"] }, { moment: ["demo-social", "1234567890"] }, + { moment: ["demo-channel", "gone99", "1200.00-1210.00"] }, ]); }); @@ -147,7 +148,7 @@ test("the report page: header, tally, sections and claims, inline cites, referen assert.match(html, /data-inline-cite="w01"[^]*?data-cite-number="4"/); // every numbered citation has its reference entry, in number order const refs = [...html.matchAll(/<li id="c-([^"]+)" value="(\d+)"/g)].map((m) => `${m[2]}:${m[1]}`); - assert.deepEqual(refs, ["1:c01", "2:au1", "3:a01", "4:w01", "5:a02", "6:p01"]); + assert.deepEqual(refs, ["1:c01", "2:au1", "3:a01", "4:w01", "5:a02", "6:p01", "7:g01"]); assert.match(html, /href="\/pages\/demo-factcheck\/citations.json" download=""/); assert.match(html, /href="\/pages\/demo-factcheck\/citations.csv" download=""/); const meta = await reportPage.generateMetadata({ params }); diff --git a/export/e2e-report/report-site.spec.ts b/export/e2e-report/report-site.spec.ts @@ -18,14 +18,16 @@ import { readFixtureReport } from "../fixtures/report-site/fixture"; // // The site is export/fixtures/report-site, staged and built by // e2e-report/stage.ts: one fact-check citing a video span (c01), an audio -// span (au1), a post (p01), the article's own sentences (a01, a02) and a web -// page (w01). It has two revisions (report.v1.json, then report.json), and +// span (au1), a post (p01), the article's own sentences (a01, a02), a web +// page (w01), and a span of a stream deleted since (g01: its words only, +// "Source deleted"). It has two revisions (report.v1.json, then report.json), and // publishes their history. const REPORT = "/pages/demo-factcheck/"; const VIDEO_MOMENT = "/m/demo-channel/abc123/3126.00-3151.00/"; const AUDIO_MOMENT = "/m/demo-podcast/ep-042/610.50-628.00/"; const POST_MOMENT = "/m/demo-social/1234567890/"; +const GONE_MOMENT = "/m/demo-channel/gone99/1200.00-1210.00/"; const HISTORY = "/pages/demo-factcheck/history/"; const inlineCite = (page: Page, id: string): Locator => page.locator(`[data-inline-cite="${id}"]`).first(); @@ -235,10 +237,10 @@ test("a post citation's preview shows the captured shot", async ({ page }) => { test("a citation's number jumps to its entry in the reference list", async ({ page }) => { await page.goto(REPORT); const refs = page.locator("[data-reference-list] [data-reference]"); - await expect(refs).toHaveCount(6); + await expect(refs).toHaveCount(7); await expect .poll(() => refs.evaluateAll((els) => els.map((el) => el.id))) - .toEqual(["c-c01", "c-au1", "c-a01", "c-w01", "c-a02", "c-p01"]); + .toEqual(["c-c01", "c-au1", "c-a01", "c-w01", "c-a02", "c-p01", "c-g01"]); await inlineCite(page, "w01").locator("[data-cite-number]").click(); await expect(page).toHaveURL(`${REPORT}#c-w01`); @@ -298,7 +300,7 @@ test("report.html opens with no network: one file, no script, every image inline expect(await img.getAttribute("src")).toMatch(/^data:image\//); await expect.poll(() => img.evaluate((el) => (el as HTMLImageElement).naturalWidth)).toBeGreaterThan(0); } - await expect(page.locator("[data-reference-list] > li")).toHaveCount(6); + await expect(page.locator("[data-reference-list] > li")).toHaveCount(7); // The page's tiers, its flag pill and the added mark, as the site has them. await expect(page.locator("[data-report-tier]")).toHaveCount(3); await expect(page.locator("[data-claim-flag]").first()).toContainText("No source given"); @@ -435,6 +437,21 @@ test("an audio moment plays its clip as sound", async ({ page, request }) => { await expect(page.locator(`[data-cited-in] a[href="${REPORT}#claim-2"]`)).toHaveCount(1); }); +// Release 29 E2: a cited recording deleted on its platform with no copy found +// is its words only, said in plain words on its card and its moment page. +test("a source-deleted moment: its words, no clip, \"Source deleted\" on the card and the page", async ({ page }) => { + await page.goto(REPORT); + const card = page.locator('#c-g01'); + await expect(card.locator("[data-source-gone]")).toHaveText(/Source deleted/); + await expect(card.getByRole("link", { name: /^Open / })).toHaveAttribute("href", /\/m\/demo-channel\/gone99\/1200\.00-1210\.00\//); + await page.goto(GONE_MOMENT); + await expect(page.locator("[data-moment]")).toHaveAttribute("data-moment-kind", "video"); + await expect(page.locator('[data-moment] p[data-source-gone="deleted"]')).toHaveText("Source deleted"); + await expect(page.locator("video, audio")).toHaveCount(0); + await expect(page.locator("[data-cue-lines] li[data-in-span]")).toHaveText([/I was standing right there when they cut the ribbon\./]); + await expect(page.locator(`[data-cited-in] a[href="${REPORT}#claim-5"]`)).toHaveCount(1); +}); + test("a post moment shows the captured shot and the post", async ({ page }) => { await page.goto(POST_MOMENT); await expect(page.locator("[data-moment]")).toHaveAttribute("data-moment-kind", "post"); diff --git a/export/fixtures/report-site/fixture.ts b/export/fixtures/report-site/fixture.ts @@ -69,6 +69,16 @@ const RECORDS: Record<string, RecordView> = { date: "2026-01-10", platform: "youtube", }, + // A stream deleted on its platform since (release 29 E2): no copy of it was + // found, so its moment is its words only, marked "Source deleted". + "demo-channel/gone99": { + channel: "demo-channel", + channelTitle: "Demo Channel", + id: "gone99", + title: "Demo stream: the ribbon, told again", + date: "2026-03-01", + platform: "youtube", + }, "demo-podcast/ep-042": { channel: "demo-podcast", channelTitle: "Demo Podcast", @@ -87,6 +97,11 @@ const RECORDS: Record<string, RecordView> = { const POSTER = "/pages/demo-factcheck/stills/poster.png"; +// The recordings gone from their platform with no media published: compose's +// `sourceGone` (common/publish/composeReports.ts). +const GONE: Record<string, "deleted" | "private"> = { "demo-channel/gone99": "deleted" }; +const goneOf = (c: { channel: string; id: string }) => GONE[`${c.channel}/${c.id}`]; + // A post's captured screenshot, where compose copies a cited capture // (publish/citedPostCaptures.ts): committed under public/media/posts/. function shotFor(c: { channel: string; id: string }): string { @@ -116,7 +131,8 @@ function recordFor(channel: string, id: string, seconds?: number): RecordView { export function buildFixtureReportView(report = readFixtureReport()): ReportPageView { return buildReportPageView(report, { record: (c) => recordFor(c.channel, c.id, c.kind === "post" ? undefined : c.start), - poster: (c) => (c.kind === "video" ? POSTER : undefined), + poster: (c) => (c.kind === "video" && !goneOf(c) ? POSTER : undefined), + sourceGone: (c) => goneOf(c), post: (c) => ({ author: "@demo_account", text: `${c.quote}\n\nPosted to settle it.`, @@ -152,6 +168,11 @@ const CUES: Record<string, { start: number; end: number; text: string }[]> = { { start: 3151, end: 3160, text: "Anyway, back to the mail." }, { start: 3160, end: 3170, text: "Next letter is from a long-time viewer." }, ], + "demo-channel/gone99": [ + { start: 1190, end: 1200, text: "People keep asking about the ribbon thing." }, + { start: 1200, end: 1210, text: "I was standing right there when they cut the ribbon." }, + { start: 1210, end: 1220, text: "Anyway, that was years ago." }, + ], "demo-podcast/ep-042": [ { start: 600, end: 610.5, text: "So when did you first go back there?" }, { start: 610.5, end: 628, text: "Like I said before, spring twenty nineteen." }, @@ -187,14 +208,15 @@ export function buildFixtureMomentViews( ...(c.verification ? { verification: c.verification } : {}), start: span.start, end: span.end, - clip: { + ...(goneOf(c) ? { sourceGone: goneOf(c) } : {}), + ...(goneOf(c) ? {} : { clip: { // A clip cut as sound is an .m4a beside the video clips (compose's // clipPath). src: c.kind === "audio" ? evidenceClipPath(span).replace(/\.mp4$/, ".m4a") : evidenceClipPath(span), start: Math.max(0, span.start - before), end: span.end + after, ...(c.kind === "video" ? { poster: POSTER } : {}), - }, + } }), cues: (CUES[`${c.channel}/${c.id}`] ?? []).map((q) => ({ ...q, inSpan: q.end > span.start && q.start < span.end, diff --git a/export/fixtures/report-site/public/m/demo-channel/gone99/1200.00-1210.00/moment.json b/export/fixtures/report-site/public/m/demo-channel/gone99/1200.00-1210.00/moment.json @@ -0,0 +1,57 @@ +{ + "format": "archilyzer-moment-page", + "version": 1, + "key": "demo-channel/gone99/1200.00-1210.00", + "kind": "video", + "record": { + "channel": "demo-channel", + "channelTitle": "Demo Channel", + "id": "gone99", + "title": "Demo stream: the ribbon, told again", + "date": "2026-03-01", + "platform": "youtube", + "originalUrl": "https://media.example.org/demo-channel/gone99?t=1200" + }, + "quote": "I was standing right there when they cut the ribbon.", + "start": 1200, + "end": 1210, + "sourceGone": "deleted", + "cues": [ + { + "start": 1190, + "end": 1200, + "text": "People keep asking about the ribbon thing.", + "inSpan": false + }, + { + "start": 1200, + "end": 1210, + "text": "I was standing right there when they cut the ribbon.", + "inSpan": true + }, + { + "start": 1210, + "end": 1220, + "text": "Anyway, that was years ago.", + "inSpan": false + } + ], + "citedIn": [ + { + "reportId": "demo-factcheck", + "sectionId": "moving", + "claimId": "claim-5", + "citationId": "g01", + "href": "/pages/demo-factcheck/#claim-5", + "reportTitle": "Demo Checks: Checking an example article", + "sectionTitle": "Moving away", + "claimText": "He was at the opening.", + "verdict": "CORROBORATED", + "verdictStyle": { + "label": "Corroborated", + "color": "#3fbf7f" + }, + "number": 7 + } + ] +} diff --git a/export/fixtures/report-site/public/m/index.json b/export/fixtures/report-site/public/m/index.json @@ -4,6 +4,7 @@ "moments": [ "demo-channel/abc123/3126.00-3151.00", "demo-podcast/ep-042/610.50-628.00", - "demo-social/1234567890" + "demo-social/1234567890", + "demo-channel/gone99/1200.00-1210.00" ] } diff --git a/export/fixtures/report-site/public/pages/demo-factcheck/page.json b/export/fixtures/report-site/public/pages/demo-factcheck/page.json @@ -155,6 +155,26 @@ "author": "@demo_account", "text": "Never said I would move. Not once.\n\nPosted to settle it.", "shot": "/media/posts/demo-social/1234567890/shot.png" + }, + "g01": { + "kind": "video", + "id": "g01", + "number": 7, + "quote": "I was standing right there when they cut the ribbon.", + "moment": "demo-channel/gone99/1200.00-1210.00", + "href": "/m/demo-channel/gone99/1200.00-1210.00/", + "start": 1200, + "end": 1210, + "record": { + "channel": "demo-channel", + "channelTitle": "Demo Channel", + "id": "gone99", + "title": "Demo stream: the ribbon, told again", + "date": "2026-03-01", + "platform": "youtube", + "originalUrl": "https://media.example.org/demo-channel/gone99?t=1200" + }, + "sourceGone": "deleted" } }, "entries": [ @@ -249,9 +269,10 @@ "id": "claim-5", "text": "He was at the opening.", "verdict": "CORROBORATED", - "findings": "He says [he was there](cite:c01).", + "findings": "He says [he was there](cite:c01), and told it again on a stream since [deleted](cite:g01).", "citations": [ - "c01" + "c01", + "g01" ] } ] diff --git a/export/fixtures/report-site/public/pages/index.json b/export/fixtures/report-site/public/pages/index.json @@ -11,7 +11,7 @@ "published": "2026-10-01", "updated": "2026-10-04", "href": "/pages/demo-factcheck/", - "citationCount": 6, + "citationCount": 7, "claimCount": 5, "tally": [ { diff --git a/export/fixtures/report-site/source/demo-factcheck/report.json b/export/fixtures/report-site/source/demo-factcheck/report.json @@ -59,6 +59,14 @@ "quote": "Never said I would move. Not once.", "date": "2025-03-14" }, + "g01": { + "kind": "video", + "channel": "demo-channel", + "id": "gone99", + "start": 1200, + "end": 1210, + "quote": "I was standing right there when they cut the ribbon." + }, "a01": { "kind": "source", "source": "s0", @@ -156,8 +164,8 @@ "id": "claim-5", "text": "He was at the opening.", "verdict": "CORROBORATED", - "findings": "He says [he was there](cite:c01).", - "citations": ["c01"] + "findings": "He says [he was there](cite:c01), and told it again on a stream since [deleted](cite:g01).", + "citations": ["c01", "g01"] } ] } diff --git a/scripts/archilyzer-ops.mjs b/scripts/archilyzer-ops.mjs @@ -103,6 +103,10 @@ // pnpm ops web-fetch --json '{"url":"https://example.com/news/item","maxChars":4000}' // pnpm ops archive-search --json '{"query":"title:(kitchen) AND mediatype:movies","limit":20}' // pnpm ops archive-item --json '{"item":"example-item"}' +// pnpm ops archive-search --json '{"youtubeId":"dQw4w9WgXcQ"}' +// pnpm ops wayback-lookup --json '{"slug":"demo-channel","id":"dQw4w9WgXcQ","okOnly":true}' +// pnpm ops find-copy --json '{"article":"demo-article","dryRun":true}' +// pnpm ops find-copy --json '{"article":"demo-article"}' --wait // pnpm ops import-post --json '{"slug":"demo-x","url":"https://x.com/example/status/1700000000000000001"}' --wait // pnpm ops report-draft --json '{"task":"sweep","article":"demo-article","question":"What does she say about the shop?","channels":["demo-channel"]}' --wait // pnpm ops report-draft --json '{"task":"revise-report","article":"demo-article","iteration":1,"feedback":"Drop the second finding."}' @@ -410,6 +414,13 @@ const ACTIONS = [ "archive-search", "archive-item", "import-post", + // EVIDENCE GAPS (release 29 E2): the Wayback Machine's captures of a page + // ({url} or a record's {slug, id}), read only and paced; and find-copy — a + // copy of every gone recording a report cites (Wayback, then archive.org), + // its windows fetched from it as one fetch-windows job ({article} | + // {articles: true} | {siteId}, dryRun?). + "wayback-lookup", + "find-copy", // GENERATION (release 27 S6): a sweep, a report or video revision, or a // narration step over an article's iteration ({task, article, iteration?, // model?, extractorModel?, feedback?, question?, channels?, copyOf?, maxUsd?, @@ -1076,10 +1087,12 @@ export function usage() { ' the last timeline fetch read none) is refused unless "force": true. A', " drained fetch stops at its next resume point and the next run resumes.", "", - 'capture-posts captures archived posts of a social channel (X, forum): a', - ' screenshot of each through the connected X profile (a forum thread: its', - ' host\'s forum profile), and its attached media through gallery-dl (a', - ' forum thread: the same profile), into the channel\'s posts-media/<id>/:', + 'capture-posts captures archived posts of a social channel (X, forum,', + ' Bluesky): a screenshot of each through the connected X profile (a forum', + ' thread: its host\'s forum profile; Bluesky: a headless browser with no', + ' login on bsky.app, the shot cropped to the post), and its attached media', + ' through gallery-dl (a forum thread: the same profile; Bluesky: its images', + ' from the CDN), into the channel\'s posts-media/<id>/:', ' {"slug", "ids": [...]}. Every id must be in the channel\'s posts archive.', ' "shots": false or "media": false skips that half; posts already captured', ' are skipped unless "force": true. A post that links to an X Article also', @@ -1220,6 +1233,11 @@ export function usage() { ' [{identifier, title?}]}, in identifier order. One request through the', " editor's archive.org client, paced and backed off as an import is. Read", ' only; import-archive-org with "query" imports what a search finds.', + ' {"youtubeId", "limit"?: 10} looks for mirrors of one YouTube upload', + ' instead: items naming the id in their identifier, title, description or', + ' original URL, each read for its files -> {query, found, items:', + ' [{identifier, title?, file, url, source, size?}], skipped: [{identifier,', + ' why}]}: each mirror\'s direct video file URL, an original preferred.', "", 'archive-item answers one archive.org item\'s files from its metadata:', ' {"item"} -> {item: {identifier, url, title?, date?, mediatype?, creator?,', @@ -1228,6 +1246,29 @@ export function usage() { " originals an import takes (one record each); restricted, what archive.org", " will not hand out. Read only; nothing is downloaded.", "", + 'wayback-lookup answers the Wayback Machine\'s captures of a page (its CDX', + ' API): {"url"} or a record\'s {"slug", "id"} (its metadata\'s page, else', + ' its availability check\'s, else the playlist\'s), "okOnly"?: only the', + ' captures that recorded a 200, "limit"?: 100 (at most 500) -> {url,', + ' found, captures: [{timestamp, status, mimetype?, replayUrl}]}, oldest', + " first. One request through the editor's Wayback client, with archive.org's", + " manners (one at a time, 2 s apart, 429s waited out). Read only.", + "", + 'find-copy looks for a copy of every gone recording (deleted or private) a', + ' report cites, and fetches the cited windows from it: {"article"} |', + ' {"articles": true} | {"siteId"}, "dryRun"?. Per recording, one at a time:', + " the Wayback Machine (the newest capture of its page that recorded a 200),", + " then archive.org (a mirror naming its YouTube id, an original video file", + " preferred). Every copy's windows go to ONE fetch-windows job on the", + " archive.org clip queue, the copy's URL as each window's page, so the clips", + " land in the recording's own clips/ with the copy (wayback or archive.org,", + " and its URL) in each window's provenance. A recording with no copy is", + ' left: its moments show their words only, marked "Source deleted". ->', + " {recordings: [{slug, id, gone, watchUrl, youtubeId, windows, tried:", + " [{from, found, url?, detail?, error?}], copy?, outcome: fetch | text-only", + " | error}], items, stopped?, jobId?, refused?}. dryRun answers the lookups", + " and starts nothing.", + "", 'import-post imports ONE post by its URL into a posts channel of its', ' platform: {"slug", "url"} — an X status (x.com/<handle>/status/<id>) or a', ' Bluesky post (bsky.app/profile/<handle>/post/<id>, or its at:// URI). Read',