{"message":"YouTube Transcript API","endpoints":{"POST /transcript":"Fetch transcript by video ID (detailed JSON format)","POST /transcript/text":"Fetch transcript as plain text by video ID in JSON with message and data fields","POST /transcript/cleanup":"Clean up transcript: remove timestamps, fix errors with LLM, combine into readable text","POST /transcript/cleanup-task":"Submit a background task to cleanup transcript (Async)","POST /transcript/summarize":"Fetch transcript and summarize using OpenRouter API (Streaming)","POST /transcript/summarize-task":"Submit a background task to summarize transcript (Async)","POST /custom-video-download-task":"Submit a background task to download video with custom options (Async)","GET /tasks/{task_id}":"Check status and get result of a background task","POST /url-to-id":"Convert YouTube URL to video ID","POST /video-metadata":"Get YouTube video metadata including speaker name (extracted via LLM)","GET /health":"Health check endpoint"},"supported_models":{"openrouter":"Any OpenRouter model (e.g., qwen/qwen3-8b, meta-llama/llama-3.1-8b-instruct)"},"js_fetch_examples":{"transcript":"\n// Fetch transcript\nconst response = await fetch('http://localhost:9095/transcript', {\n    method: 'POST',\n    headers: {\n        'Content-Type': 'application/json',\n        'Authorization': 'Bearer YOUR_API_KEY'\n    },\n    body: JSON.stringify({ video_id: 'VIDEO_ID', languages: 'id,en' })\n});\nconst data = await response.json();\n","transcript_text":"\n// Fetch transcript as plain text\nconst response = await fetch('http://localhost:9095/transcript/text', {\n    method: 'POST',\n    headers: {\n        'Content-Type': 'application/json',\n        'Authorization': 'Bearer YOUR_API_KEY'\n    },\n    body: JSON.stringify({ video_id: 'VIDEO_ID', languages: 'id,en', include_timestamps: false })\n});\nconst data = await response.json();\n","transcript_cleanup":"\n// Clean up transcript (synchronous)\nconst response = await fetch('http://localhost:9095/transcript/cleanup', {\n    method: 'POST',\n    headers: {\n        'Content-Type': 'application/json',\n        'Authorization': 'Bearer YOUR_API_KEY'\n    },\n    body: JSON.stringify({ video_id: 'VIDEO_ID', languages: 'id,en', output_language: 'Indonesian' })\n});\nconst data = await response.json();\n","transcript_cleanup_task":"\n// Clean up transcript (async background task)\nconst submitResponse = await fetch('http://localhost:9095/transcript/cleanup-task', {\n    method: 'POST',\n    headers: {\n        'Content-Type': 'application/json',\n        'Authorization': 'Bearer YOUR_API_KEY'\n    },\n    body: JSON.stringify({ video_id: 'VIDEO_ID', languages: 'id,en' })\n});\nconst { task_id } = await submitResponse.json();\n\n// Poll for result\nconst checkTask = async (taskId) => {\n    const res = await fetch(`http://localhost:9095/tasks/${taskId}`, {\n        headers: { 'Authorization': 'Bearer YOUR_API_KEY' }\n    });\n    return res.json();\n};\n","transcript_summarize_streaming":"\n// Summarize transcript with streaming response\nconst response = await fetch('http://localhost:9095/transcript/summarize', {\n    method: 'POST',\n    headers: {\n        'Content-Type': 'application/json',\n        'Authorization': 'Bearer YOUR_API_KEY'\n    },\n    body: JSON.stringify({ video_id: 'VIDEO_ID', languages: 'id,en' })\n});\n\n// Handle streaming response\nconst reader = response.body.getReader();\nconst decoder = new TextDecoder();\nwhile (true) {\n    const { done, value } = await reader.read();\n    if (done) break;\n    console.log(decoder.decode(value));\n}\n","video_metadata":"\n// Get video metadata\nconst response = await fetch('http://localhost:9095/video-metadata', {\n    method: 'POST',\n    headers: {\n        'Content-Type': 'application/json',\n        'Authorization': 'Bearer YOUR_API_KEY'\n    },\n    body: JSON.stringify({ video_id: 'VIDEO_ID' })\n});\nconst metadata = await response.json();\n","url_to_id":"\n// Convert YouTube URL to video ID\nconst response = await fetch('http://localhost:9095/url-to-id', {\n    method: 'POST',\n    headers: {\n        'Content-Type': 'application/json',\n        'Authorization': 'Bearer YOUR_API_KEY'\n    },\n    body: JSON.stringify({ url: 'https://www.youtube.com/watch?v=VIDEO_ID' })\n});\nconst { video_id } = await response.json();\n"}}