Archilyzer · Source

archilyzer

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

commit 0869c74d643bf836b70a1969ba42dea01872e0ed
parent 5ac698ad1decf2eb62960a3de477a12a263d7ad5
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Fri, 16 Oct 2026 23:58:31 -0400

editor: the Configure form's Stored media URL downloads (never / fallback / only); the video page's re-download offers the stored URL when the record has one the allowlist trusts, for both download modes; e2e stored-url-downloads.spec.ts

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

Diffstat:
Meditor/app/channels/[slug]/videos/[id]/components/VideoPanel.tsx | 10++++++++++
Meditor/app/channels/[slug]/videos/[id]/components/cards/RedownloadSection.tsx | 30+++++++++++++++++++++++++++++-
Meditor/app/channels/[slug]/videos/[id]/page.tsx | 8++++++++
Meditor/app/channels/components/ChannelForm.tsx | 26++++++++++++++++++++++++++
Meditor/app/channels/components/channelConfigToForm.ts | 2++
Meditor/app/channels/components/parseChannelForm.test.ts | 18++++++++++++++++++
Meditor/app/channels/components/parseChannelForm.ts | 8++++++++
Aeditor/e2e/stored-url-downloads.spec.ts | 98+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
8 files changed, 199 insertions(+), 1 deletion(-)

diff --git a/editor/app/channels/[slug]/videos/[id]/components/VideoPanel.tsx b/editor/app/channels/[slug]/videos/[id]/components/VideoPanel.tsx @@ -13,6 +13,7 @@ import type { ChannelHandling, } from "yt-dlp-transcript-common/lib/channelConfig"; import type { DownloadOutcomeRecord } from "yt-dlp-transcript-common/lib/downloadOutcome"; +import type { StoredUrlMode } from "yt-dlp-transcript-common/lib/storedMediaUrl"; import type { TranscriptSalvage } from "yt-dlp-transcript-common/lib/transcribeOutcome"; import { SalvagedTranscriptNotice } from "./SalvagedTranscriptNotice"; import type { SavedVideoPointer } from "yt-dlp-transcript-common/lib/savedVideo"; @@ -79,6 +80,11 @@ type Props = { // This video's saved-video pointer when its source container is persisted to // the store, else null. Drives the Source-video persistence card (Phase 5). savedVideo?: SavedVideoPointer | null; + // The CDN host of the media URL the record stores, when the allowlist + // trusts it (release 32 R7), and the channel's `storedUrlDownloads`: the + // re-download offers the stored URL. + storedMediaHost?: string | null; + channelStoredUrl?: StoredUrlMode; // The effective source-video quality for this channel (channel over global, // resolveSourceVideoQuality): where the persist control's select starts. sourceVideoQuality?: SourceVideoQuality; @@ -126,6 +132,8 @@ export function VideoPanel({ position, vttProvenance = {}, umtoolUrl = null, + storedMediaHost = null, + channelStoredUrl, }: Props) { const audioFiles = files.filter((f) => isAudioFile(f.name)); const transcodeSources = files.filter((f) => isTranscodeSource(f.name)); @@ -274,6 +282,8 @@ export function VideoPanel({ defaultQueueKey={defaultQueueKey} existingQueues={existingQueues} noAudio={noAudio} + storedMediaHost={storedMediaHost} + channelStoredUrl={channelStoredUrl} /> </PipelineStageCard> diff --git a/editor/app/channels/[slug]/videos/[id]/components/cards/RedownloadSection.tsx b/editor/app/channels/[slug]/videos/[id]/components/cards/RedownloadSection.tsx @@ -7,6 +7,7 @@ import { DOWNLOAD_FORMAT_LABELS, DOWNLOAD_FORMAT_PRESETS, } from "yt-dlp-transcript-common/ytdlp/downloadFormat"; +import type { StoredUrlMode } from "yt-dlp-transcript-common/lib/storedMediaUrl"; import { QueueControl } from "../../../../../../components/QueueControl"; import { cancelJobAction } from "../../../../../../jobs/actions"; import { @@ -23,6 +24,8 @@ export function RedownloadSection({ defaultQueueKey, existingQueues, noAudio, + storedMediaHost = null, + channelStoredUrl, }: { slug: string; videoId: string; @@ -30,11 +33,19 @@ export function RedownloadSection({ defaultQueueKey: string; existingQueues: string[]; noAudio: boolean; + // Release 32 R7: the stored media URL's host (null: the record stores none + // the allowlist trusts) and the channel's `storedUrlDownloads`. + storedMediaHost?: string | null; + channelStoredUrl?: StoredUrlMode; }) { const [mode, setMode] = useState<DownloadMode>("pipeline"); const [queueKey, setQueueKey] = useState(defaultQueueKey); // "" = inherit the channel/global default; otherwise a DownloadFormatPreset. const [downloadFormat, setDownloadFormat] = useState(""); + // "" = inherit the channel's storedUrlDownloads; otherwise a StoredUrlMode. + const [storedUrl, setStoredUrl] = useState<"" | StoredUrlMode>(""); + const offerStored = storedMediaHost !== null && handling === "transcribe"; + const stored = offerStored && storedUrl ? storedUrl : undefined; const desc = (() => { if (mode === "whisper") { @@ -62,13 +73,14 @@ export function RedownloadSection({ : "Running pipeline…"; const actionLabel = `${verb} for ${videoId}`; const trigger = mode === "whisper" - ? () => whisperVideoAction(slug, videoId, queueKey) + ? () => whisperVideoAction(slug, videoId, queueKey, undefined, stored) : () => downloadVideoPipelineAction( slug, videoId, queueKey, downloadFormat || undefined, + stored, ); return ( @@ -104,6 +116,22 @@ export function RedownloadSection({ </select> </label> )} + {offerStored && ( + <label className="flex items-center gap-2 text-sm"> + Stored media URL + <select + value={storedUrl} + onChange={(e) => setStoredUrl(e.target.value as "" | StoredUrlMode)} + aria-label="stored media URL" + className="rounded border border-border bg-card px-2 py-1 text-sm" + > + <option value="">Inherit (channel: {channelStoredUrl ?? "never"})</option> + <option value="never">Never — the page</option> + <option value="fallback">Fallback — when the page is rate-limited</option> + <option value="only">Only — {storedMediaHost}, no page request</option> + </select> + </label> + )} <StreamActionLog trigger={trigger} cancelAction={cancelJobAction} diff --git a/editor/app/channels/[slug]/videos/[id]/page.tsx b/editor/app/channels/[slug]/videos/[id]/page.tsx @@ -50,6 +50,7 @@ import { loadFrameScans } from "yt-dlp-transcript-common/lib/frameScan-server"; import { MetadataHistoryDetails } from "./components/MetadataHistoryDetails"; import { VideoMediaTools } from "./components/VideoMediaTools"; import { loadAudioIntegrity } from "yt-dlp-transcript-common/lib/audioIntegrity-server"; +import { storedMediaUrl } from "yt-dlp-transcript-common/lib/storedMediaUrl-server"; import { describeIntegrity, integrityMatches, @@ -171,6 +172,9 @@ export default async function VideoDetailPage({ // The audio audit's verdict on this video's held audio (release 31 lane // A's audio-integrity.json; shown since release 32). const audioIntegrity = await loadAudioIntegrity(videoDir); + // The media URL the record stores, when the allowlist trusts it (release + // 32 R7): the re-download offers to read it. + const storedMediaHost = (await storedMediaUrl(videoDir))?.host ?? null; // The windows another tool asked this editor to fetch. One readdir of // data/<id>/clips/ plus a stat per file — and no per-CHANNEL count anywhere, // because that would be a walk of every video dir to draw one number. @@ -231,6 +235,7 @@ export default async function VideoDetailPage({ wayback, audioCopy, audioIntegrity, + storedMediaHost, clipWindows, vttProvenance, coverage, @@ -264,6 +269,7 @@ export default async function VideoDetailPage({ wayback, audioCopy, audioIntegrity, + storedMediaHost, clipWindows, vttProvenance, coverage, @@ -401,6 +407,8 @@ export default async function VideoDetailPage({ provenance: w.provenance, }))} coverage={coverage} + storedMediaHost={storedMediaHost} + channelStoredUrl={config.storedUrlDownloads} /> <TagsPanel view={tagsView} /> diff --git a/editor/app/channels/components/ChannelForm.tsx b/editor/app/channels/components/ChannelForm.tsx @@ -717,6 +717,32 @@ export function ChannelForm({ state={state} defaultOn={AUDIO_CHECK_PLATFORMS.includes(platform || detectPlatform(url) || "")} /> + <label className="flex flex-col gap-1 text-sm"> + <span className="font-medium"> + Stored media URL downloads{" "} + <span className="text-muted-foreground font-normal"> + (transcribe only, Odysee) + </span> + </span> + <SeededSelect + state={state} + name="storedUrlDownloads" + initial={c?.storedUrlDownloads ?? ""} + aria-label="stored media URL downloads" + className="rounded border border-border bg-card px-2 py-1 text-sm" + > + <option value="">Never — download from the page</option> + <option value="fallback"> + Fallback — the stored URL when the page is rate-limited or held + </option> + <option value="only">Only — the stored URL, no page request</option> + </SeededSelect> + <span className="text-xs text-muted-foreground"> + Reads the media file the video&apos;s metadata already names, in + ranges as the site&apos;s player does, through the audio check. One + new file per 20 minutes on the platform. + </span> + </label> </Section> <Section title="Retention & persistence"> <label className="flex flex-col gap-1 text-sm"> diff --git a/editor/app/channels/components/channelConfigToForm.ts b/editor/app/channels/components/channelConfigToForm.ts @@ -49,6 +49,7 @@ export const CHANNEL_FORM_VALUES = [ "fullSweepIntervalMinutes", "cookiesFromBrowser", "cookieMode", + "storedUrlDownloads", "downloadFilterInclude", "downloadFilterExclude", "downloadFilterRejectedLivestreams", @@ -105,6 +106,7 @@ export function channelConfigToFormData(config: ChannelConfig): FormData { putNum(fd, "fullSweepIntervalMinutes", config.fullSweepIntervalMinutes); put(fd, "cookiesFromBrowser", config.cookiesFromBrowser); put(fd, "cookieMode", config.cookieMode); + put(fd, "storedUrlDownloads", config.storedUrlDownloads); put(fd, "downloadFilterInclude", config.downloadFilter?.include); put(fd, "downloadFilterExclude", config.downloadFilter?.exclude); if (config.downloadFilter?.includeLivestreams) { diff --git a/editor/app/channels/components/parseChannelForm.test.ts b/editor/app/channels/components/parseChannelForm.test.ts @@ -118,3 +118,21 @@ test("the ops patch keeps an Odysee channel's default, and turns it off with aud assert.equal(back.get("audioCheckEnabled"), null, "the opt-out round-trips unticked"); assert.deepEqual(parseChannelForm(back).config.audioCheck, { enabled: false }); }); + +// Stored-media-URL downloads (release 32 R7): the select writes fallback/only, +// blank (Never) writes nothing, and the ops patch round-trips it. +test("the form writes storedUrlDownloads; Never clears it; the ops patch round-trips", () => { + assert.equal(parseChannelForm(form({ storedUrlDownloads: "only" })).config.storedUrlDownloads, "only"); + assert.equal(parseChannelForm(form({ storedUrlDownloads: "fallback" })).config.storedUrlDownloads, "fallback"); + assert.equal("storedUrlDownloads" in parseChannelForm(form({ storedUrlDownloads: "" })).config, false); + assert.equal("storedUrlDownloads" in parseChannelForm(form({ storedUrlDownloads: "sometimes" })).config, false); + assert.ok((CHANNEL_FORM_FIELDS as readonly string[]).includes("storedUrlDownloads")); + const fd = channelConfigToFormData({ handling: "transcribe", name: "Synth", url: ODYSEE }); + applyChannelFormPatch(fd, { storedUrlDownloads: "fallback" }); + const set = parseChannelForm(fd).config; + assert.equal(set.storedUrlDownloads, "fallback"); + const back = channelConfigToFormData(set); + assert.equal(back.get("storedUrlDownloads"), "fallback"); + applyChannelFormPatch(back, { storedUrlDownloads: "" }); + assert.equal("storedUrlDownloads" in parseChannelForm(back).config, false); +}); diff --git a/editor/app/channels/components/parseChannelForm.ts b/editor/app/channels/components/parseChannelForm.ts @@ -1,3 +1,4 @@ +import { isStoredUrlMode } from "yt-dlp-transcript-common/lib/storedMediaUrl"; import type { ChannelConfig } from "yt-dlp-transcript-common/lib/channelConfig"; import { AUDIO_CHECK_COPY_TIMEOUT_MAX_SECONDS, @@ -60,6 +61,7 @@ export const CHANNEL_FORM_FIELDS = [ "cookiesFromBrowser", "cookieMode", "audioCheck", + "storedUrlDownloads", "downloadFilter", "recordedDate", "mirror", @@ -221,6 +223,11 @@ export function parseChannelForm(formData: FormData): ParsedChannelForm { const cookiesFromBrowser = stringOrUndef(formData, "cookiesFromBrowser"); const cookieModeRaw = String(formData.get("cookieMode") ?? "").trim(); const cookieMode = isCookieMode(cookieModeRaw) ? cookieModeRaw : undefined; + // Stored-media-URL downloads (release 32 R7). Blank = never, the default: + // omitted, so choosing it clears a stored mode. + const storedUrlRaw = String(formData.get("storedUrlDownloads") ?? "").trim(); + const storedUrlDownloads = + isStoredUrlMode(storedUrlRaw) && storedUrlRaw !== "never" ? storedUrlRaw : undefined; // Download filter. Both patterns are regex SOURCES compiled with "i" at // download time, so the form is the place that refuses an unparseable one: @@ -401,6 +408,7 @@ export function parseChannelForm(formData: FormData): ParsedChannelForm { if (cookiesFromBrowser) config.cookiesFromBrowser = cookiesFromBrowser; if (cookieMode) config.cookieMode = cookieMode; if (audioCheck) config.audioCheck = audioCheck; + if (storedUrlDownloads) config.storedUrlDownloads = storedUrlDownloads; if (downloadFilter) config.downloadFilter = downloadFilter; if (recordedDateTitlePattern) { config.recordedDate = { titlePattern: recordedDateTitlePattern }; diff --git a/editor/e2e/stored-url-downloads.spec.ts b/editor/e2e/stored-url-downloads.spec.ts @@ -0,0 +1,98 @@ +import { mkdir, writeFile } from "node:fs/promises"; +import { test, expect } from "@playwright/test"; +import { baseUrl } from "./baseUrl"; +import { + channelStage, + generateReport, + readJson, + resetData, + resolvePath, + testPaths, +} from "./helpers"; + +// Release 32 R7: a full download may read the media URL the record stores, the +// way the platform's player does. The UI-without-AI rule: the per-channel +// setting is on the Configure form, and the video page's re-download offers it +// when the record has a stored URL the allowlist trusts. Nothing here starts a +// download — the stored URL's host is a real CDN and no test asks it anything +// (the download itself is covered by common's unit tests against a fake CDN). + +const CHANNEL = "test-transcribe"; +const FIXTURE = "one-transcribe-channel"; +const ROOT = `${testPaths().transcriptsDir}/channels/${CHANNEL}`; +const CLAIM = "FAKE-TEST-VALUEFAKE-TEST-VALUE01234567"; + +async function invalidate() { + await fetch(`${baseUrl}/api/test/invalidate-cache`).catch(() => {}); +} + +test("configure: the stored media URL setting saves fallback/only and Never clears it", async ({ page }) => { + await resetData(FIXTURE); + await generateReport(page, CHANNEL); + await page.goto(channelStage(CHANNEL, "configure")); + const select = page.getByLabel("stored media URL downloads"); + await expect(select).toHaveValue(""); + await select.selectOption("only"); + await page.getByRole("button", { name: /save changes/i }).click(); + await expect + .poll(async () => (await readJson<{ storedUrlDownloads?: string }>(`${ROOT}/config.json`)).storedUrlDownloads) + .toBe("only"); + + await page.reload(); + await expect(page.getByLabel("stored media URL downloads")).toHaveValue("only"); + await page.getByLabel("stored media URL downloads").selectOption(""); + await page.getByRole("button", { name: /save changes/i }).click(); + await expect + .poll(async () => "storedUrlDownloads" in (await readJson<Record<string, unknown>>(`${ROOT}/config.json`))) + .toBe(false); +}); + +test("video page: the re-download offers the stored media URL when the record has one", async ({ page }) => { + await resetData(FIXTURE); + const dir = resolvePath(`${ROOT}/data/${CLAIM}`); + await mkdir(dir, { recursive: true }); + await writeFile( + `${dir}/metadata.info.json`, + JSON.stringify({ + id: CLAIM, + extractor: "lbry", + title: "A synthetic stream", + webpage_url: `https://odysee.com/synthetic-stream:${CLAIM}`, + duration: 60, + formats: [ + { url: `https://player.odycdn.com/v6/streams/${CLAIM}/a1b2c3.mp4`, protocol: "https", ext: "mp4" }, + ], + }), + ); + await invalidate(); + await page.goto(`/channels/${CHANNEL}/videos/${CLAIM}`); + const select = page.getByLabel("stored media URL", { exact: true }); + await expect(select).toBeVisible(); + await expect(select).toHaveValue(""); + await expect(select.locator("option")).toHaveText([ + "Inherit (channel: never)", + "Never — the page", + "Fallback — when the page is rate-limited", + "Only — player.odycdn.com, no page request", + ]); + await select.selectOption("only"); + await expect(select).toHaveValue("only"); + // Both download modes carry it. + await page.getByLabel("download mode").selectOption("whisper"); + await expect(page.getByLabel("stored media URL", { exact: true })).toHaveValue("only"); + await expect(page.getByRole("button", { name: "Audio + Whisper" })).toBeEnabled(); + + // A record whose stored URL the allowlist does not trust: no offer. + await writeFile( + `${dir}/metadata.info.json`, + JSON.stringify({ + id: CLAIM, + webpage_url: `https://odysee.com/synthetic-stream:${CLAIM}`, + formats: [{ url: "https://cdn.example/a.mp4", protocol: "https" }], + }), + ); + await invalidate(); + await page.reload(); + await expect(page.getByLabel("download mode")).toBeVisible(); + await expect(page.getByLabel("stored media URL", { exact: true })).toHaveCount(0); +});