// When a video has no metadata.info.json and the channel has no playlist entry // for it, the single-video download pipeline reconstructs the source URL from // the video's canonical id (its dir name) and the channel's platform — derived // here from the channel config's odysee `url`. Without this, the pipeline used // to fail with "Could not determine the video URL". import { readFile, rm } from "node:fs/promises"; import { test, expect } from "@playwright/test"; import { pathExists, resetData, resolvePath } from "./helpers"; const CHANNEL = "test-transcribe"; const CHANNEL_ROOT = `test-transcripts/channels/${CHANNEL}`; test("download pipeline reconstructs the URL when metadata + playlist are missing", async ({ page, }) => { test.setTimeout(60_000); await resetData("one-transcribe-channel-with-audio"); // Strip vidA down to an empty dir: no audio, no metadata.info.json. The // fixture also ships no `playlist` file, so neither URL source exists. The // channel config's `url` (https://odysee.com/@example) is the only platform // signal, so reconstruction must produce an odysee URL for canonical id vidA. await rm(resolvePath(`${CHANNEL_ROOT}/data/vidA/audio.m4a`), { force: true }); await page.goto(`/channels/${CHANNEL}/videos/vidA`); await page.getByRole("button", { name: /^Run download pipeline$/ }).click(); const log = page.getByLabel("Run download pipeline for vidA output"); // The reconstructed odysee URL flows straight into yt-dlp's invocation. await expect(log).toContainText("https://odysee.com/vidA", { timeout: 30_000, }); await expect(log).not.toContainText("Could not determine the video URL"); // Wait for the download to actually finish before inspecting the filesystem. await expect(log).toContainText("download complete", { timeout: 30_000 }); // End-to-end: the audio is actually (re)downloaded under the canonical id. expect(await pathExists(`${CHANNEL_ROOT}/data/vidA/audio.m4a`)).toBe(true); // Belt-and-suspenders: the fake yt-dlp recorded the reconstructed URL. const invocations = await readFile( resolvePath(`${CHANNEL_ROOT}/fake-ytdlp.invocations`), "utf8", ); expect(invocations).toContain("https://odysee.com/vidA"); });