Archilyzer · Source

archilyzer

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

commit 2723fa73983b83e87014073a0bf45f72c35406dc
parent 4e6077b3b94ddfdf9f948c9d44604454bfcc71c2
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Wed, 18 Nov 2026 14:23:22 -0500

docs: Instagram accounts in the operating guide, the channel and settings tables, the ops help and the changelog

OPERATING.md says what an Instagram channel is, what a run costs, where its
login comes from and what stops it; CHANNEL.md, SETTINGS.md and COMMANDS.md are
regenerated from the schema and the help (posts-media is not in the media tier,
and the guide says so). Under the test server the played-back media CDN has no
pause between two files.

Co-Authored-By: Claude <noreply@anthropic.com>

Diffstat:
MCHANNEL.md | 8++++----
MCOMMANDS.md | 6+++---
MOPERATING.md | 52+++++++++++++++++++++++++++++++++++++++++++++++++---
MSETTINGS.md | 9+++++++++
Mcommon/controller/fetchPosts.ts | 6+++---
Mcommon/lib/channelConfig.ts | 8++++----
Mcommon/social/instagramMedia.test.ts | 4++++
Mcommon/social/instagramMedia.ts | 9+++++++++
Meditor/CHANGELOG.md | 15+++++++++++++++
Meditor/app/api/ops/fetch-posts/route.ts | 5+++++
Meditor/app/api/ops/recheck-service/route.ts | 5+++--
Meditor/e2e/instagram.spec.ts | 9++++++++-
Mscripts/archilyzer-ops.mjs | 20++++++++++++++++++--
13 files changed, 134 insertions(+), 22 deletions(-)

diff --git a/CHANNEL.md b/CHANNEL.md @@ -16,11 +16,11 @@ Regenerate this file with `pnpm --filter yt-dlp-transcript-common exec tsx bin/f |---|---|---| | `handling` | required | REQUIRED. `"youtube"` (fetch the platform's captions) or `"transcribe"` (download audio and transcribe it locally). A file without a valid `handling` is not a channel: it reads as null. | | `sourceKind` | config | What KIND of source this is: `"video"` (default — yt-dlp + transcription) or `"social"` (an account fetched into the posts corpus, skipped by the video scan). A separate axis from `handling`, so every binary handling branch stays binary. | -| `postFetcher` | config | Social channels only: which social fetcher drives ingest (e.g. `"bluesky-atproto"`, `"x-gallery-dl"`). Absent = resolve by URL detection. Trimmed. | +| `postFetcher` | config | Social channels only: which social fetcher drives ingest (e.g. `"bluesky-atproto"`, `"x-gallery-dl"`, `"instagram-gallery-dl"`). Absent = resolve by URL detection. Trimmed. | | `socialHandle` | config | Social channels only: the bare account handle (a leading "@" is stripped). Derived from `url` at creation but stored, so a later URL-format change upstream cannot silently re-point ingest at a different account. | | `postPagePauseSeconds` | config | Social channels that are read page by page (a forum thread) only: the pause between two page loads, in seconds; each pause is jittered to 0.85–1.65× of it. Absent = the fetcher's own (12 s, so 10–20 s); floored at 5, capped at 600. | | `postCaptureThread` | config | X channels only: `capture-posts` also shoots each reply's THREAD SHOT — the post it answers over the reply, `posts-media/<id>/shot-thread.png` beside `shot.png`, the parent's author blurred unless verified or the reply's own — unless the run says `"thread": false`. Absent = false (a run asks with `"thread": true`). | -| `platform` | config | The source platform: youtube, rumble, odysee, twitch, kick, archiveorg (archive.org items — imported, never listed; see README.md, "archive.org items"), bitchute (BitChute videos and channels; see README.md, "BitChute"), twitter, bluesky, xenforo (a forum thread) or webpage (Wayback Machine captures of pages; see `wayback`). An unknown value is dropped. | +| `platform` | config | The source platform: youtube, rumble, odysee, twitch, kick, archiveorg (archive.org items — imported, never listed; see README.md, "archive.org items"), bitchute (BitChute videos and channels; see README.md, "BitChute"), twitter, bluesky, xenforo (a forum thread), webpage (Wayback Machine captures of pages; see `wayback`) or instagram (an Instagram account's posts and reels; OPERATING.md, "Instagram accounts"). An unknown value is dropped. | | `name` | config | Display name. | | `url` | config | The channel / playlist / account URL syncs enumerate. Absent = the channel is never auto-synced. | | `audioFormat` | config | `"m4a"`, `"mp3"` or `"opus"`: the audio a transcribe-handling download keeps. | @@ -45,13 +45,13 @@ Regenerate this file with `pnpm --filter yt-dlp-transcript-common exec tsx bin/f | `excludeFromCleanup` | config | Leave this channel's reclaimable bytes out of the aggregate "cleanable data" total on /cleanup and its badge. The per-channel cleanup sweeps stay available; only the running total changes. | | `excludeFromCompaction` | config | Keep this channel's saved videos out of compaction (`compact-saved-videos`, a re-encode to AV1 that becomes the active copy): neither the selector nor an explicit list touches them. For a channel whose stored bytes are kept as evidence. Absent = false. | | `cleanAfterCaptureUnverified` | config | Let clean-after-capture (settings `diarization.cleanAfterCapture`) delete this channel's audio with NO availability check. Only for a channel with no `url`: with no source there is nothing to list, so the automatic per-video clean holds every such channel ("no source to check: clean by hand") unless this is true. The manual Clean audio sweep is unaffected. Absent/false = held. | -| `syncIntervalMinutes` | config | Auto-sync cadence: the scheduler syncs this channel when `now - lastSyncedAt >= syncIntervalMinutes`. Absent = inherit the global default; 0 = auto-sync off (still manually syncable); positives clamp to [1, 44640] (~31 days). A missing `url`, or a `sync` tier of paused in the channel-priority document, also disables auto-sync. | +| `syncIntervalMinutes` | config | Auto-sync cadence: the scheduler syncs this channel when `now - lastSyncedAt >= syncIntervalMinutes`. Absent = inherit the global default; 0 = auto-sync off (still manually syncable); positives clamp to [1, 44640] (~31 days). A missing `url`, or a `sync` tier of paused in the channel-priority document, also disables auto-sync. AN INSTAGRAM CHANNEL is synced seldom, because every sync is a logged-in read: absent = every 12 hours at the most often (the global default when that is longer), and a value of its own is never under 240 (4 hours); 0 still turns it off (`common/jobs/syncScheduler.ts`). | | `fullSweepIntervalMinutes` | config | Full-sweep cadence: a sync upgrades itself to a full sweep when `now - lastFullSweepAt >= fullSweepIntervalMinutes`. Absent = inherit `syncScheduler.fullSweepIntervalMinutes`; 0 = never sweep (every sync is a paged walk); positives clamp to [1, 44640]. | | `skipLiveDownloads` | config | Per-channel override for the global `skipLiveDownloads`. Absent = inherit; false = allow downloading currently-live / upcoming videos. | | `downloadMode` | config | `"auto"` (default) or `"manual"`. Manual: nothing is downloaded unasked — the download lane skips the channel, a sync or full sweep reads the listing (roster, `playlist`, maybe-missing) but downloads none of the new uploads it finds, and the batch downloads (Download from playlist, Download videos / `download-missing`, a bucket retry) refuse. What someone asks for still downloads: `import-video`, the video page's download and persist buttons, `persist-videos`, clip windows (`fetch-windows`), a whole-recording fetch; videos on disk are still transcribed by the lanes. The listed videos it never downloaded are reported as not requested (`manualNotRequestedIds` in its report), never as undownloaded work or as never-fetched losses. A Configure field (`downloadMode`). | | `downloadFilter` | config | Per-channel title/description download filter, matched against the per-video metadata prefetch. A declined video is SETTLED by a terminal download-outcome keyed on the filter's signature, not by an archive line, so changing either pattern re-evaluates every settled video on the next run. An object with no real rule is dropped (the filter is inert). See [`downloadFilter`](#downloadfilter). | | `skipShorts` | config | `true`: the channel's YouTube Shorts — the listing entries whose URL is `youtube.com/shorts/<id>` — are not wanted. Decided from the listing URL alone (no metadata): a sync or full sweep does not download them, Download from playlist, Download videos and the bucket retries skip them, the metadata scan does not read them, and the report lists the ones with nothing on disk as `skippedShortsIds` instead of as undownloaded work (or, once delisted, as never-fetched losses). Importing a Shorts URL still downloads it, and a Short already on disk stays an ordinary video. Absent = Shorts are downloaded like any upload. A Configure field (`skipShorts`). | -| `cookiesFromBrowser` | config | Per-channel override of the global cookies-from-browser spec (a browser spec, or `file:<path>` for a cookies.txt). Trimmed; blank = inherit. A `firefox[:profile]` spec also sends that Firefox's own User-Agent (derived, so a Cloudflare clearance it earned is honoured after a browser update); a `--user-agent` in `ytdlpExtraArgs` overrides it. | +| `cookiesFromBrowser` | config | Per-channel override of the global cookies-from-browser spec (a browser spec, or `file:<path>` for a cookies.txt). Trimmed; blank = inherit. A `firefox[:profile]` spec also sends that Firefox's own User-Agent (derived, so a Cloudflare clearance it earned is honoured after a browser update); a `--user-agent` in `ytdlpExtraArgs` overrides it. AN INSTAGRAM CHANNEL reads ONLY this, never the global spec: Instagram shows an account's posts only to a login, whose account is at risk of a checkpoint or a ban, so the source is chosen per channel — blank means nothing is fetched (`fetch-posts` refuses and says so). Name a browser profile or cookies file logged in to Instagram with an account kept for the archive. | | `cookieMode` | config | Per-channel override of the global cookie mode. Absent = inherit. | | `sleepBetweenDownloadsSeconds` | config | Per-channel override for the global pause between downloads. Absent = inherit; 0 = no sleep; floored and capped at 600. | | `audioCheck` | config | Audio-integrity checking for sources that intermittently serve corrupt audio mid-download: the managed downloader periodically validates the in-progress `.part` file and rolls back to the last known-good snapshot on corruption (transcribe handling), and a clip window gets the same final probe, fetched once more when malformed and never kept when malformed twice. ON BY DEFAULT for an Odysee video (`audioCheck: {"enabled": false}` turns it off); the channel's opt-in for any other platform. See [`audioCheck`](#audiocheck). | diff --git a/COMMANDS.md b/COMMANDS.md @@ -167,9 +167,9 @@ Drives a running editor over HTTP (`/api/ops/*`, the same actions its pages run) | `download-missing` | download-missing downloads every listed video the channel does not hold: {"slug"}. "ignoreArchive": true drops the download archive so listed videos it names are fetched again (recovery from a stale archive); "abortOnError": false carries on past a failure (default: stop at the first that is not one video's own). Paced on the platform's queue. "storedUrl": "fallback" \| "only" reads each video from the media URL its record stores when the page is rate-limited (or always), one file per 20 min; with one, a held platform's run goes ahead as "only". | | | `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. "corruptFullSource" downloads again: the kept file is set aside, and comes back if the download fails; malformed again, the longer decode stays. A record that stores an Odysee media URL is read from that URL (as "only") until 2 such downloads are on record, then from the page. "storedUrl": "fallback" \| "only" reads each from the media URL its record stores, as on download-missing (a held platform's retry runs as "only"). "corruptHeldAudio" (held audio the audio audit found damaged) is refetched the same way, with the audio check on; the new file is audited again. | `pnpm ops retry-bucket --json '{"slug":"demo-odysee","bucket":"corruptHeldAudio"}' --wait` | | `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"} is SYNC NEW — from the top of the timeline down to the newest archived post (a sync that stopped part-way continues down to the watermark it began with). It never reads or clears an unfinished backfill's resume point. "backfill": true is RESUME BACKFILL instead (the same as resume-backfill). "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). A forum thread keeps two positions: a run catches up from the last page, then continues the history where it stopped; "full": true is its full re-walk (every page, edits updated). "retryOnBlock": {"minutes": 30, "max": 12} (or true: the forum default in settings) waits out a challenge or refusal page and runs again, max tries in all. "full", "older" and "backfill" are one at a time. 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 of the same walk resumes there. | `pnpm ops fetch-posts --json '{"slug":"example-x"}' --wait` | +| `fetch-posts` | fetch-posts fetches a social channel's new posts: {"slug"} is SYNC NEW — from the top of the timeline down to the newest archived post (a sync that stopped part-way continues down to the watermark it began with). It never reads or clears an unfinished backfill's resume point. "backfill": true is RESUME BACKFILL instead (the same as resume-backfill). "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). A forum thread keeps two positions: a run catches up from the last page, then continues the history where it stopped; "full": true is its full re-walk (every page, edits updated). "retryOnBlock": {"minutes": 30, "max": 12} (or true: the forum default in settings) waits out a challenge or refusal page and runs again, max tries in all. "full", "older" and "backfill" are one at a time. An older walk over an account that shows no posts (nothing archived, and the last timeline fetch read none) is refused unless "force": true. AN INSTAGRAM CHANNEL: a sync reads ONE page (up to 30 posts), a first fetch, "full" or "backfill" walks up to 300 posts and the next run resumes; the new posts' pictures and videos are fetched in the same job (40 files / 200 MB a job, 100 MB a file; the rest is recorded as owed). Refused before a job exists when the channel has no cookiesFromBrowser of its own, and with "retryOnBlock" or "older". A login, challenge or checkpoint page raises Instagram's alert and refuses every Instagram job until recheck-service; the first 429 holds Instagram for an hour (clear-platform-hold {"platform": "instagram"} ends that by hand). A drained fetch stops at its next resume point and the next run of the same walk resumes there. | `pnpm ops fetch-posts --json '{"slug":"example-x"}' --wait` | | `resume-backfill` | resume-backfill continues a social channel's unfinished full-history timeline walk (X, Bluesky) from its saved resume point, with no watermark: {"slug"} ("limit"? caps the posts this run reads). The walk is left part-way by a first fetch, a full re-walk or a backfill that stopped; the channel page then says "backfill unfinished — N archived" and shows Resume backfill. Nothing resumes it but this (or fetch-posts "backfill": true): a plain fetch-posts, Sync and the scheduler sync new posts and keep its place. Refused when none is part-way, on a forum thread (every fetch catches up, then continues its history) and on an X search channel. | `pnpm ops resume-backfill --json '{"slug":"example-x"}' --wait` | -| `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. "thread": true (X; default the channel's postCaptureThread) also shoots each reply with the post it answers above it, as shot-thread.png beside shot.png (a post shot before gets only that); the replied-to author's avatar, name and handle are blurred unless verified or the reply's own. "threadRedact": false turns the blur off, true blurs any author; {"&lt;id&gt;": false} sets it per post. X also keeps each author's avatar, read off the page the shot loads (with "thread", the replied-to and quoted authors' too), in posts-media/\_avatars/&lt;handle&gt;.&lt;ext&gt; + avatars.json; an author already stored is not fetched again unless "force". "avatars": false turns that off. "avatarsOnly": true (X) loads ONE post page per distinct archived author for the avatars alone -- no shot, media, article or thread shot, no capture record, no availability: one author's avatar is {"slug", "ids": \["&lt;one of their post ids&gt;"\], "avatarsOnly": true}. X also reads each post's CONTEXT off the same page -- the post it quotes and the post it answers (its author, check, date, words, media links) -- into its capture.json's "context"; "context": false turns that off. "contextOnly": true (X) loads ONE page per post for that alone (and the avatars it shows): the context written into capture.json, nothing shot, no media, article, thread shot or availability; a post whose context is already read is skipped unless "force". Not with "avatarsOnly". Paced like a post fetch, on its queue. An X trending library is captured by this same job, under channels/&lt;slug&gt;/trending/posts-media/&lt;id&gt;/. Its media comes from X's media CDN by the addresses in the library's saved captures: no login, one file after another 1-2 s apart, under X's cooldown, each file kept once (trending/media-store/, a hardlink per post). A file over the library's maxVideoMb (100 MB) and whatever is past the job's budget (40 files / 200 MB) is owed: asked for again by the next capture of that post. A 429 from the CDN stops the job and leaves X alone for 15 minutes; a 403 or 404 marks the file; three refusals in a row (a 403, or no answer) and the job asks the CDN no more; nothing retries. "keptMedia": true is for posts marked keep (refused for any other id): no per-file cap, and a post the CDN cannot serve whole is downloaded the logged-in way, if it is still kept when that download would start. A library's capture runs on X's queue only: "queueKey" is refused for it. | | +| `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. An Instagram channel is refused: no screenshot is taken of an Instagram post, and its media come with the post, in the fetch-posts job. "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. "thread": true (X; default the channel's postCaptureThread) also shoots each reply with the post it answers above it, as shot-thread.png beside shot.png (a post shot before gets only that); the replied-to author's avatar, name and handle are blurred unless verified or the reply's own. "threadRedact": false turns the blur off, true blurs any author; {"&lt;id&gt;": false} sets it per post. X also keeps each author's avatar, read off the page the shot loads (with "thread", the replied-to and quoted authors' too), in posts-media/\_avatars/&lt;handle&gt;.&lt;ext&gt; + avatars.json; an author already stored is not fetched again unless "force". "avatars": false turns that off. "avatarsOnly": true (X) loads ONE post page per distinct archived author for the avatars alone -- no shot, media, article or thread shot, no capture record, no availability: one author's avatar is {"slug", "ids": \["&lt;one of their post ids&gt;"\], "avatarsOnly": true}. X also reads each post's CONTEXT off the same page -- the post it quotes and the post it answers (its author, check, date, words, media links) -- into its capture.json's "context"; "context": false turns that off. "contextOnly": true (X) loads ONE page per post for that alone (and the avatars it shows): the context written into capture.json, nothing shot, no media, article, thread shot or availability; a post whose context is already read is skipped unless "force". Not with "avatarsOnly". Paced like a post fetch, on its queue. An X trending library is captured by this same job, under channels/&lt;slug&gt;/trending/posts-media/&lt;id&gt;/. Its media comes from X's media CDN by the addresses in the library's saved captures: no login, one file after another 1-2 s apart, under X's cooldown, each file kept once (trending/media-store/, a hardlink per post). A file over the library's maxVideoMb (100 MB) and whatever is past the job's budget (40 files / 200 MB) is owed: asked for again by the next capture of that post. A 429 from the CDN stops the job and leaves X alone for 15 minutes; a 403 or 404 marks the file; three refusals in a row (a 403, or no answer) and the job asks the CDN no more; nothing retries. "keptMedia": true is for posts marked keep (refused for any other id): no per-file cap, and a post the CDN cannot serve whole is downloaded the logged-in way, if it is still kept when that download would start. A library's capture runs on X's queue only: "queueKey" is refused for it. | | | `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). | | @@ -196,7 +196,7 @@ Drives a running editor over HTTP (`/api/ops/*`, the same actions its pages run) | `voice-convert` | voice-convert keeps a recording's performance (timing, pitch contour) and swaps its timbre for a STOCK synthetic voice, as voice-enhance's job: the same body plus "voice" — "&lt;tts engine&gt;:&lt;stock voice&gt;" (orpheus:zac, orpheus:leah, kokoro:am\_michael, ...; settings.voice.convert.target); a file, a path or a recording is REFUSED as a target (no real person's voice) — and "engine" (openvoice \| seed-vc, each installed by `archilyzer voice setup --engine <id>`). "pitch" is where the result's pitch comes from (settings.voice.convert.pitch): "target" — the stock voice's own, the read's intonation flattened to it; "source" — the pitch the take was read at (raise your voice and it rises); "contour" — the read's rises and falls, moved as a whole to the stock voice's register. "semitones" (-12 to 12) then moves a followed pitch; left out, a followed pitch takes settings.voice.convert.semitones (0 unless set). source and contour are seed-vc's, on its optional f0 model (`archilyzer voice setup --engine seed-vc --with f0`; slower, 44.1 kHz); openvoice refuses them. The target's reference is synthesized once through the tts op and kept. The result adds target, voice, pitch (semitones and f0 — the medians heard and the move applied — when followed), synthetic: true and the disclosure line. | | | `settings` | settings patches settings.json through the editor's one writer: {"patch": {"&lt;top-level key&gt;": value, …}} (SETTINGS.md). A block's keys merge one level; an array, a scalar or an object nested in a block replaces. Refused before anything is written: an unknown key; a key another writer owns (channelPriority, autoQueue, workers, storage — the refusal names it); a value the schema would not keep as sent (clamped, dropped), named with what would be saved. Answers the saved values. | `pnpm ops settings --json '{"patch":{"diarization":{"cleanAfterCapture":true}}}'`<br>`pnpm ops settings --json '{"patch":{"minFreeDiskGB":20}}'` | | `clear-platform-hold` | clear-platform-hold clears a platform's rate-limit hold, backoff and raised pace, as the lane strip's Clear hold: {"platform"}. Answers the sentence. | | -| `recheck-service` | recheck-service asks a service whose cookie refresh alert is up ONE request through its own path, as the dashboard banner's Recheck: {"service"} ("rumble", "youtube", "odysee", "archive.today", "x" or a forum host). Waits for it: {jobId, result: "clean" \| "stale" \| "failed", message}; "clean" clears the alert (and a yt-dlp service's backoff, as any clean request). For "x" it sends X NO request: clean when the login on disk was renewed after the alert (Refresh cookies on /cookies) — for a jar-age alert, when the jar is within social.x.maxCookieAgeMinutes. The editor also rechecks by itself on a timer (settings.serviceCookies.recheckIntervalMinutes, default 180, 0 = off; `pnpm ops settings --json '{"patch":{"serviceCookies":{"recheckIntervalMinutes":0}}}'`). Asked while a recheck or another press for the service runs (a click, the dashboard's, the timer's): refused, 409 {busy: true}, never queued. dismiss-service clears a service's cookie alert by hand: {"service"}. rerun-service-jobs retries every job a service's cookie alert stopped, once it is OK again: {"service"} -&gt; {jobIds, skipped}. --wait follows them. | `pnpm ops recheck-service --json '{"service":"rumble"}'`<br>`pnpm ops recheck-service --json '{"service":"x"}'` | +| `recheck-service` | recheck-service asks a service whose cookie refresh alert is up ONE request through its own path, as the dashboard banner's Recheck: {"service"} ("rumble", "youtube", "odysee", "archive.today", "x", "instagram" or a forum host). Waits for it: {jobId, result: "clean" \| "stale" \| "failed", message}; "clean" clears the alert (and a yt-dlp service's backoff, as any clean request). For "x" it sends X NO request: clean when the login on disk was renewed after the alert (Refresh cookies on /cookies) — for a jar-age alert, when the jar is within social.x.maxCookieAgeMinutes. The For "instagram" it sends Instagram NO request either and is the operator's word that its check is passed: it clears the alert, and the next Instagram job raises it again if it was not. The timer never asks Instagram. The editor also rechecks by itself on a timer (settings.serviceCookies.recheckIntervalMinutes, default 180, 0 = off; `pnpm ops settings --json '{"patch":{"serviceCookies":{"recheckIntervalMinutes":0}}}'`). Asked while a recheck or another press for the service runs (a click, the dashboard's, the timer's): refused, 409 {busy: true}, never queued. dismiss-service clears a service's cookie alert by hand: {"service"}. rerun-service-jobs retries every job a service's cookie alert stopped, once it is OK again: {"service"} -&gt; {jobIds, skipped}. --wait follows them. | `pnpm ops recheck-service --json '{"service":"rumble"}'`<br>`pnpm ops recheck-service --json '{"service":"x"}'` | | `dismiss-service` | — | | | `rerun-service-jobs` | — | | | `workers` | workers switches transcription workers as /workers does: {"op": "enable" \| "disable" \| "drain", "ids": \[...\]} — the live pool; a restart restores the launch default. An unknown id is named; the others still apply. | `pnpm ops workers --json '{"op":"disable","ids":["parakeet-cpu"]}'` | diff --git a/OPERATING.md b/OPERATING.md @@ -496,7 +496,7 @@ pnpm ops fetch-posts --json '{"slug":"example-forum-thread","pages":20,"retry pnpm ops capture-posts --json '{"slug":"example-x","ids":["<postId>"]}' --wait ``` -- An X, Bluesky or XenForo URL makes a social channel (its handle derived from the URL). `"older": true` walks back below the oldest +- An X, Bluesky, Instagram or XenForo URL makes a social channel (its handle derived from the URL; Instagram: "Instagram accounts" below). `"older": true` walks back below the oldest archived post and resumes from its saved place; `"full": true` re-walks the timeline. - **Sync new and resume backfill are two actions** for an X or Bluesky timeline (`common/lib/timelineWalk.ts`). A plain `fetch-posts` — and Sync, the scheduler, the channel page's **Sync new** — is SYNC NEW: from the top down to @@ -510,8 +510,8 @@ pnpm ops capture-posts --json '{"slug":"example-x","ids":["<postId>"]}' --wait the next fetch. The job log's first line names the mode (`— sync new, since …` / `— resume backfill, from its saved resume point`). - **Pacing is enforced, not advised** (plans/pacing-guard.md). Every job that asks a platform waits its - platform queue's gap after the previous one there ended — `pacing.jobGapSeconds`: X 300 s, forums and - Bluesky 60 s, everything else 20 s (set on /settings) — and its /jobs row and log say so (`waiting 4m12s: X + platform queue's gap after the previous one there ended — `pacing.jobGapSeconds`: Instagram 600 s, X 300 s, + forums and Bluesky 60 s, everything else 20 s (set on /settings) — and its /jobs row and log say so (`waiting 4m12s: X jobs are spaced 5 min apart (pacing.jobGapSeconds.twitter)`). Thirteen fetches queued in one loop run five minutes apart and stop at the first challenge. A queue override of `""` (immediate) is refused for any such job. @@ -593,6 +593,52 @@ pnpm ops capture-posts --json '{"slug":"example-x","ids":["<postId>"]}' --wait - Forum pages saved from a browser: `pnpm archilyzer posts import-html <slug> <file-or-dir> --dry-run`. - Which archived posts were deleted at the source: `pnpm archilyzer posts check --slug <slug>`. +### Instagram accounts + +```sh +pnpm ops create-channel --json '{"fields":{"name":"Example (Instagram)","handling":"transcribe","url":"https://www.instagram.com/example.account/","cookiesFromBrowser":"firefox:instagram-archive"}}' +pnpm ops channel-config --json '{"slug":"example-instagram","patch":{"cookiesFromBrowser":"file:/data/instagram-archive-cookies.txt"}}' +pnpm ops fetch-posts --json '{"slug":"example-instagram"}' --wait # the first: a walk; after it: sync new, one page +pnpm ops resume-backfill --json '{"slug":"example-instagram"}' --wait # the walk's next 300 posts +pnpm ops recheck-service --json '{"service":"instagram"}' # the operator's word, no request +pnpm ops clear-platform-hold --json '{"platform":"instagram"}' # end the hour's hold by hand +pnpm ops settings --json '{"patch":{"social":{"instagram":{"visibility":"public"}}}}' +``` + +- An `instagram.com/<account>/` URL makes a posts channel (`platform: "instagram"`, fetcher `instagram-gallery-dl`): + the account's posts and reels, each with its text, date, link, likes and media. A carousel is ONE post with + several media; a reel is one video. Stories, highlights, screenshots and transcription are not built yet. +- **A login is required, and it is the channel's own.** Logged out, Instagram answers an account's feed with + "Page Not Found", so nothing is read without one. An Instagram channel reads only its own **Cookies from + browser** (`cookiesFromBrowser`: a browser profile, or `file:<cookies.txt>`), never the global browser. With none + set, `fetch-posts` is refused before a job exists and says where to set it. +- **Use an account made for the archive.** Instagram may checkpoint or ban an account that reads this way, and + the login the channel names is the one at risk. An archive account reads public accounts, and private ones only + if it follows them. Nothing logs in or refreshes a session by itself. +- **What a run costs, and it says so.** gallery-dl sleeps 6–12 s before every request. A sync is ONE feed page + (up to 30 posts), plus up to two requests for the account's id the first time. A walk (the first fetch, + `"full"`, `resume-backfill`) reads up to 300 posts and stops; the next run resumes from its cursor, re-reading + that one page. A run is stopped at 4 requests (a sync) or 13 (a walk). Its log ends `This run cost Instagram N + request(s) and its CDN F file(s).` +- **Media come with the post, in the same job.** Their addresses are signed and expire, so the new posts' + pictures and videos are fetched at once: one GET per file with no cookies, 2–5 s apart, at most 40 files or + 200 MB a job and 100 MB a file, into `channels/<slug>/posts-media/<post id>/` beside a `capture.json`. What a + job did not fetch is recorded as owed (`mediaOwed`); three CDN refusals in a row end the media half. Nothing + collects owed media yet. `posts-media/` is not in the media tier: it stays on the corpus disk. +- **A post's id is its numeric media pk**, not the shortcode in its URL. The two convert both ways with no + request (`common/lib/instagram/ids.ts`); the post keeps its shortcode in `instagram.shortcode`. +- **Pacing.** Instagram jobs run one at a time, ten minutes apart (`pacing.jobGapSeconds.instagram`, 600). A + channel is synced every 12 hours at the most often, 4 hours with a `syncIntervalMinutes` of its own. +- **Nothing is retried.** The first 429 (or 401/403) ends the run, keeps what it read, and holds every Instagram + job for 60 minutes. A login, challenge or checkpoint page — and the "Page Not Found" a dead session gets — + raises Instagram's alert on the dashboard: every Instagram job is refused until a person passes the check in + that browser and presses **Recheck** (`recheck-service`), which sends Instagram no request and is taken on the + operator's word. The recheck timer never asks Instagram. `retryOnBlock` is refused. +- **An account is "gone" only when its own page answers 404.** A private account the login does not follow, and + a gone account, end the job with a sentence and raise no alert. +- **Private by default.** An Instagram channel's posts are built only into private sites unless + `social.instagram.visibility` is `"public"` (`common/lib/postsVisibility.ts`). + ### X search ```sh diff --git a/SETTINGS.md b/SETTINGS.md @@ -186,6 +186,7 @@ Per-platform settings of the social posts: X's three, all chosen in the X accoun |---|---|---| | `x` | `{}` | X / Twitter. See `social.x` below. | | `xenforo` | absent | Forum threads (XenForo). See `social.xenforo` below. Absent: nothing set. | +| `instagram` | absent | Instagram. See `social.instagram` below. Absent: nothing set (posts private). | #### `social.x` @@ -203,6 +204,14 @@ Per entry — each entry spells its own values. |---|---| | `retryOnBlock` | `{ "minutes": N, "max": M }` — what a forum thread's Fetch posts button does when the forum serves a browser check that will not clear, or refuses a page (403/429): the job waits N minutes and runs again, M tries in all (the first included; minutes 5–1440, tries 1–48). A captcha or a login wall is never retried — it needs a person. ABSENT (the default): off, the job stops at the block. Set on the forum channel page (Retry after a block); `fetch-posts` takes its own `retryOnBlock`. common/lib/forumWalk.ts. | +#### `social.instagram` + +Per entry — each entry spells its own values. + +| Key | Description | +|---|---| +| `visibility` | Where Instagram posts may appear. `"private"` (the default; absent): every Instagram channel's posts (a channel with `sourceKind: "social"` and `platform: "instagram"`) are left out of every PUBLIC site build, the channel with them, and built only into PRIVATE sites (`site.json` `audience`). `"public"`: built into every site that has the channel. Nothing on disk changes and fetching does not; a site already published changes on its next build and deploy. The rule is common/lib/postsVisibility.ts. `pnpm ops settings` sets it. | + Default: ```json diff --git a/common/controller/fetchPosts.ts b/common/controller/fetchPosts.ts @@ -86,7 +86,7 @@ import "../social/xenforoFetcher"; // An Instagram account (lane instagram): claims instagram.com account URLs. import { INSTAGRAM_NO_COOKIES } from "../social/instagramGalleryDlFetcher"; import { - fakeInstagramMediaFetch, + fakeInstagramMediaDeps, fetchInstagramMedia, instagramMediaLine, type InstagramMediaDeps, @@ -706,13 +706,13 @@ async function fetchTimeline(ctx: { // posts are on disk (social/instagramMedia.ts). A failure here never fails // the fetch: what is missing is owed, and said. if (result.media?.length) { - const fake = fakeInstagramMediaFetch(); + const fake = fakeInstagramMediaDeps(); const media = await fetchInstagramMedia({ outDir: postsMediaDir(channelRoot), plans: result.media, signal: effectiveSignal, onLog: log, - deps: { ...(fake ? { fetch: fake } : {}), ...(opts.instagramMedia ?? {}) }, + deps: { ...(fake ?? {}), ...(opts.instagramMedia ?? {}) }, }).catch((err: unknown) => { log(`[warn] The media could not be fetched: ${(err as Error).message}. The posts are archived.`); return null; diff --git a/common/lib/channelConfig.ts b/common/lib/channelConfig.ts @@ -316,14 +316,14 @@ export const CHANNEL_CONFIG_FIELD_DOCS: FieldDocs<ChannelConfig> = { sourceKind: 'What KIND of source this is: `"video"` (default — yt-dlp + transcription) or `"social"` (an account fetched into the posts corpus, skipped by the video scan). A separate axis from `handling`, so every binary handling branch stays binary.', postFetcher: - 'Social channels only: which social fetcher drives ingest (e.g. `"bluesky-atproto"`, `"x-gallery-dl"`). Absent = resolve by URL detection. Trimmed.', + 'Social channels only: which social fetcher drives ingest (e.g. `"bluesky-atproto"`, `"x-gallery-dl"`, `"instagram-gallery-dl"`). Absent = resolve by URL detection. Trimmed.', socialHandle: 'Social channels only: the bare account handle (a leading "@" is stripped). Derived from `url` at creation but stored, so a later URL-format change upstream cannot silently re-point ingest at a different account.', postPagePauseSeconds: "Social channels that are read page by page (a forum thread) only: the pause between two page loads, in seconds; each pause is jittered to 0.85–1.65× of it. Absent = the fetcher's own (12 s, so 10–20 s); floored at 5, capped at 600.", postCaptureThread: 'X channels only: `capture-posts` also shoots each reply\'s THREAD SHOT — the post it answers over the reply, `posts-media/<id>/shot-thread.png` beside `shot.png`, the parent\'s author blurred unless verified or the reply\'s own — unless the run says `"thread": false`. Absent = false (a run asks with `"thread": true`).', - platform: "The source platform: youtube, rumble, odysee, twitch, kick, archiveorg (archive.org items — imported, never listed; see README.md, \"archive.org items\"), bitchute (BitChute videos and channels; see README.md, \"BitChute\"), twitter, bluesky, xenforo (a forum thread) or webpage (Wayback Machine captures of pages; see `wayback`). An unknown value is dropped.", + platform: "The source platform: youtube, rumble, odysee, twitch, kick, archiveorg (archive.org items — imported, never listed; see README.md, \"archive.org items\"), bitchute (BitChute videos and channels; see README.md, \"BitChute\"), twitter, bluesky, xenforo (a forum thread), webpage (Wayback Machine captures of pages; see `wayback`) or instagram (an Instagram account's posts and reels; OPERATING.md, \"Instagram accounts\"). An unknown value is dropped.", name: "Display name.", url: "The channel / playlist / account URL syncs enumerate. Absent = the channel is never auto-synced.", audioFormat: '`"m4a"`, `"mp3"` or `"opus"`: the audio a transcribe-handling download keeps.', @@ -371,7 +371,7 @@ export const CHANNEL_CONFIG_FIELD_DOCS: FieldDocs<ChannelConfig> = { cleanAfterCaptureUnverified: "Let clean-after-capture (settings `diarization.cleanAfterCapture`) delete this channel's audio with NO availability check. Only for a channel with no `url`: with no source there is nothing to list, so the automatic per-video clean holds every such channel (\"no source to check: clean by hand\") unless this is true. The manual Clean audio sweep is unaffected. Absent/false = held.", syncIntervalMinutes: - "Auto-sync cadence: the scheduler syncs this channel when `now - lastSyncedAt >= syncIntervalMinutes`. Absent = inherit the global default; 0 = auto-sync off (still manually syncable); positives clamp to [1, 44640] (~31 days). A missing `url`, or a `sync` tier of paused in the channel-priority document, also disables auto-sync.", + "Auto-sync cadence: the scheduler syncs this channel when `now - lastSyncedAt >= syncIntervalMinutes`. Absent = inherit the global default; 0 = auto-sync off (still manually syncable); positives clamp to [1, 44640] (~31 days). A missing `url`, or a `sync` tier of paused in the channel-priority document, also disables auto-sync. AN INSTAGRAM CHANNEL is synced seldom, because every sync is a logged-in read: absent = every 12 hours at the most often (the global default when that is longer), and a value of its own is never under 240 (4 hours); 0 still turns it off (`common/jobs/syncScheduler.ts`).", fullSweepIntervalMinutes: "Full-sweep cadence: a sync upgrades itself to a full sweep when `now - lastFullSweepAt >= fullSweepIntervalMinutes`. Absent = inherit `syncScheduler.fullSweepIntervalMinutes`; 0 = never sweep (every sync is a paged walk); positives clamp to [1, 44640].", skipLiveDownloads: @@ -383,7 +383,7 @@ export const CHANNEL_CONFIG_FIELD_DOCS: FieldDocs<ChannelConfig> = { skipShorts: "`true`: the channel's YouTube Shorts — the listing entries whose URL is `youtube.com/shorts/<id>` — are not wanted. Decided from the listing URL alone (no metadata): a sync or full sweep does not download them, Download from playlist, Download videos and the bucket retries skip them, the metadata scan does not read them, and the report lists the ones with nothing on disk as `skippedShortsIds` instead of as undownloaded work (or, once delisted, as never-fetched losses). Importing a Shorts URL still downloads it, and a Short already on disk stays an ordinary video. Absent = Shorts are downloaded like any upload. A Configure field (`skipShorts`).", cookiesFromBrowser: - "Per-channel override of the global cookies-from-browser spec (a browser spec, or `file:<path>` for a cookies.txt). Trimmed; blank = inherit. A `firefox[:profile]` spec also sends that Firefox's own User-Agent (derived, so a Cloudflare clearance it earned is honoured after a browser update); a `--user-agent` in `ytdlpExtraArgs` overrides it.", + "Per-channel override of the global cookies-from-browser spec (a browser spec, or `file:<path>` for a cookies.txt). Trimmed; blank = inherit. A `firefox[:profile]` spec also sends that Firefox's own User-Agent (derived, so a Cloudflare clearance it earned is honoured after a browser update); a `--user-agent` in `ytdlpExtraArgs` overrides it. AN INSTAGRAM CHANNEL reads ONLY this, never the global spec: Instagram shows an account's posts only to a login, whose account is at risk of a checkpoint or a ban, so the source is chosen per channel — blank means nothing is fetched (`fetch-posts` refuses and says so). Name a browser profile or cookies file logged in to Instagram with an account kept for the archive.", cookieMode: "Per-channel override of the global cookie mode. Absent = inherit.", sleepBetweenDownloadsSeconds: "Per-channel override for the global pause between downloads. Absent = inherit; 0 = no sleep; floored and capped at 600.", diff --git a/common/social/instagramMedia.test.ts b/common/social/instagramMedia.test.ts @@ -11,6 +11,7 @@ import os from "node:os"; import path from "node:path"; import type { PostMediaPlan } from "./fetchers"; import { + fakeInstagramMediaDeps, fakeInstagramMediaFetch, fetchInstagramMedia, instagramMediaLine, @@ -218,6 +219,9 @@ test("a cancelled job asks for nothing more and says the rest is owed; an id tha test("the test server's CDN is played back, and there is none outside it", async () => { assert.equal(fakeInstagramMediaFetch({}), null); + assert.equal(fakeInstagramMediaDeps({}), null); + // Played back, no CDN is asked: no pause between two files either. + assert.equal(fakeInstagramMediaDeps({ E2E_TEST_ROUTES: "1" })!.pauseMs(), 0); const f = fakeInstagramMediaFetch({ E2E_TEST_ROUTES: "1" })!; const init = { signal: signal(), redirect: "error" as const, credentials: "omit" as const }; assert.equal((await f(`${CDN}/a.jpg`, init)).status, 200); diff --git a/common/social/instagramMedia.ts b/common/social/instagramMedia.ts @@ -83,6 +83,8 @@ const defaultDeps = (): InstagramMediaDeps => ({ // opens a socket to it. An address containing "refused" answers 403, one // containing "limited" 429, one containing "huge" declares 150 MB; every // other answers a few bytes naming it. Null outside the test server. +// (fakeInstagramMediaDeps is what the controller takes: this fetch, and no +// pause between two files, since no CDN is being asked.) export function fakeInstagramMediaFetch( env: Readonly<Record<string, string | undefined>> = process.env, ): InstagramMediaFetch | null { @@ -104,6 +106,13 @@ export function fakeInstagramMediaFetch( }; } +export function fakeInstagramMediaDeps( + env: Readonly<Record<string, string | undefined>> = process.env, +): Pick<InstagramMediaDeps, "fetch" | "pauseMs"> | null { + const fake = fakeInstagramMediaFetch(env); + return fake ? { fetch: fake, pauseMs: () => 0 } : null; +} + const mb = (bytes: number) => `${Math.round(bytes / (1024 * 1024))} MB`; const firstLine = (err: unknown) => String((err as Error)?.message ?? err).split("\n")[0]!.slice(0, 200); diff --git a/editor/CHANGELOG.md b/editor/CHANGELOG.md @@ -1,6 +1,21 @@ # Changelog ## [Unreleased] +- **An Instagram account can be archived as a posts channel.** + - An `instagram.com/<account>/` URL on the New channel form (or `pnpm ops create-channel`) makes one: posts and + reels with their text, date, link and media. A carousel is one post with several media. + - **A login is required, and it is the channel's own.** Logged out, Instagram shows no feed. The form asks for + **Cookies from browser** in the Source section and the channel never borrows the global browser; with none + set, a fetch is refused before a job exists. Use an account made for the archive: Instagram may checkpoint or + ban an account that reads this way. + - **Gentle by rule.** One Instagram job at a time, ten minutes apart. A sync reads one page; a walk reads up to + 300 posts and resumes. Nothing is retried: the first 429 holds Instagram for an hour, and a login, challenge + or checkpoint page raises Instagram's alert, which refuses every Instagram job until **Recheck**. A run says + what it cost in requests and files. A channel is synced every 12 hours at the most often. + - **Media come with the post**, in the same job, because their addresses expire: up to 40 files or 200 MB a + job, 100 MB a file, into `posts-media/<post id>/`. The rest is recorded as owed. + - **Private by default**: built only into private sites unless `social.instagram.visibility` is `"public"`. + - Stories, highlights, screenshots and transcription are not built yet. OPERATING.md, "Instagram accounts". - **A trending library's topics can be organised, and a topic published.** - **Rename** a topic, **move** posts between topics, **merge** topics into one: `pnpm ops organise-trending`, and on umtool's Posts library page. A merge cannot be undone, so it is the operator's and asks twice; it waits diff --git a/editor/app/api/ops/fetch-posts/route.ts b/editor/app/api/ops/fetch-posts/route.ts @@ -44,6 +44,11 @@ export const dynamic = "force-dynamic"; // starts afresh at, replacing its saved position). The job runs on the platform's // queue, as the buttons' does. // +// An Instagram channel (lane instagram): a sync reads one page, a walk up to +// 300 posts, and the new posts' media are fetched in the same job. Refused +// here, before a job exists, when the channel has no cookie source of its own +// (`cookiesFromBrowser`), and with `retryOnBlock`. +// // Every refusal is the action's own sentence: a channel that is not a social // one, `full` and `older` together, a fetcher with no older walk, a floor // without `older` or that is not a date, `force` without `older`, and an older diff --git a/editor/app/api/ops/recheck-service/route.ts b/editor/app/api/ops/recheck-service/route.ts @@ -4,12 +4,13 @@ import { ops, opsFail, reqString } from "../_lib"; export const dynamic = "force-dynamic"; -// POST { service: "rumble" | "youtube" | "odysee" | "archive.today" | "x" | <forum host> } +// POST { service: "rumble" | "youtube" | "odysee" | "archive.today" | "x" | "instagram" | <forum host> } // // The cookie refresh banner's Recheck: ONE request through the service's own // path (a yt-dlp metadata request for its last clean video; a forum page // through the host's profile; archive.today's request again; for X no request -// at all — the login on disk, renewed since the alert), as a one-step +// at all — the login on disk, renewed since the alert; for Instagram no +// request either — the operator's word that its check is passed), as a one-step // job (kind `recheck-service-cookies`) the answer waits for: // { ok, jobId, result: "clean" | "stale" | "failed", message }. "clean" // clears the alert. A second ask while one runs for the service (a press, the diff --git a/editor/e2e/instagram.spec.ts b/editor/e2e/instagram.spec.ts @@ -45,7 +45,14 @@ const jobLog = (jobId: string) => readFile(resolvePath(`${testPaths().transcript async function archivedIds(slug: string): Promise<string[]> { if (!(await pathExists(channelRel(slug, "posts-archive")))) return []; - return (await readFile(resolvePath(channelRel(slug, "posts-archive")), "utf8")).split("\n").filter(Boolean); + // One line per post: "<platform> <id>". + return (await readFile(resolvePath(channelRel(slug, "posts-archive")), "utf8")) + .split("\n") + .filter(Boolean) + .map((l) => { + expect(l.startsWith("instagram ")).toBe(true); + return l.slice("instagram ".length); + }); } async function makeChannel(request: APIRequestContext, slug: string, handle: string, cookies = true): Promise<void> { diff --git a/scripts/archilyzer-ops.mjs b/scripts/archilyzer-ops.mjs @@ -1520,12 +1520,17 @@ export function usage() { "", 'recheck-service asks a service whose cookie refresh alert is up ONE request', ' through its own path, as the dashboard banner\'s Recheck: {"service"}', - ' ("rumble", "youtube", "odysee", "archive.today", "x" or a forum host).', + ' ("rumble", "youtube", "odysee", "archive.today", "x", "instagram" or a', + ' forum host).', ' Waits for it: {jobId, result: "clean" | "stale" | "failed", message};', " \"clean\" clears the alert (and a yt-dlp service's backoff, as any clean", ' request). For "x" it sends X NO request: clean when the login on disk', ' was renewed after the alert (Refresh cookies on /cookies) — for a', ' jar-age alert, when the jar is within social.x.maxCookieAgeMinutes. The', + ' For "instagram" it sends Instagram NO request either and is the', + " operator's word that its check is passed: it clears the alert, and the", + " next Instagram job raises it again if it was not. The timer never asks", + ' Instagram. The', ' editor also rechecks by itself on a timer', ' (settings.serviceCookies.recheckIntervalMinutes, default 180, 0 = off;', ' `pnpm ops settings', @@ -1942,7 +1947,16 @@ export function usage() { ' in settings) waits out a challenge or refusal page and runs again, max', ' tries in all. "full", "older" and "backfill" are one at a time. 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', + ' the last timeline fetch read none) is refused unless "force": true.', + " AN INSTAGRAM CHANNEL: a sync reads ONE page (up to 30 posts), a first", + ' fetch, "full" or "backfill" walks up to 300 posts and the next run', + " resumes; the new posts' pictures and videos are fetched in the same job", + " (40 files / 200 MB a job, 100 MB a file; the rest is recorded as owed).", + " Refused before a job exists when the channel has no cookiesFromBrowser", + ' of its own, and with "retryOnBlock" or "older". A login, challenge or', + " checkpoint page raises Instagram's alert and refuses every Instagram job", + " until recheck-service; the first 429 holds Instagram for an hour", + ' (clear-platform-hold {"platform": "instagram"} ends that by hand). A', " drained fetch stops at its next resume point and the next run of the", " same walk resumes there.", "", @@ -2142,6 +2156,8 @@ export function usage() { ' 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.', + " An Instagram channel is refused: no screenshot is taken of an Instagram", + " post, and its media come with the post, in the fetch-posts job.", ' "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',