// WHAT THE SITE SAYS WHEN A SOURCE IS NO LONGER PUBLIC (lane missing-source). // // A video whose state is members-only, private or deleted at its platform // (availability.ts NOT_PUBLIC_STATES) gets no player on the export site: a // sentence in its place, the platform link kept but marked, and the transcript // as for any video. The sentence names the state and the day the archive first // saw it (`stateSince`) and nothing else — never who observed it or how. It // says "first seen", never "since": the archive knows when it first saw the // state, not when the platform changed it. // // Pure: client-safe, no node: imports. import { isNotPublicState, type VideoState } from "./availability"; // A platform's name as a person writes it. Kept here rather than imported from // the report modules so the client bundle does not pull them in. const PLATFORM_NAMES: Readonly> = { youtube: "YouTube", rumble: "Rumble", odysee: "Odysee", twitch: "Twitch", kick: "Kick", archiveorg: "archive.org", bitchute: "BitChute", }; export function sourcePlatformName(platform: string | null | undefined): string { return (platform && PLATFORM_NAMES[platform]) || "its platform"; } // The state as the sentence says it. const STATE_WORDS: Readonly> = { members_only: "members-only", private: "private", deleted: "removed", }; const MONTHS = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]; // "20261119" -> "19 Nov 2026"; anything else -> null. export function formatStateDay(yyyymmdd: string | null | undefined): string | null { if (!yyyymmdd || !/^\d{8}$/.test(yyyymmdd)) return null; const m = Number(yyyymmdd.slice(4, 6)); const d = Number(yyyymmdd.slice(6, 8)); if (m < 1 || m > 12 || d < 1 || d > 31) return null; return `${d} ${MONTHS[m - 1]} ${yyyymmdd.slice(0, 4)}`; } export type SourceGone = { state: VideoState; stateSince?: string; }; // The one sentence: "This stream is no longer public on YouTube (members-only; // first seen 19 Nov 2026). The transcript is kept here." With no day (a state // whose first sighting is not on record), the parenthesis is the state alone. // Null for a state that keeps its player. export function sourceMissingSentence(o: { state: VideoState | null | undefined; stateSince?: string | null; platform: string | null | undefined; isLivestream?: boolean; }): string | null { if (!isNotPublicState(o.state)) return null; const what = o.isLivestream ? "stream" : "video"; const word = STATE_WORDS[o.state as string]; const day = formatStateDay(o.stateSince); const paren = day ? `${word}; first seen ${day}` : word; return `This ${what} is no longer public on ${sourcePlatformName(o.platform)} (${paren}). The transcript is kept here.`; } // The platform link, kept but marked: "Open on YouTube (members-only)". export function sourceLinkLabel(platform: string | null | undefined, state: VideoState): string { const word = STATE_WORDS[state]; const name = sourcePlatformName(platform); return word ? `Open on ${name} (${word})` : `Open on ${name}`; } // The badge tooltip's day: "Members-only on the source platform; first seen // 19 Nov 2026". export function stateSinceTitle(base: string, stateSince: string | null | undefined): string { const day = formatStateDay(stateSince); return day ? `${base}; first seen ${day}` : base; }