{
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "cdaf27d8-99d2-48c6-a888-0e88d6cd4277",
      "name": "When clicking 'Execute workflow'",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -2580,
        1000
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "26383450-32ec-441b-90e3-a96f27c80bc8",
      "name": "YouTube Playlist",
      "type": "n8n-nodes-base.youTube",
      "position": [
        -2240,
        1000
      ],
      "parameters": {
        "part": [
          "*",
          "contentDetails",
          "snippet",
          "id",
          "status"
        ],
        "options": {},
        "resource": "playlistItem",
        "operation": "getAll",
        "returnAll": true,
        "playlistId": "REDACTED"
      },
      "credentials": {
        "youTubeOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "7972886c-7df7-4997-8f70-724393049e43",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2360,
        680
      ],
      "parameters": {
        "color": 4,
        "width": 940,
        "height": 540,
        "content": "## step 1"
      },
      "typeVersion": 1
    },
    {
      "id": "b7bb0a36-2a5c-4b89-8838-1c2dabc95ace",
      "name": "Google Sheets3",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        800,
        1000
      ],
      "parameters": {
        "columns": {
          "value": {
            "script": "={{ $('scirpt').item.json.script }}",
            "summery": "={{ $json.output }}",
            "row_number": "={{ $('Loop Over Items1').item.json.id }}",
            "video titles": "={{ $('Loop Over Items1').item.json.title }}"
          },
          "schema": [
            {
              "id": "video titles",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "video titles",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "script",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "script",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "summery",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "summery",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "row_number",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": true,
              "required": false,
              "displayName": "row_number",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "row_number"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "update",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "REDACTED",
          "cachedResultUrl": "REDACTED",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "url",
          "value": "REDACTED"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "77e2b1f9-7826-434c-9ec0-020fae299de2",
      "name": "AI Agent1",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        200,
        840
      ],
      "parameters": {
        "text": "=Summarize the following podcast script.\nThe summary must be clear, well-organized, and comprehensive.\n\nInclude all important information, data, and key points from the script.\n\nDivide the summary into sections according to the main topics, ideas, or parts discussed in the podcast.\n\nFor each section, list all main points, facts, examples, and arguments mentioned.\n\nDo not omit any significant information or insight.\n\nThe summary should be detailed enough to give a full understanding of the podcast, but avoid unnecessary repetition or filler.\n\nUse headings and bullet points for clarity.\n\nThe result should be useful for someone who has not listened to the podcast but wants to understand all its important content and insights. podcast: {{ $json.firstTenSentences }}",
        "options": {},
        "promptType": "define"
      },
      "typeVersion": 2
    },
    {
      "id": "96afae6c-b9aa-4511-8189-ec86ad1c6736",
      "name": "Sticky Note10",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        640,
        680
      ],
      "parameters": {
        "color": 4,
        "width": 440,
        "height": 540,
        "content": "## step 5 : \ud83d\udcca **Google Sheets3**\n\n## Updates a Google Sheet with video titles, scripts, summaries, and row numbers. "
      },
      "typeVersion": 1
    },
    {
      "id": "4dffe6f7-35f0-4532-8572-538c3cd72a1c",
      "name": "Loop Over Items1",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        -1100,
        1000
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "2ab97a51-3cfc-44c9-bdb0-d10018d59f38",
      "name": "Groq Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatGroq",
      "position": [
        160,
        1040
      ],
      "parameters": {
        "model": "llama-3.1-8b-instant",
        "options": {}
      },
      "credentials": {
        "groqApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "21697e90-111c-4588-96cb-b73cd24ad93a",
      "name": "scirpt",
      "type": "n8n-nodes-base.code",
      "position": [
        -420,
        1000
      ],
      "parameters": {
        "jsCode": "// Combine all \"text\" fields from the content array into one string\nlet script = '';\n\n// Loop through all input items\nfor (const item of items) {\n  if (item.json.content && Array.isArray(item.json.content)) {\n    for (const segment of item.json.content) {\n      if (segment.text) {\n        script += segment.text + ' ';\n      }\n    }\n  }\n}\n\nscript = script.trim();\n\nreturn [\n  {\n    json: {\n      script\n    }\n  }\n];\n"
      },
      "typeVersion": 2
    },
    {
      "id": "b58ffdc1-991c-4be4-812c-547bb355b3d7",
      "name": "supadata",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -720,
        1000
      ],
      "parameters": {
        "url": "=https://api.supadata.ai/v1/transcript?url=https://youtu.be/{{ $json.videoId}}",
        "options": {},
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "x-api-key",
              "value": "REDACTED"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "9f5f991e-ef3b-4f79-869b-7c8104b8b14b",
      "name": "titles/URL",
      "type": "n8n-nodes-base.function",
      "position": [
        -1940,
        1000
      ],
      "parameters": {
        "functionCode": "// Extract video URLs, titles, and add an id starting from 2\nreturn items.map((item, index) => {\n  const videoId = item.json.snippet.resourceId.videoId;\n  const title = item.json.snippet.title;\n  return {\n    json: {\n      id: index + 2,\n      url: `https://www.youtube.com/watch?v=${videoId}`,\n      title: title\n    }\n  };\n});\n"
      },
      "typeVersion": 1
    },
    {
      "id": "e3ab10da-11a0-459d-9afd-17003da31d2d",
      "name": "video ID",
      "type": "n8n-nodes-base.code",
      "position": [
        -1640,
        1000
      ],
      "parameters": {
        "jsCode": "return items.map((item, index) => {\n  // Get the URL and title from the input\n  const url = item.json.url;\n  const title = item.json.title || null;\n  // Extract the video ID from the URL\n  let videoId = null;\n  if (url && url.includes('v=')) {\n    videoId = url.split('v=')[1].split('&')[0];\n  }\n  // id starts from 1; change to index+2 if you want to start from 2\n  return {\n    json: {\n      id: index + 2,\n      videoId,\n      title\n    }\n  };\n});\n"
      },
      "typeVersion": 2
    },
    {
      "id": "41a59817-9083-4a88-ab3e-b5aa8ed77d85",
      "name": "Code1",
      "type": "n8n-nodes-base.code",
      "position": [
        -140,
        1000
      ],
      "parameters": {
        "jsCode": "// Get the script text\nconst script = items[0].json.script || \"\";\n\n// Split into sentences using a regular expression\nconst sentences = script.match(/[^\\.!\\?]+[\\.!\\?]+/g) || [];\n\n// Get the first 10 sentences (or fewer if less than 10)\nconst firstTen = sentences.slice(0, 5).join(' ').trim();\n\nreturn [\n  {\n    json: {\n      firstTenSentences: firstTen\n    }\n  }\n];\n"
      },
      "typeVersion": 2
    },
    {
      "id": "54fb0421-9357-40eb-8c0e-2b8f62445f8e",
      "name": "Split Out",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        -1300,
        1000
      ],
      "parameters": {
        "options": {},
        "fieldToSplitOut": "id, videoId, title"
      },
      "typeVersion": 1
    },
    {
      "id": "ad64708a-c09e-4aff-8e55-baf807d10d60",
      "name": "YouTube Playlist Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2320,
        760
      ],
      "parameters": {
        "color": 5,
        "width": 260,
        "height": 420,
        "content": "\ud83d\udcfa **YouTube Playlist**\n\nFetches all videos from a specific YouTube playlist.\n\n**How to change:** Change the `playlistId` to use a different playlist. Adjust `part` to fetch different details. Change credentials for another YouTube account."
      },
      "typeVersion": 1
    },
    {
      "id": "f0d47980-eec9-4b98-af59-cc17a722d8dc",
      "name": "titles/URL Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2020,
        760
      ],
      "parameters": {
        "color": 5,
        "width": 260,
        "height": 420,
        "content": "\ud83d\udd17 **titles/URL (Function Node)**\n\nExtracts video URLs and titles from the playlist data and assigns a row ID.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "0db1c271-61fc-4626-9059-ed0fc47cbfb9",
      "name": "video ID Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1720,
        760
      ],
      "parameters": {
        "color": 5,
        "width": 260,
        "height": 420,
        "content": "\ud83c\udd94 **video ID (Code Node)**\n\nExtracts the video ID from each YouTube URL.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "1473ffb7-7359-4f69-bee7-9b0e8cda7144",
      "name": "supadata Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -800,
        740
      ],
      "parameters": {
        "color": 5,
        "width": 260,
        "height": 440,
        "content": "\ud83d\udcdd **supadata (HTTP Request Node)**\n\nCalls the Supadata API to get the transcript for each video.\n\n**How to change:** Update the API URL or key if the service changes. Modify request headers or parameters for other APIs."
      },
      "typeVersion": 1
    },
    {
      "id": "30f4dd38-5f1f-4ec9-886b-8cf1f9cc1e63",
      "name": "scirpt Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -500,
        740
      ],
      "parameters": {
        "color": 5,
        "height": 440,
        "content": "\ud83d\udcdc **scirpt (Code Node)**\n\nCombines the transcript segments into a single script string.\n\n**How to change:** Change logic to format or preprocess the script differently (e.g., filter out certain lines)."
      },
      "typeVersion": 1
    },
    {
      "id": "276763d4-1f30-4736-b40d-21ed003caa40",
      "name": "Code1 Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -200,
        740
      ],
      "parameters": {
        "color": 5,
        "height": 440,
        "content": "\u2702\ufe0f **Code1 (Code Node)**\n\nExtracts the first few sentences from the script for summarization.\n\n**How to change:** Adjust the number of sentences extracted. Change the splitting logic for different transcript formats."
      },
      "typeVersion": 1
    },
    {
      "id": "d1a7650a-b728-4add-9508-4fa64519061f",
      "name": "Sticky Note11",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1360,
        680
      ],
      "parameters": {
        "color": 4,
        "width": 440,
        "height": 540,
        "content": "## step 2"
      },
      "typeVersion": 1
    },
    {
      "id": "0aa6aed7-b67e-40a1-89d9-b6d321f31448",
      "name": "Sticky Note12",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -860,
        680
      ],
      "parameters": {
        "color": 4,
        "width": 940,
        "height": 540,
        "content": "## step 3"
      },
      "typeVersion": 1
    },
    {
      "id": "e4c4417f-e94f-40f1-84a0-b9615401fb4c",
      "name": "Sticky Note13",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        120,
        680
      ],
      "parameters": {
        "color": 4,
        "width": 480,
        "height": 540,
        "content": "## step 4 : \ud83e\udd16 **Groq Chat Model (LLM Node)**\n\nchange the prompt if you want or change the ai model"
      },
      "typeVersion": 1
    }
  ],
  "connections": {
    "Code1": {
      "main": [
        [
          {
            "node": "AI Agent1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "scirpt": {
      "main": [
        [
          {
            "node": "Code1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "supadata": {
      "main": [
        [
          {
            "node": "scirpt",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "video ID": {
      "main": [
        [
          {
            "node": "Split Out",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent1": {
      "main": [
        [
          {
            "node": "Google Sheets3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Out": {
      "main": [
        [
          {
            "node": "Loop Over Items1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "titles/URL": {
      "main": [
        [
          {
            "node": "video ID",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Sheets3": {
      "main": [
        [
          {
            "node": "Loop Over Items1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Groq Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent1",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items1": {
      "main": [
        [],
        [
          {
            "node": "supadata",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "YouTube Playlist": {
      "main": [
        [
          {
            "node": "titles/URL",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking 'Execute workflow'": {
      "main": [
        [
          {
            "node": "YouTube Playlist",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}