{ "id": "TApiWf11Classify01", "name": "Video → Transcript → Content Classifier (TranscriptAPI)", "nodes": [ { "parameters": {}, "id": "bbbbbbbb-bbbb-4bbb-8bbb-bbbbbbbbbb01", "name": "Start", "type": "n8n-nodes-base.manualTrigger", "typeVersion": 1, "position": [ -160, 0 ] }, { "parameters": { "assignments": { "assignments": [ { "id": "bbbbbbbb-bbbb-4bbb-8bbb-bbbbbbbbbbaa", "name": "videoUrl", "value": "https://www.youtube.com/watch?v=dQw4w9WgXcQ", "type": "string" } ] }, "options": {} }, "id": "bbbbbbbb-bbbb-4bbb-8bbb-bbbbbbbbbb02", "name": "Set Video URL", "type": "n8n-nodes-base.set", "typeVersion": 3.4, "position": [ 60, 0 ] }, { "parameters": { "url": "https://transcriptapi.com/api/v2/youtube/transcript", "authentication": "genericCredentialType", "genericAuthType": "httpHeaderAuth", "sendQuery": true, "queryParameters": { "parameters": [ { "name": "video_url", "value": "={{ $json.videoUrl }}" }, { "name": "format", "value": "json" }, { "name": "send_metadata", "value": "true" } ] }, "options": {} }, "id": "bbbbbbbb-bbbb-4bbb-8bbb-bbbbbbbbbb03", "name": "Get Transcript (TranscriptAPI)", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.2, "position": [ 280, 0 ], "credentials": { "httpHeaderAuth": { "id": "REPLACE_TRANSCRIPTAPI_CRED_ID", "name": "TranscriptAPI - Authorization Bearer" } } }, { "parameters": { "jsCode": "// Join TranscriptAPI segments into plain text and carry the title forward.\nconst data = $input.first().json;\nconst transcriptText = (data.transcript || []).map((s) => s.text).join(' ');\nconst meta = data.metadata || {};\nreturn [\n { json: { videoId: data.video_id, title: meta.title || null, language: data.language || null, transcriptText } },\n];" }, "id": "bbbbbbbb-bbbb-4bbb-8bbb-bbbbbbbbbb04", "name": "Build Transcript Text", "type": "n8n-nodes-base.code", "typeVersion": 2, "position": [ 500, 0 ] }, { "parameters": { "method": "POST", "url": "https://api.openai.com/v1/chat/completions", "authentication": "genericCredentialType", "genericAuthType": "httpHeaderAuth", "sendBody": true, "specifyBody": "json", "jsonBody": "={{ JSON.stringify({ model: 'gpt-4o-mini', response_format: { type: 'json_object' }, messages: [ { role: 'system', content: 'You are a content classifier. Read the transcript and classify the video. Respond ONLY with a JSON object with keys: primary_category (one of: Technology, Business, Education, Science, Health, Finance, Entertainment, Gaming, News, Lifestyle, Other), categories (array of 1-3 from that same list), content_type (one of: Tutorial, Review, Interview, News, Commentary, Vlog, Talk, Demo, Other), tags (array of 5-8 specific topic keywords), audience (short phrase describing who it is for), summary (2-3 sentence summary).' }, { role: 'user', content: 'Video title: ' + ($json.title || 'Untitled') + '\\n\\nTranscript:\\n' + $json.transcriptText } ] }) }}", "options": {} }, "id": "bbbbbbbb-bbbb-4bbb-8bbb-bbbbbbbbbb05", "name": "Classify (LLM)", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.2, "position": [ 720, 0 ], "credentials": { "httpHeaderAuth": { "id": "REPLACE_OPENAI_CRED_ID", "name": "OpenAI - Authorization Bearer" } } }, { "parameters": { "jsCode": "const raw = ($json.choices && $json.choices[0] && $json.choices[0].message.content) || '';\nlet c; try { c = JSON.parse(raw); } catch (e) { c = {}; }\nconst src = $('Build Transcript Text').first().json;\nreturn [\n {\n json: {\n primaryCategory: c.primary_category || null,\n categories: c.categories || [],\n contentType: c.content_type || null,\n tags: c.tags || [],\n audience: c.audience || null,\n summary: c.summary || null,\n sourceTitle: src.title,\n sourceVideoId: src.videoId,\n },\n },\n];" }, "id": "bbbbbbbb-bbbb-4bbb-8bbb-bbbbbbbbbb06", "name": "Format Classification", "type": "n8n-nodes-base.code", "typeVersion": 2, "position": [ 940, 0 ] } ], "connections": { "Start": { "main": [ [ { "node": "Set Video URL", "type": "main", "index": 0 } ] ] }, "Set Video URL": { "main": [ [ { "node": "Get Transcript (TranscriptAPI)", "type": "main", "index": 0 } ] ] }, "Get Transcript (TranscriptAPI)": { "main": [ [ { "node": "Build Transcript Text", "type": "main", "index": 0 } ] ] }, "Build Transcript Text": { "main": [ [ { "node": "Classify (LLM)", "type": "main", "index": 0 } ] ] }, "Classify (LLM)": { "main": [ [ { "node": "Format Classification", "type": "main", "index": 0 } ] ] } }, "active": false, "settings": { "executionOrder": "v1" }, "pinData": {} }