{ "id": "TApiWf23StudyNotes01", "name": "Playlist → Study Notes Generator (TranscriptAPI)", "nodes": [ { "parameters": {}, "id": "23232323-2323-4323-8323-232323232301", "name": "Start", "type": "n8n-nodes-base.manualTrigger", "typeVersion": 1, "position": [ -300, 0 ] }, { "parameters": { "assignments": { "assignments": [ { "id": "23232323-2323-4323-8323-2323232323a1", "name": "playlistUrl", "value": "REPLACE_WITH_PLAYLIST_URL_OR_ID", "type": "string" } ] }, "options": {} }, "id": "23232323-2323-4323-8323-232323232302", "name": "Set Playlist", "type": "n8n-nodes-base.set", "typeVersion": 3.4, "position": [ -80, 0 ] }, { "parameters": { "url": "https://transcriptapi.com/api/v2/youtube/playlist/videos", "authentication": "genericCredentialType", "genericAuthType": "httpHeaderAuth", "sendQuery": true, "queryParameters": { "parameters": [ { "name": "playlist", "value": "={{ $json.playlistUrl }}" } ] }, "options": {} }, "id": "23232323-2323-4323-8323-232323232303", "name": "Get Playlist Videos", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.2, "position": [ 140, 0 ], "credentials": { "httpHeaderAuth": { "id": "REPLACE_TRANSCRIPTAPI_CRED_ID", "name": "TranscriptAPI - Authorization Bearer" } } }, { "parameters": { "jsCode": "const data = $input.first().json;\nreturn (data.results || []).map((v) => ({ json: { videoId: v.videoId, videoTitle: v.title || null, videoUrl: 'https://www.youtube.com/watch?v=' + v.videoId } }));" }, "id": "23232323-2323-4323-8323-232323232304", "name": "Extract Video List", "type": "n8n-nodes-base.code", "typeVersion": 2, "position": [ 360, 0 ] }, { "parameters": { "maxItems": 3 }, "id": "23232323-2323-4323-8323-232323232305", "name": "Keep First 3", "type": "n8n-nodes-base.limit", "typeVersion": 1, "position": [ 580, 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": "23232323-2323-4323-8323-232323232306", "name": "Get Transcript (TranscriptAPI)", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.2, "position": [ 800, 0 ], "credentials": { "httpHeaderAuth": { "id": "REPLACE_TRANSCRIPTAPI_CRED_ID", "name": "TranscriptAPI - Authorization Bearer" } }, "onError": "continueRegularOutput" }, { "parameters": { "mode": "runOnceForEachItem", "jsCode": "// Build a timestamped transcript per video; carry title + URL (per-item).\nfunction ts(sec) {\n const s = Math.floor(sec || 0);\n const h = Math.floor(s / 3600), m = Math.floor((s % 3600) / 60), r = s % 60;\n const mm = (r < 10 ? '0' : '') + r;\n return h > 0 ? (h + ':' + (m < 10 ? '0' : '') + m + ':' + mm) : (m + ':' + mm);\n}\nconst d = $json;\nconst seg = Array.isArray(d.transcript) ? d.transcript : [];\nconst meta = d.metadata || {};\nconst transcriptText = seg.map((s) => '[' + ts(s.start) + '] ' + s.text).join('\\n');\nreturn {\n json: {\n title: meta.title || d.video_id,\n videoUrl: 'https://www.youtube.com/watch?v=' + d.video_id,\n hasTranscript: seg.length > 0,\n transcriptText,\n },\n};" }, "id": "23232323-2323-4323-8323-232323232307", "name": "Build Notes Input", "type": "n8n-nodes-base.code", "typeVersion": 2, "position": [ 1020, 0 ] }, { "parameters": { "conditions": { "options": { "caseSensitive": true, "leftValue": "", "typeValidation": "strict" }, "conditions": [ { "id": "c2323232-2323-4323-8323-232323232ccc", "leftValue": "={{ $json.hasTranscript }}", "rightValue": true, "operator": { "type": "boolean", "operation": "true", "singleValue": true } } ], "combinator": "and" }, "options": {} }, "id": "23232323-2323-4323-8323-232323232308", "name": "Has Transcript?", "type": "n8n-nodes-base.filter", "typeVersion": 2, "position": [ 1240, 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 study assistant. From this timestamped lecture transcript, produce study notes. Respond ONLY with a JSON object with keys: summary (2-3 sentences), key_concepts (array of 4-8 strings), definitions (array of objects with term and definition), timestamps (array of objects with label and time, using the [h:mm:ss] markers for the main sections), markdown (the full notes in Markdown). Base everything only on the transcript.' }, { role: 'user', content: 'Lecture: ' + ($json.title || 'Untitled') + '\\n\\nTimestamped transcript:\\n' + $json.transcriptText } ] }) }}", "options": {} }, "id": "23232323-2323-4323-8323-232323232309", "name": "Generate Study Notes (LLM)", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.2, "position": [ 1460, 0 ], "credentials": { "httpHeaderAuth": { "id": "REPLACE_OPENAI_CRED_ID", "name": "OpenAI - Authorization Bearer" } } }, { "parameters": { "mode": "runOnceForEachItem", "jsCode": "// One study-notes row per video (Markdown/Notion/Airtable/CSV-ready).\nconst raw = ($json.choices && $json.choices[0] && $json.choices[0].message.content) || '';\nlet n; try { n = JSON.parse(raw); } catch (e) { n = { markdown: raw }; }\nconst src = $('Build Notes Input').item.json;\nreturn {\n json: {\n title: src.title,\n videoUrl: src.videoUrl,\n summary: n.summary || null,\n keyConcepts: n.key_concepts || [],\n definitions: n.definitions || [],\n timestamps: n.timestamps || [],\n markdown: n.markdown || '',\n },\n};" }, "id": "23232323-2323-4323-8323-232323232310", "name": "Format Notes", "type": "n8n-nodes-base.code", "typeVersion": 2, "position": [ 1680, 0 ] } ], "connections": { "Start": { "main": [ [ { "node": "Set Playlist", "type": "main", "index": 0 } ] ] }, "Set Playlist": { "main": [ [ { "node": "Get Playlist Videos", "type": "main", "index": 0 } ] ] }, "Get Playlist Videos": { "main": [ [ { "node": "Extract Video List", "type": "main", "index": 0 } ] ] }, "Extract Video List": { "main": [ [ { "node": "Keep First 3", "type": "main", "index": 0 } ] ] }, "Keep First 3": { "main": [ [ { "node": "Get Transcript (TranscriptAPI)", "type": "main", "index": 0 } ] ] }, "Get Transcript (TranscriptAPI)": { "main": [ [ { "node": "Build Notes Input", "type": "main", "index": 0 } ] ] }, "Build Notes Input": { "main": [ [ { "node": "Has Transcript?", "type": "main", "index": 0 } ] ] }, "Has Transcript?": { "main": [ [ { "node": "Generate Study Notes (LLM)", "type": "main", "index": 0 } ] ] }, "Generate Study Notes (LLM)": { "main": [ [ { "node": "Format Notes", "type": "main", "index": 0 } ] ] } }, "active": false, "settings": { "executionOrder": "v1" }, "pinData": {} }