commit 80d8d43632bed7dd2fa6e3b9601e77d058502cb7
parent e4228d5638b5423e5cc460364b9709b6273c300f
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Tue, 17 Nov 2026 21:22:38 -0500
x-trending review 1 (SHOULD 8, docs): the profile guard's other side for capture-posts; the docs
An X post capture checks X's Connect / Refresh at its start, as the trending read
does, and fails with a sentence instead of Chromium's profile-lock error (a capture
on another platform's queue is not concerned). A refused press's sentence names the
job and says to cancel it on /jobs or wait; a queued job never blocks a press.
A test of the real 15-minute cooldown on the twitter platform entry. OPERATING.md,
the changelog, the CLI help and CHANNEL.md say where a library's posts live, that no
report or video project is offered them, that captures are never committed or copied
off the machine by any Archilyzer path, and the read's deadlines, cooldown and 403.
Co-Authored-By: Claude <noreply@anthropic.com>
Diffstat:
13 files changed, 139 insertions(+), 172 deletions(-)
diff --git a/CHANNEL.md b/CHANNEL.md
@@ -61,7 +61,7 @@ Regenerate this file with `pnpm --filter yt-dlp-transcript-common exec tsx bin/f
| `mirror` | config | For a channel that MIRRORS another creator's streams: the creator's channels it copies (`of`, their slugs). The mirror scan (`pnpm ops mirror-scan`) pairs each of this channel's videos with the creator's by date and title and writes `transcripts/mirrors/<slug>.json`: which videos the creator still has public, removed or never uploaded, and which of the creator's removed videos this channel holds. Private: never published. An object without a usable `of` is dropped. See [`mirror`](#mirror). |
| `wayback` | config | A WAYBACK PAGES channel (platform `"webpage"`, `sourceKind` `"social"`): which Wayback Machine captures of pages that are not videos are in scope. `{targets: [{url, match, from?, to?, mime?, include?, exclude?}], collapse?: "digest", auto?: true}` — `match` is `"exact"` (one page), `"prefix"` (every URL under a path), `"host"` (one host) or `"domain"` (a host and its subdomains); `from`/`to` bound the capture time (a Wayback timestamp prefix, 4–14 digits, inclusive); `mime` the mimetypes kept (default `text/html`); `include`/`exclude` regex sources over a capture's original URL. Each capture imported (`pnpm ops import-page`, the channel page's **Import a capture**) becomes a page record in the channel's posts, its raw body kept under `pages/` (OPERATING.md, "Import from the Wayback Machine"). A target without a URL or a valid `match` is dropped; an object with no valid target is dropped. `auto: true` lets the download lane import the captures a later scan (`pnpm ops wayback-scan`, the **Captures** tab) adds, one job each at archive.org's pace; absent, nothing is imported unasked. Release 37 lane F: a target's `sources` (`["wayback", "archive.today"]`; absent = the Wayback Machine alone) says which archives hold its copies, and an archive.today copy imported into the channel is a page record like a capture (OPERATING.md, "Archived pages: the Wayback Machine and archive.today"); the form calls the kind "Archived pages". |
| `xSearch` | config | An X SEARCH channel (platform `"twitter"`, `sourceKind` `"social"`, `url` the search page): a saved X search across accounts, its records the matching posts from ANY author. `{query, since?, until?, windowMonths?, lang?, exclude?}` — `query` as X's search box takes it (words, `"phrases"`, `OR`, `-term`, `from:`, `to:`, `@mention`, `url:`, `filter:`, `lang:` pass through; `since:`, `until:` and `max_id:` are refused — the walk adds them); `since`/`until` the days walked between (YYYY-MM-DD; `since` inclusive, `until` exclusive; absent `until` = tomorrow, and each later fetch searches what is new); `windowMonths` each search window's span (1–12, default 3); `lang` a language code added as `lang:<code>`; `exclude` the handles **Never archive** hid from the leads view (lower case). A fetch walks the windows newest first through gallery-dl's search, resumable, at the older walk's pace and with its login (OPERATING.md, "X search"). Never on a site. An object without a valid query is dropped. |
-| `xTrending` | config | An X TRENDING LIBRARY (platform `"twitter"`, `sourceKind` `"social"`, no `url`): a PRIVATE posts channel whose records are the posts X's trending pages (`x.com/i/trending/<id>`) showed, from ANY author, read one page at a time by `pnpm ops read-x-trending` and grouped into topics (`channels/<slug>/trending/`). `{maxScrolls?, maxPosts?}` — the caps a read uses when the ask names none (1–20 scrolls, default 8; 1–200 posts, default 60); `{}` is a library with the defaults. Never on a site (refused on create, on Configure and by every site writer), in no index build (so not in the editor's own search either), never synced. Set by creating a channel with platform `x-trending`; not a Configure field. |
+| `xTrending` | config | An X TRENDING LIBRARY (platform `"twitter"`, `sourceKind` `"social"`, no `url`): a PRIVATE posts channel whose records are the posts X's trending pages (`x.com/i/trending/<id>`) showed, from ANY author, read one page at a time by `pnpm ops read-x-trending` and grouped into topics. Everything of it — its posts too — is kept under `channels/<slug>/trending/`, not in `channels/<slug>/posts/`, so no reader of a posts channel finds them. The marker alone makes a channel a library. `{maxScrolls?, maxPosts?}` — the caps a read uses when the ask names none (1–20 scrolls, default 8; 1–200 posts, default 60); `{}` is a library with the defaults. Never on a site (refused on create, on Configure and by every site writer), in no index build (so not in the editor's own search either), never synced. Set by creating a channel with platform `x-trending`; not a Configure field. |
| `localMedia` | config | Opt-in external MP4 library: {sourceId, directory, playback?}. The sourceId is a stable lowercase identifier; directory is an absolute server/container path. Source files remain externally owned. Playback is off unless explicitly true, and this flag alone does not authorize public serving. Removing or changing configuration must never move or delete source files. Do not reuse an existing sourceId for a different library; reconcile references explicitly. Private configuration: never include source paths in public exports. |
#### `downloadFilter`
diff --git a/CITATIONS.md b/CITATIONS.md
@@ -1,147 +0,0 @@
-# Citations
-
-<!-- GENERATED by common/bin/file-schemas-docs.ts from the schemas and their *_FIELD_DOCS records — do not edit by hand. -->
-
-The one citation model, for every document that cites the corpus: a report (`report.json` — see [REPORT.md](REPORT.md)), a standalone citation set (`archilyzer-citations`, below), and whatever comes next. The schema is `common/lib/citations/schema.ts`; the value rules are `common/lib/citations/validate.ts`, which reports every problem with its JSON path instead of stopping at the first.
-
-A citation is a discriminated union on `kind`: `video` and `audio` (a span of a record's media), `post` (a post record), `source` (a sentence of a document under review) and `page` (a web page outside the corpus). Every kind carries the common fields. A container names its citations by id in a `citations` map, and its documents in a `sources` map; an id is letters, digits and `_ . : -`, starting with a letter or digit, at most 64, and no id names both a source and a citation. Unknown keys are refused, and so is an unknown kind: a new kind is a new version.
-
-**Citing inline.** In any markdown a document carries, `[label](cite:<id>)` cites the citation `<id>` (a link inside a code span or a fenced block is text, not a citation). Citations are numbered per document by first appearance in reading order — a citation cited again keeps its number — and each has the stable anchor `#c-<id>`.
-
-**Moments.** A `video` or `audio` citation opens the page `/m/<channel>/<id>/<start>-<end>/`, a `post` citation `/m/<channel>/<id>/`; `source` and `page` citations have no page of their own. `<start>` and `<end>` are written with two decimals, always (`12.50`, never `12.5`), so a moment has one URL; the pad is not part of it. `<channel>` and `<id>` are single safe path segments (letters, digits, `.`, `_`, `-`; a channel starts with a letter or digit, an id may start with `-`). Moment keys are `common/lib/citations/moments.ts`.
-
-**Spans.** `start` is at least 0, `end` is after it (by at least 0.01 s), each `pad` is at least 0, and the span with its pad is at most 120 s.
-
-**Paths.** A still (`image`) or a saved document (`saved`) is relative to the container's directory: `/`-separated, never absolute, with no empty, `.` or `..` segment.
-
-Regenerate this file with `pnpm --filter yt-dlp-transcript-common exec tsx bin/file-schemas-docs.ts`.
-
-## Every kind
-
-#### Common fields
-
-| Key | Required | Description |
-|---|---|---|
-| `quote` | yes | The cited words, VERBATIM — as the record says them (a span's cues, a post's text, the source's sentence, the page's text). Never a paraphrase: compose checks a span's quote against its cues and fails on drift. |
-| `speaker` | no | Who says the quote, when that is not the record's own channel (a guest, a co-host, a caller). |
-| `date` | no | When the quote was said or written: `YYYY`, `YYYY-MM`, `YYYY-MM-DD` or an ISO 8601 date-time. Absent = the record's own date. |
-| `label` | no | A short display name for the citation (one line), used where its number alone would be too little. |
-| `note` | no | An editorial note shown with the citation (plain text): context the quote needs. |
-| `origin` | no | In a report that reviews a document (`subject`): where this evidence came from. `"subject"` — the document itself gave it (its link, its embedded clip, its picture); `"added"` — the report's author found it, the document did not give it. Absent = not known. A report with no `subject` carries none. |
-| `verification` | no | COMPUTED, not authored: what checking this citation found, written by compose. A hand-typed block that could not have come from a check (a score outside 0–1, a score without its time) is a validation problem. |
-
-#### `verification`
-
-| Key | Required | Description |
-|---|---|---|
-| `quoteScore` | no | How closely `quote` matches what the record says at the cited place, from 0 (nothing alike) to 1 (verbatim). Written by the check, with `quoteCheckedAt`. |
-| `quoteCheckedAt` | no | When the quote was checked: an ISO 8601 date-time. Written with `quoteScore`. |
-| `voiceChecked` | no | True when the speaker's voice in the cited span was checked against `speaker`. Only a span (video, audio) has a voice to check. |
-| `method` | no | What did the checking, e.g. the cue-window comparison and its version. Free text, one line. |
-
-## The kinds
-
-#### `"video"`
-
-| Key | Required | Description |
-|---|---|---|
-| `kind` | yes | `"video"`. |
-| `channel` | yes | The record's channel slug (its directory under `transcripts/channels/`). A path segment of the moment page. The citing site must name it in `channels` (its pool) or `citedChannels` (cited only: the moment page and its clip publish, with no link into a corpus) — see [SITE.md](SITE.md); any other channel is refused at compose (`not-in-site`). |
-| `id` | yes | The record's video id (its directory under `data/`; may start with `-`). A path segment of the moment page. |
-| `start` | yes | Where the cited span starts, in seconds from the start of the record. |
-| `end` | yes | Where the cited span ends, in seconds; after `start`. |
-| `pad` | no | Context around the span in the evidence clip, in seconds. Absent = none. The span plus its pad is at most 120 s. |
-
-#### `"audio"`
-
-| Key | Required | Description |
-|---|---|---|
-| `kind` | yes | `"audio"`: a span of a record with no picture worth showing (a podcast). Rendered with a poster. |
-| `channel` | yes | The record's channel slug (its directory under `transcripts/channels/`). A path segment of the moment page. The citing site must name it in `channels` (its pool) or `citedChannels` (cited only: the moment page and its clip publish, with no link into a corpus) — see [SITE.md](SITE.md); any other channel is refused at compose (`not-in-site`). |
-| `id` | yes | The record's video id (its directory under `data/`; may start with `-`). A path segment of the moment page. |
-| `start` | yes | Where the cited span starts, in seconds from the start of the record. |
-| `end` | yes | Where the cited span ends, in seconds; after `start`. |
-| `pad` | no | Context around the span in the evidence clip, in seconds. Absent = none. The span plus its pad is at most 120 s. |
-
-#### `pad` (video, audio)
-
-| Key | Required | Description |
-|---|---|---|
-| `before` | no | Seconds of context before `start`; ≥ 0. Absent = 0. |
-| `after` | no | Seconds of context after `end`; ≥ 0. Absent = 0. |
-
-#### `"post"`
-
-| Key | Required | Description |
-|---|---|---|
-| `kind` | yes | `"post"`: a post record — an X, Bluesky or forum post, or a page record (a Wayback Machine capture imported into a Wayback pages channel, platform `webpage`). |
-| `channel` | yes | The post's channel slug. A path segment of the moment page. The citing site must name it in `channels` or `citedChannels` (see [SITE.md](SITE.md)), and may carry the post (the post visibility rule). |
-| `id` | yes | The post's id. A path segment of the moment page. |
-| `thread` | no | True to show the post with the thread it belongs to. Absent = the post alone. |
-| `fallback` | no | The `page` citation this one replaced (`{kind: "page", url, title?, archiveUrl?}`): a page citation whose Wayback copy was imported as a page record (umtool's **Import this capture**) becomes a `post` citation of that record, its page facts kept here so the page can still be shown where the post is not resolved. Absent = the citation was always a post. |
-
-#### `fallback` (post)
-
-| Key | Required | Description |
-|---|---|---|
-| `kind` | yes | `"page"`. |
-| `url` | yes | The page's address, as the page citation named it. |
-| `title` | no | The page's title, as the page citation named it. |
-| `archiveUrl` | no | The archived copy the page citation named (the capture imported). |
-
-#### `"source"`
-
-| Key | Required | Description |
-|---|---|---|
-| `kind` | yes | `"source"`: a sentence of a document under review. |
-| `source` | yes | The id of the document in the container's `sources`. Its archive links are shown with the citation. |
-| `image` | no | A still of the sentence as the document shows it: a path relative to the container's directory (e.g. `stills/a01.png`), never absolute, never leaving it. |
-
-#### `"page"`
-
-| Key | Required | Description |
-|---|---|---|
-| `kind` | yes | `"page"`: a web page outside the corpus. A capture of it imported into a Wayback pages channel is a page record, cited as a `post`. |
-| `url` | yes | The page's address: an http(s) URL. |
-| `title` | no | The page's title. |
-| `archiveUrl` | no | An archived copy of the page (an http(s) URL), shown beside the live link. |
-
-## Sources
-
-The documents a `source` citation quotes, in a container's `sources` map by id. A saved copy (`saved`) is the input stills are shot from and is never published.
-
-#### `sources.<id>`
-
-| Key | Required | Description |
-|---|---|---|
-| `kind` | yes | What the document is: `article`, `page`, `video`, `post`, `document`, `other`. |
-| `title` | yes | The document's title. |
-| `url` | no | Where the document lives: an http(s) URL. |
-| `publisher` | no | Who published it (the outlet, the site). |
-| `author` | no | Who wrote it. |
-| `date` | no | When it was published: `YYYY`, `YYYY-MM`, `YYYY-MM-DD` or an ISO 8601 date-time. |
-| `archives` | no | The document's archive links, in context — as the document had them. Shown with every citation of it. |
-| `note` | no | A note shown with the document's byline (plain text), e.g. which copy of it was read. |
-| `accent` | no | The document's colour, `"#rrggbb"`: the rail beside each of its quoted sentences and the edge of its box, so they read as one source. Absent = the theme's border colour. |
-| `saved` | no | A saved copy of the document, relative to the container's directory (e.g. `sources/s0/page.html`): the input the stills are shot from. NEVER published. |
-
-#### `sources.<id>.archives[]`
-
-| Key | Required | Description |
-|---|---|---|
-| `label` | yes | The link's text. |
-| `url` | yes | The archived copy: an http(s) URL. |
-| `context` | no | The words around the link in the document, so a reader sees what it was offered as. |
-
-## A citation set
-
-Citations outside a report — what a converter of a sweep, an answer or a video manifest emits — are one JSON document, format `"archilyzer-citations"`, version 1.
-
-#### The document
-
-| Key | Required | Description |
-|---|---|---|
-| `format` | yes | `"archilyzer-citations"`. |
-| `version` | yes | `1`. |
-| `sources` | no | The documents the `source` citations quote, by id. Absent = none. |
-| `citations` | yes | The citations, by id. An id is what a `[label](cite:<id>)` link names. |
diff --git a/COMMANDS.md b/COMMANDS.md
@@ -218,7 +218,7 @@ Drives a running editor over HTTP (`/api/ops/*`, the same actions its pages run)
| `save-page-now-batch` | save-page-now-batch saves a LIST of pages as ONE resumable job: {"urls": \[...\]} \| {"file": <abs path: a JSON list, {urls}, or a URL a line>} \| {"batch": <id>}, "skipArchived"? (true), "sources"? (\["wayback", "archive.today"\]), "evidence"? (abs path), "dailyCap"? (150 anonymous, at most 200; 5000 with keys), "dryRun"? -> {jobId, batch}. Each URL in turn: looked up (the Wayback CDX, archive.today's timemap, each paced) and archived-already when a copy shows it (a Wayback row that recorded a 200, or an archive.today copy); else saved through Save Page Now's pacer (anonymous without keys), saved or failed with the reason; a site Save Page Now refuses as a site (x.com, 5 Nov: "limitations when it comes to archiving this site") is asked once a run, its other URLs looked up only. archive.today and Ghostarchive are looked up, never asked to save. The state is <transcripts>/.spn-batches/<batch>.json, written after every URL: the same request again, {batch}, a Retry or a restart continues from the first pending URL. The evidence (JSON + CSV: url, status, reason, waybackUrl, waybackCaptureTs, waybackHttpStatus, waybackMimetype, archiveTodayUrl, archiveTodayCaptureTs, shows, savedMode, checkedAt, doneAt) is rewritten after every URL; default <transcripts>/.spn-batches/<batch>.evidence.json. Progress (done/total, ETA) in /jobs. The log ends with @@save-page-now-batch {batch, mode, counts, run, evidence, statePath, etaSeconds, stopped?}. | `pnpm ops save-page-now-batch --json '{"file":"/home/me/lists/posts.json","dryRun":true}'`<br>`pnpm ops save-page-now-batch --json '{"file":"/home/me/lists/posts.json","evidence":"/home/me/evidence/posts"}'`<br>`pnpm ops save-page-now-batch --json '{"batch":"spn-0123456789ab"}'` |
| `archive-lookup` | archive-lookup answers the copies of a page each archive source holds: {"url"} (the page's own URL), "source"?: "wayback" \| "archive.today" (default both), "limit"?: 50 per source (at most 500) -> {url, found, sources: \[{source, label, ok, captures: \[{source, captureTs, originalUrl, mementoUrl, status?, mimetype?}\], refusal?, error?}\]}, oldest first. Each source through its own paced client; one that refuses is its own entry's sentence (refusal "excluded": excluded from the Wayback Machine (cause unknown); "challenge"; "rate-limited"). Read only. wayback-lookup stays. | `pnpm ops archive-lookup --json '{"url":"https://blog.example/a-post.html"}'` |
| `x-search-lead` | x-search-lead acts on one lead of an X search channel (the accounts its posts came from — `get channel <slug> --leads [--limit <n>]` lists them, most matches first): {"slug", "handle", "action": "archive" \| "never" \| "restore"}. "archive" creates <handle>-x, an X channel on NO site, by the New channel form's path and starts its first post fetch ("fetch": false skips it; "name"? names it; "dryRun" answers the fields and creates nothing) -> {slug, jobIds}. Refused: not an X search channel, an account an X channel archives already, a slug taken. "never" hides the handle (the channel's xSearch.exclude), "restore" un-hides it -> {exclude, changed}. No model, no request but the new channel's fetch. | `pnpm ops x-search-lead --json '{"slug":"demo-search","handle":"example","action":"archive","dryRun":true}'`<br>`pnpm ops x-search-lead --json '{"slug":"demo-search","handle":"example","action":"never"}'` |
-| `read-x-trending` | read-x-trending reads ONE X trending page into an X trending library: {"slug", "url": "https://x.com/i/trending/<number>"}, as one job on X's queue (the fresh-jar rule, the X alert and X's job gap apply; ask get x-session first). The page is opened in the connected X profile's browser, every GraphQL answer the page itself fetched is saved raw with a screenshot (channels/<slug>/trending/reads/<readId>/), and the posts are parsed from the saved file and written as the library's posts. A read lists posts; it archives no media and no thread. "topic": a topic's id or name, or a new one's name (absent: the topic this page was read into before, else a new one named for it). "scrolls": 1-20 moves to the bottom of the page (default: the channel's cap, else 8); "posts": stop once 1-200 are seen (else 60); a read also stops after two scrolls with nothing new, and at once on a 429 or a login wall — nothing retries. "probe": true saves the capture and its summary and writes no post. "headed": true opens a window on the editor's desktop. {"slug", "reparse": "<readId>"} parses a saved read again OFFLINE (X is asked nothing; no fresh jar needed). --wait prints the log's @@read-x-trending {ok, mode, read, outcome, stop, responses, operations (names and sizes, never a body), posts: {onPage, added}, topic, sentence}; a capture with no post the parser knows ends ok, "read saved, nothing recognised". Refused before a job: not a library, not a trending page URL, a cap out of range, no connected X profile, X's Connect or Refresh in flight, a stale jar. A library is made with create-channel, "platform": "x-trending" (no "url", no "sites": it is private, never on a site, in no index build; "xTrendingMaxScrolls"?, "xTrendingMaxPosts"? set its caps). | `pnpm ops read-x-trending --json '{"slug":"trending","url":"https://x.com/i/trending/1900000000000000001","probe":true}' --wait`<br>`pnpm ops read-x-trending --json '{"slug":"trending","url":"https://x.com/i/trending/1900000000000000001","topic":"Kettle festival"}' --wait`<br>`pnpm ops read-x-trending --json '{"slug":"trending","reparse":"tr-01JA0000000000000000000000"}' --wait` |
+| `read-x-trending` | read-x-trending reads ONE X trending page into an X trending library: {"slug", "url": "https://x.com/i/trending/<number>"}, as one job on X's queue (the fresh-jar rule, the X alert and X's job gap apply; ask get x-session first). The page is opened in the connected X profile's browser, every GraphQL answer the page itself fetched is saved raw with a screenshot (channels/<slug>/trending/reads/<readId>/), and the posts are parsed from the saved file and written as the library's posts. A read lists posts; it archives no media and no thread. "topic": a topic's id or name, or a new one's name (absent: the topic this page was read into before, else a new one named for it). "scrolls": 1-20 moves to the bottom of the page (default: the channel's cap, else 8); "posts": stop once 1-200 are seen (else 60); a read also stops after two scrolls with nothing new, and at once on a 429, a 403 or a login wall. A 429 leaves X alone for 15 minutes (no read is queued or started before the time its sentence names); a page that stops answering ends the read within 6 minutes. Nothing retries. "probe": true saves the capture and its summary and writes no post. "headed": true opens a window on the editor's desktop. {"slug", "reparse": "<readId>"} parses a saved read again OFFLINE (X is asked nothing; a read left with no record takes "url" too). No fresh jar needed. --wait prints the log's @@read-x-trending {ok, mode, read, outcome, stop, responses, operations (names and sizes, never a body), posts: {onPage, added}, topic, sentence}; a capture with no post the parser knows ends ok, "read saved, nothing recognised". Refused before a job: not a library, not a trending page URL, a cap out of range, no connected X profile, X's Connect or Refresh in flight, a stale jar. A library is made with create-channel, "platform": "x-trending" (no "url", no "sites": it is private, never on a site, in no index build; "xTrendingMaxScrolls"?, "xTrendingMaxPosts"? set its caps). | `pnpm ops read-x-trending --json '{"slug":"trending","url":"https://x.com/i/trending/1900000000000000001","probe":true}' --wait`<br>`pnpm ops read-x-trending --json '{"slug":"trending","url":"https://x.com/i/trending/1900000000000000001","topic":"Kettle festival"}' --wait`<br>`pnpm ops read-x-trending --json '{"slug":"trending","reparse":"tr-01JA0000000000000000000000"}' --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) -> {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. A URL the Wayback Machine answers 403 for is excluded: HTTP 403, "refusal": "excluded" ("excluded from the Wayback Machine (cause unknown)"). | `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, as a find-copy job: {"article"} \| {"articles": true} \| {"siteId"}, "dryRun"?, "retryFailed"? -> {jobId}. Per YouTube recording, one at a time: the Wayback Machine when it holds the video (the check yt-dlp makes, not a capture of the page), then archive.org (a mirror of the upload: its identifier, a file name or its original URL names the id, and the file has the recording's length). A copy a fetch failed from at its source (404, 410, 403, unreachable; never our own format selector) is not picked again, unless "retryFailed": true. A copy's windows are cut with a lenient selector (a direct file of unknown height: then the best single file). 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". The log ends with @@find-copy {recordings: \[{slug, id, gone, watchUrl, youtubeId, windows, failedBefore, tried, copy?, outcome}\], items, stopped?, fetchJobId?, refused?}. dryRun looks and starts no fetch; a cancelled job starts none. The scope mode (release 31): {"slug"} \| {"siteId"}, "gone": "no-transcript" \| "all", "dryRun"?, "max"? (10, at most 200), "retryFailed"? -> {jobId}. Every gone (deleted or private) video of the channel, or of the site's channels, that holds no audio or video ("no-transcript": and no transcript; "all": the transcribed ones too, after) is looked for the same way, at most max per run; a video whose last copy attempt found none or failed in the last 30 days is left out unless "retryFailed". Each copy's WHOLE audio is fetched into the video's own record (audio.<fmt>; its metadata stays the original's, the copy is in wayback.json or archiveorg.json and copy-attempts.json) by ONE fetch-copies job on archive.org's download queue, one at a time; the transcription lane then transcribes it like any downloaded audio. A video neither source holds is recorded none-found. dryRun asks the same (paced) questions and records and fetches nothing. The log ends with @@find-copy {scope, gone, dryRun, max, channels, eligible, skipped, looked: \[{slug, id, gone, noTranscript, watchUrl, youtubeId, tried, copy?, via?, outcome}\], left, items, stopped?, fetchJobId?, refused?}. The page mode (release 37): {"article"} \| {"articles": true} \| {"siteId"}, "pages": true, "channel"?, "max"? (10, at most 100), "dryRun"? -> {jobId}. Every page a report cites ("page" citations) whose original is gone at its own site gets the Wayback capture nearest the citation's date (one CDX lookup) imported into the Wayback pages channel named, else the one whose targets cover the page; a cited page record whose original is gone has its capture imported again when it is not stored. A live page is left (save-page-now it). The answer names the record each citation should cite (pointTo) and the citation as a post citation of it (as); the report is not rewritten. A find-copy job on the archive.org queue; dryRun asks the same paced questions and imports nothing. The log ends with @@find-copy {host, dryRun, max, pages, posts, items: \[{citedBy, url, original, channel?, capture?, outcome, detail, pointTo?, as?, records?}\], left, stopped?}. | `pnpm ops find-copy --json '{"article":"demo-article","dryRun":true}'`<br>`pnpm ops find-copy --json '{"article":"demo-article"}' --wait`<br>`pnpm ops find-copy --json '{"article":"demo-article","retryFailed":true}' --wait`<br>`pnpm ops find-copy --json '{"siteId":"demo-site","gone":"no-transcript","dryRun":true}' --wait`<br>`pnpm ops find-copy --json '{"slug":"demo-channel","gone":"all","max":5}' --wait`<br>`pnpm ops find-copy --json '{"article":"demo-article","pages":true,"dryRun":true}' --wait`<br>`pnpm ops find-copy --json '{"siteId":"demo-site","pages":true,"channel":"demo-pages"}' --wait` |
| `wayback-scan` | wayback-scan lists the Wayback Machine's captures of a Wayback pages channel's targets (config wayback.targets) into its wayback-scan.json, as a wayback-scan job on archive.org's queue: {"slug", "dryRun"?, "maxRows"? (50000, at most 200000), "full"?} -> {jobId}. The CDX API per target (its matchType exact \| prefix \| host \| domain, status 200, its mimes — text/html unless it names text/plain or application/json — collapse=digest, its from/to), in pages of 5,000 with a resume key; obvious assets (css, js, images, fonts) dropped unless the target's include names them. One row per distinct (URL, digest) with first/last seen. No bodies: import-page fetches a capture. A run cut short (the row cap, a refusal, a drain) keeps each target's resume key and the next continues; once every target is complete the next run is a new pass, from 30 days before the last began, and what it adds is marked new; "full" starts a new pass from each target's start. Paced as archive.org asks (one at a time, 2 s apart, 429/503 waited out; a refusal stops the job). dryRun asks nothing and writes nothing: it logs the next request per target. The log ends with @@wayback-scan {slug, dryRun, pass, newPass, targets: \[{url, match, requests, rows, added, complete, resumeKey?, next?}\], requests, rowsRead, added, totalRows, complete, stopped?, error?}. | `pnpm ops wayback-scan --json '{"slug":"demo-pages","dryRun":true}' --wait`<br>`pnpm ops wayback-scan --json '{"slug":"demo-pages"}' --wait` |
diff --git a/OPERATING.md b/OPERATING.md
@@ -637,7 +637,19 @@ pnpm ops get trending trending --topic kettle-festival --limit 50
and no index build reads it. So its posts are in no site, hub, `corpus.json`, `llms.txt` or MCP corpus tool, and
not in the editor's own search either. The channel page's **Topics**, `get trending` and the MCP's
`x_trending_topics` / `x_trending_posts` read the library's own files. A library stays one: Configure can neither
- make a library nor turn one into an ordinary channel.
+ make a library nor turn one into an ordinary channel, and no patch changes its platform, kind or URL.
+- **No report, article, draft or video project is offered a library's posts.** The posts are kept in
+ `channels/<slug>/trending/posts/` (a posts channel's format, one directory down), not in `channels/<slug>/posts/`
+ where every other reader of a posts channel looks: reports and drafts, research runs, the availability checks,
+ umtool's post search, Add posts and reels. To all of those a library has no posts. An article or a site report
+ that cites a library by name is refused (`"<slug>" is an X trending library: it is private, and a report cannot
+ cite its posts`), a draft's X link never resolves to a library, and a research run is not shown one.
+- **The raw captures never leave the machine.** `channels/<slug>/trending/reads/.gitignore` ignores everything
+ under it, so the corpus's own git repo never commits a capture. No Archilyzer path copies them anywhere: the
+ media moves (the Storage panel, `/storage`) move `media/` only, the saved-video backup covers the saved-video
+ store, the transcript archives read `data/`, and the source mirror publishes this code repo, not the corpus.
+ Nothing in Archilyzer commits or pushes the corpus repo; a backup you run yourself over `transcripts/` is yours
+ to point away from `trending/reads/`.
- **One page is one job on X's queue** (`read-x-trending`): the fresh-jar rule, the X alert and X's 5-minute job
gap apply as to every X job. The page is opened in the connected X profile's browser (headless; `"headed": true`
opens a window on the editor's desktop), and what the page itself fetches is kept: every GraphQL JSON answer, raw,
@@ -647,7 +659,10 @@ pnpm ops get trending trending --topic kettle-festival --limit 50
- **What a read costs**: one page load, the page's own first requests, and at most one more page of its timeline per
scroll. A scroll moves to the bottom of what has loaded, then waits 4–10 s. It stops at the scroll cap
(`"scrolls"`, 1–20, default 8), at the post cap (`"posts"`, 1–200, default 60), after two scrolls that brought
- nothing new, and at once on a 429, a 401 or X's login page. Nothing retries. The channel's own caps are
+ nothing new, and at once on a 429, a 403, a 401 or X's login page. Nothing retries.
+- **A read cannot hang.** The page's load has 75 s; a scroll, the address and the screenshot 20 s each; closing
+ the browser 10 s (then it is killed); the whole read 6 minutes. Past any of them the read fails with a sentence,
+ the browser closed and the capture kept. The channel's own caps are
`xTrendingMaxScrolls` / `xTrendingMaxPosts` (Configure, or `channel-config`).
- **A read lists posts**: the post's words, author, date and its media by kind, parsed from the saved file and
written as the library's posts. It fetches no media, no thread and no screenshot of a post. A re-read of the same
@@ -657,18 +672,28 @@ pnpm ops get trending trending --topic kettle-festival --limit 50
already in a topic stays there.
- **`"probe": true`** saves the capture and a summary (the operations' names and sizes, how many posts the parser
finds) and writes no post. `{"reparse": "<readId>"}` parses a saved capture again, offline, as a
- `reparse-x-trending` job: X is asked nothing, so it needs no fresh jar.
+ `reparse-x-trending` job: X is asked nothing, so it needs no fresh jar. `read.json` is written when a read
+ starts and again when it ends, so any capture can be parsed again; one left with its answers and no record
+ takes `"url"` beside `"reparse"` to say which page it was.
- **How a read ends**, in the job's last line (`@@read-x-trending {…, "sentence"}`):
- `Read …: N posts on the page, M new, in topic "…"`.
- `Read saved, nothing recognised: …`: the answers held no post the parser knows. Not a failure, no X alert; the
capture is kept for the parser.
- `X asked to log in instead of showing the trending page …`: fails, no post written, and X's cookie alert goes
up (no X job starts until it is cleared).
- - `X answered 429 (rate limit) …`: fails, the posts read before it kept, no alert.
- - `X no longer has this trending page …` and `The trending page could not be loaded: …`: fail, capture kept.
+ - `X answered 429 (rate limit) …`: fails, the posts read before it kept, no alert. X is then left alone for 15
+ minutes: no trending read is queued or started before the time the sentence names (the `twitter` platform
+ cooldown, the one import-post respects). A clean read clears it.
+ - `X answered 403 (forbidden) …`: fails at once, the posts read before it kept. No login alert, unless the page
+ also showed the login wall.
+ - `The page was read and saved (…), but its posts could not be written: …`: fails; reparse the read.
+ - `X no longer has this trending page …`, `The trending page could not be loaded: …` and `The trending page
+ stopped answering: …`: fail, capture kept.
- **One browser on the X profile at a time.** While a `read-x-trending` or `capture-posts` job is running on X's
- queue, X's Connect and Refresh cookies are refused with a sentence naming the job; while a Connect or Refresh is
- running, a read is refused. Refresh the cookies first, then read.
+ queue, X's Connect and Refresh cookies are refused with a sentence naming the job ("Cancel it on /jobs or wait
+ for it to finish"); a job that is only queued blocks nothing. While a Connect or Refresh is running, a trending
+ read is refused (when asked and again when it starts) and an X post capture fails at its start with the same
+ sentence. Refresh the cookies first, then read.
## Transcribe
diff --git a/common/controller/xTrendingCooldown.test.ts b/common/controller/xTrendingCooldown.test.ts
@@ -0,0 +1,42 @@
+// X's cooldown after a trending read met a rate limit (lane x-trending, review
+// 1 SHOULD 5), on the real state file of a temp corpus: 15 minutes on the
+// `twitter` platform entry, read back by the read's own held check.
+//
+// Run with: pnpm --filter yt-dlp-transcript-common exec tsx --test controller/xTrendingCooldown.test.ts
+
+import { after, test } from "node:test";
+import assert from "node:assert/strict";
+import { mkdtempSync, rmSync, writeFileSync } from "node:fs";
+import { tmpdir } from "node:os";
+import path from "node:path";
+
+const ROOT = mkdtempSync(path.join(tmpdir(), "x-trending-cooldown-"));
+Object.assign(process.env, { TRANSCRIPTS_DIR: path.join(ROOT, "transcripts"), SETTINGS_FILE: path.join(ROOT, "settings.json") });
+writeFileSync(path.join(ROOT, "settings.json"), "{}");
+after(() => rmSync(ROOT, { recursive: true, force: true }));
+
+const { getPaths } = await import("../lib/paths");
+const { platformCooldownRemainingMs, recordPlatformClean, recordPlatformCooldown } = await import("../jobs/downloadBackoff");
+const { X_RATE_LIMIT_HOLD_MS, xTrendingHeld } = await import("./readXTrending");
+
+test("no cooldown: a read may start; after a 429: refused until the minute it names; a clean answer settles it", async () => {
+ const paths = getPaths();
+ assert.equal(await xTrendingHeld(paths), null);
+ const now = Date.now();
+ const until = await recordPlatformCooldown("twitter", X_RATE_LIMIT_HOLD_MS, paths, now);
+ assert.equal(until, now + 15 * 60_000);
+ const left = await platformCooldownRemainingMs("twitter", paths);
+ assert.ok(left > 14 * 60_000 && left <= 15 * 60_000, String(left));
+ const held = await xTrendingHeld(paths, now);
+ assert.match(
+ held ?? "",
+ /^X answered a rate limit \(429\) a short while ago: no trending read starts before \d\d:\d\d UTC \(15 min from now\)\. Ask again then; nothing retries by itself\.$/,
+ );
+ assert.ok(held!.includes(new Date(until).toISOString().slice(11, 16)));
+ // Another platform is not held by it.
+ assert.equal(await platformCooldownRemainingMs("bluesky", paths), 0);
+ // A second, shorter cooldown never brings the end forward.
+ assert.equal(await recordPlatformCooldown("twitter", 60_000, paths, now), until);
+ await recordPlatformClean("twitter", paths);
+ assert.equal(await xTrendingHeld(paths), null);
+});
diff --git a/common/lib/channelConfig.ts b/common/lib/channelConfig.ts
@@ -402,7 +402,7 @@ export const CHANNEL_CONFIG_FIELD_DOCS: FieldDocs<ChannelConfig> = {
xSearch:
'An X SEARCH channel (platform `"twitter"`, `sourceKind` `"social"`, `url` the search page): a saved X search across accounts, its records the matching posts from ANY author. `{query, since?, until?, windowMonths?, lang?, exclude?}` — `query` as X\'s search box takes it (words, `"phrases"`, `OR`, `-term`, `from:`, `to:`, `@mention`, `url:`, `filter:`, `lang:` pass through; `since:`, `until:` and `max_id:` are refused — the walk adds them); `since`/`until` the days walked between (YYYY-MM-DD; `since` inclusive, `until` exclusive; absent `until` = tomorrow, and each later fetch searches what is new); `windowMonths` each search window\'s span (1–12, default 3); `lang` a language code added as `lang:<code>`; `exclude` the handles **Never archive** hid from the leads view (lower case). A fetch walks the windows newest first through gallery-dl\'s search, resumable, at the older walk\'s pace and with its login (OPERATING.md, "X search"). Never on a site. An object without a valid query is dropped.',
xTrending:
- 'An X TRENDING LIBRARY (platform `"twitter"`, `sourceKind` `"social"`, no `url`): a PRIVATE posts channel whose records are the posts X\'s trending pages (`x.com/i/trending/<id>`) showed, from ANY author, read one page at a time by `pnpm ops read-x-trending` and grouped into topics (`channels/<slug>/trending/`). `{maxScrolls?, maxPosts?}` — the caps a read uses when the ask names none (1–20 scrolls, default 8; 1–200 posts, default 60); `{}` is a library with the defaults. Never on a site (refused on create, on Configure and by every site writer), in no index build (so not in the editor\'s own search either), never synced. Set by creating a channel with platform `x-trending`; not a Configure field.',
+ 'An X TRENDING LIBRARY (platform `"twitter"`, `sourceKind` `"social"`, no `url`): a PRIVATE posts channel whose records are the posts X\'s trending pages (`x.com/i/trending/<id>`) showed, from ANY author, read one page at a time by `pnpm ops read-x-trending` and grouped into topics. Everything of it — its posts too — is kept under `channels/<slug>/trending/`, not in `channels/<slug>/posts/`, so no reader of a posts channel finds them. The marker alone makes a channel a library. `{maxScrolls?, maxPosts?}` — the caps a read uses when the ask names none (1–20 scrolls, default 8; 1–200 posts, default 60); `{}` is a library with the defaults. Never on a site (refused on create, on Configure and by every site writer), in no index build (so not in the editor\'s own search either), never synced. Set by creating a channel with platform `x-trending`; not a Configure field.',
localMedia:
"Opt-in external MP4 library: {sourceId, directory, playback?}. The sourceId is a stable lowercase identifier; directory is an absolute server/container path. Source files remain externally owned. Playback is off unless explicitly true, and this flag alone does not authorize public serving. Removing or changing configuration must never move or delete source files. Do not reuse an existing sourceId for a different library; reconcile references explicitly. Private configuration: never include source paths in public exports.",
};
diff --git a/editor/CHANGELOG.md b/editor/CHANGELOG.md
@@ -20,9 +20,18 @@
capture again without asking X.
- A capture the parser finds no post in ends "Read saved, nothing recognised", with the capture kept. It is not a
failure and raises no alert.
+ - No report, article, draft or video project is offered a library's posts. They are kept in
+ `channels/<slug>/trending/posts/`, not where a posts channel keeps its posts, so every other reader finds a
+ library empty; an article or report that cites a library is refused, and a draft's X link never resolves to one.
+ - A read cannot hang: the load has 75 s, each scroll 20 s, the whole read 6 minutes, and the browser is closed or
+ killed. A 429 leaves X alone for 15 minutes (the sentence says until when); a 403 stops the read at once with
+ its own sentence and no login alert.
+ - The raw captures are never committed: `trending/reads/.gitignore` ignores everything under it.
- **X's Connect and Refresh cookies say when a job is using the profile.** While a trending-page read or a post
- capture is running on X's queue, a press is refused with a sentence that names the job, and a trending-page read is
- refused while a Connect or Refresh is running. Before, the second browser failed with Chromium's own error.
+ capture is running on X's queue, a press is refused with a sentence that names the job and says to cancel it on
+ /jobs or wait; a queued job blocks nothing. A trending-page read is refused while a Connect or Refresh is running,
+ and an X post capture that starts during one fails with the same sentence. Before, the second browser failed with
+ Chromium's own error.
- **Fetch posts on an X trending library is refused with a sentence**, and the X run does not list a library.
- **Connect X account, Connect archive session and Connect forum session open their window even when the editor
started before the desktop.** The editor runs as a user service that starts at boot, so it had no display, and every
diff --git a/editor/app/channels/[slug]/socialActions.ts b/editor/app/channels/[slug]/socialActions.ts
@@ -42,6 +42,7 @@ import {
retryOnBlockProblem,
type RetryOnBlock,
} from "yt-dlp-transcript-common/lib/forumWalk";
+import { xProfileStartRefusal } from "../../lib/cookieRefreshGuard";
import { saveSettings } from "../../settings/saveSettings";
import { isUtcDay } from "yt-dlp-transcript-common/social/olderBackfill";
import {
@@ -409,6 +410,11 @@ export async function capturePostsAction(
},
},
fn: async (onLog, signal, _progress, ctx) => {
+ // One browser on the X profile at a time (lib/cookieRefreshGuard.ts): an
+ // X capture that starts while X's Connect or Refresh holds the profile
+ // fails with a sentence instead of with Chromium's profile-lock error.
+ const profileHeld = xProfileStartRefusal(key, "capture these posts");
+ if (profileHeld) throw new Error(profileHeld);
const result = await capturePosts({
paths,
slug,
diff --git a/editor/app/channels/[slug]/xTrendingActions.ts b/editor/app/channels/[slug]/xTrendingActions.ts
@@ -72,7 +72,7 @@ export async function readXTrendingAction(ask: ReadXTrendingAsk): Promise<Stream
onLog,
signal,
deps: {
- profileBusy: xPressInFlight,
+ profileBusy: () => xPressInFlight(),
...(chromium ? { chromium, pauseMs: () => 50 } : {}),
},
}),
diff --git a/editor/app/lib/cookieRefreshGuard.test.ts b/editor/app/lib/cookieRefreshGuard.test.ts
@@ -155,7 +155,7 @@ test("X's Connect and Refresh are refused while a job holds the profile's browse
busy: true,
error:
"X's connect opens the connected profile, and a job is using it: Read X trending page (J1, running since 10:02:11 UTC). " +
- "Wait for it to finish, then press again.",
+ "Cancel it on /jobs or wait for it to finish, then press again.",
});
const refresh = await press("x", "refresh", capturing as never);
assert.match((refresh as { error: string }).error, /^X's refresh opens the connected profile, and a job is using it: Capture posts \(J2,/);
@@ -187,9 +187,27 @@ test("a trending read is refused while X's Connect or Refresh is in flight, and
xPressInFlight() ?? "",
/^X's connect is running \(since \d\d:\d\d:\d\d UTC\) and holds the connected profile: read the trending page once it has finished\.$/,
);
+ // The same at a job's start, for both kinds that open the profile — on X's
+ // queue only: a capture on another platform's queue opens no X profile.
+ const { xProfileStartRefusal } = await import("./cookieRefreshGuard");
+ assert.match(
+ xProfileStartRefusal("platform:twitter", "capture these posts") ?? "",
+ /^X's connect is running \(since \d\d:\d\d:\d\d UTC\) and holds the connected profile: capture these posts once it has finished\.$/,
+ );
+ assert.match(xProfileStartRefusal("platform:twitter", "read the trending page") ?? "", /read the trending page once it has finished/);
+ assert.equal(xProfileStartRefusal("platform:bluesky", "capture these posts"), null);
+ assert.equal(xProfileStartRefusal("platform:xenforo", "capture these posts"), null);
release();
await connecting;
assert.equal(xPressInFlight(), null);
+ assert.equal(xProfileStartRefusal("platform:twitter", "capture these posts"), null);
+ // A Refresh holds it as a Connect does.
+ let done!: () => void;
+ const hold = new Promise<void>((r) => (done = r));
+ const refreshing = withCookieAction("x", "refresh", async () => { await hold; return { ok: true as const }; }, () => ({ ok: true, message: "Cookies refreshed." }), { paths, jobs: noJobs });
+ assert.match(xProfileStartRefusal("platform:twitter", "capture these posts") ?? "", /^X's refresh is running/);
+ done();
+ await refreshing;
// A recheck of X opens no profile: a read is not held by it.
let free!: () => void;
const wait = new Promise<void>((r) => (free = r));
diff --git a/editor/app/lib/cookieRefreshGuard.ts b/editor/app/lib/cookieRefreshGuard.ts
@@ -19,8 +19,9 @@
// X's queue already keeps one at a time among themselves. Two browsers on one
// profile is a launch that fails with Chromium's own error, so each side is
// refused with a sentence instead: a Connect or Refresh while such a job is
-// RUNNING (`xProfileJobRunning`), and the trending read while a Connect or
-// Refresh is in flight (`xPressInFlight`, asked at enqueue and at its start).
+// RUNNING (`xProfileJobRunning`; a queued one blocks nothing), and such a job
+// while a Connect or Refresh is in flight (`xPressInFlight`: the trending read
+// at enqueue and at its start, a post capture at its start).
// Nothing else about Connect or Refresh changes.
//
// The mark lives on globalThis (one per server process, like the registry).
@@ -80,21 +81,27 @@ export function xProfileJobRunning(
export function xProfileJobSentence(action: string, job: { kind: string; since: string; jobId: string }): string {
return (
`X's ${action} opens the connected profile, and a job is using it: ${jobKindLabel(job.kind)} ` +
- `(${job.jobId}, running since ${job.since.slice(11, 19)} UTC). Wait for it to finish, then press again.`
+ `(${job.jobId}, running since ${job.since.slice(11, 19)} UTC). Cancel it on /jobs or wait for it to finish, then press again.`
);
}
// Why a job may not open the X profile now — a Connect or a Refresh of X is
// in flight — or null. (A recheck opens no profile.)
-export function xPressInFlight(): string | null {
+export function xPressInFlight(what = "read the trending page"): string | null {
const r = inflight().get("x");
if (!r || (r.action !== "connect" && r.action !== "refresh")) return null;
return (
`X's ${r.action} is running (since ${r.since.slice(11, 19)} UTC) and holds the connected profile: ` +
- `read the trending page once it has finished.`
+ `${what} once it has finished.`
);
}
+// The same, asked by a job as it STARTS: only a job on X's queue opens the X
+// profile (a capture of Bluesky or forum posts does not).
+export function xProfileStartRefusal(queueKey: string, what: string): string | null {
+ return queueKey === X_TRENDING_QUEUE ? xPressInFlight(what) : null;
+}
+
export function busySentence(service: string, r: CookieRunning): string {
return `${serviceLabel(service)}'s ${r.action} is already running (since ${r.since.slice(11, 19)} UTC) — wait for it to finish.`;
}
diff --git a/editor/e2e/x-trending.spec.ts b/editor/e2e/x-trending.spec.ts
@@ -95,8 +95,11 @@ test("an X trending library: the form, one read, the library by topic, the listi
// What the read left: the raw answers, a screenshot, a record with names and sizes only.
const readsDir = t(`channels/${SLUG}/trending/reads`);
- await expect.poll(async () => (await readdir(readsDir).catch(() => [])).length, { timeout: 15_000 }).toBe(1);
- const [readId] = await readdir(readsDir);
+ const reads = async () => (await readdir(readsDir).catch(() => [] as string[])).filter((n) => n.startsWith("tr-"));
+ await expect.poll(async () => (await reads()).length, { timeout: 15_000 }).toBe(1);
+ const [readId] = await reads();
+ // The captures are never committed: the reads directory ignores everything under it.
+ expect(await readFile(`${readsDir}/.gitignore`, "utf8")).toMatch(/^\*$/m);
expect(readId).toMatch(/^tr-[0-9A-Z]{26}$/);
await expect
.poll(async () => (await readdir(`${readsDir}/${readId}`)).sort(), { timeout: 15_000 })
@@ -164,7 +167,7 @@ test("an X trending library: the form, one read, the library by topic, the listi
});
expect(stale.status()).toBe(400);
expect(((await stale.json()) as { error: string }).error).toMatch(/^X cookies were last refreshed 2 h ago \(limit 60 min\)/);
- expect((await readdir(readsDir)).length).toBe(1);
+ expect((await reads()).length).toBe(1);
expect(await archiveLines()).toBe(4);
// Where every other reader of a posts channel looks, the library has nothing.
expect(await pathExists(rel(`channels/${SLUG}/posts`))).toBe(false);
diff --git a/scripts/archilyzer-ops.mjs b/scripts/archilyzer-ops.mjs
@@ -1891,11 +1891,15 @@ export function usage() {
" read into before, else a new one named for it). \"scrolls\": 1-20 moves",
" to the bottom of the page (default: the channel's cap, else 8);",
" \"posts\": stop once 1-200 are seen (else 60); a read also stops after two",
- " scrolls with nothing new, and at once on a 429 or a login wall — nothing",
- " retries. \"probe\": true saves the capture and its summary and writes no",
+ " scrolls with nothing new, and at once on a 429, a 403 or a login wall.",
+ " A 429 leaves X alone for 15 minutes (no read is queued or started",
+ " before the time its sentence names); a page that stops answering ends",
+ " the read within 6 minutes. Nothing retries.",
+ " \"probe\": true saves the capture and its summary and writes no",
" post. \"headed\": true opens a window on the editor's desktop. {\"slug\",",
" \"reparse\": \"<readId>\"} parses a saved read again OFFLINE (X is asked",
- " nothing; no fresh jar needed). --wait prints the log's @@read-x-trending",
+ " nothing; a read left with no record takes \"url\" too).",
+ " No fresh jar needed. --wait prints the log's @@read-x-trending",
" {ok, mode, read, outcome, stop, responses, operations (names and sizes,",
" never a body), posts: {onPage, added}, topic, sentence}; a capture with",
" no post the parser knows ends ok, \"read saved, nothing recognised\".",