(input: string)
| 19 | } |
| 20 | |
| 21 | function parseVideoId(input: string) { |
| 22 | const trimmed = input.trim(); |
| 23 | if (!trimmed) { |
| 24 | throw new Error("Enter a video ID or share URL"); |
| 25 | } |
| 26 | |
| 27 | try { |
| 28 | const url = new URL(trimmed); |
| 29 | const pathMatch = url.pathname.match(/\/s\/([^/?#]+)/); |
| 30 | if (pathMatch?.[1]) { |
| 31 | return Video.VideoId.make(pathMatch[1]); |
| 32 | } |
| 33 | const lastSegment = url.pathname.split("/").filter(Boolean).at(-1); |
| 34 | if (lastSegment) { |
| 35 | return Video.VideoId.make(lastSegment); |
| 36 | } |
| 37 | } catch {} |
| 38 | |
| 39 | return Video.VideoId.make(trimmed); |
| 40 | } |
| 41 | |
| 42 | export async function adminReprocessVideo(input: string) { |
| 43 | await requireAdmin(); |
no outgoing calls
no test coverage detected