import { refreshVideoMetadataAction } from "../../../channels/[slug]/videos/[id]/videoActions"; import { jobResponse, ops, optString, reqSlug, reqVideoId } from "../_lib"; export const dynamic = "force-dynamic"; // POST { slug, id, queueKey? } -> { ok: true, jobId } // // Re-read ONE video's metadata.info.json from its source — the video page's // "Refresh metadata". A metadata-only yt-dlp pass (no subtitles, no media) on // the platform's queue, with the channel's cookie policy and pace; the rewrite // is recorded in metadata.history.json as `refresh`, and the job's log ends // with what the source now says (live_status, formats, audio, English // captions, the keys that changed). // // Every refusal is the action's own sentence: an id with no data// (a // refresh re-reads a video already archived and never creates its directory), // a channel whose text cannot be read, an archive.org, Wayback or // feed-completed record, a held platform or one in a rate-limit cooldown // (`info: true`). export async function POST(request: Request) { return ops(request, ["slug", "id", "queueKey"], async (body) => jobResponse( await refreshVideoMetadataAction( reqSlug(body, "slug"), reqVideoId(body, "id"), optString(body, "queueKey"), ), ), ); }