{
  "id": "IujAbWspOQ3QpsMl",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "YouTube Video Summarizer",
  "tags": [],
  "nodes": [
    {
      "id": "b2dfa97e-48c1-4c6d-aa8a-3b89ee30ea70",
      "name": "When clicking \u2018Execute workflow\u2019",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        0,
        -64
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "5a3e1726-d2c9-4fb8-9dc3-44fd1c14ff23",
      "name": "DeepSeek Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatDeepSeek",
      "position": [
        864,
        96
      ],
      "parameters": {
        "options": {}
      },
      "credentials": {
        "deepSeekApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "721e9e8b-c387-4c9e-8328-8ef20700525c",
      "name": "Generate Summary",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        848,
        -64
      ],
      "parameters": {
        "text": "=Summarize the following video transcript in a structured, clear, and concise manner. Focus on the key points, main ideas, and essential takeaways. Avoid unnecessary details and redundant information. Ensure that the summary is logically organized and easy to understand.\nGuidelines for summarization:\n\nIdentify core topics: Capture the main subject of the discussion.\n\nExtract key points: Highlight the most important arguments, insights, and conclusions.\n\nUse clear and precise language: Ensure readability and logical flow.\n\nMaintain neutrality: Avoid opinions or interpretations that are not in the transcript.\n\nFormat for clarity: If the transcript includes multiple sections or topics, structure the summary using bullet points or short paragraphs.\n\nExpected Output Format:\nReturn the summary as a structured text response, using either paragraphs or bullet points, depending on the complexity of the content. If applicable, include subheadings for better organization.\nSummarize the following video transcript in a structured JSON format. \\n\\n Focus on key points, main ideas, and important takeaways.\nHere is the transcript: {{ $json.Transcript }}",
        "batching": {},
        "messages": {
          "messageValues": [
            {
              "message": "=Summarize the following video transcript in a clear and concise way. Focus on key points and main ideas. The output must be in pure JSON format, without additional characters, without JSON keywords, without backticks, without comments, and without markdown. Return the response as a correct JSON array WITHOUT any additional descriptions, comments, Markdown, 'json', or backticks. The response must start with [ and end with ]. If no suggestions can be generated, return an empty array []. The structure of the response should be:[{       \\\"summary\\\": \\\"Short structured summary of the video.\\\",       \\\"key_points\\\": [\\\"Point \", \\\"Point \", \\\"Point \"],       \\\"topics\\\": [\\\"Topic\", \\\"Topic\\\"]     }]  "
            }
          ]
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 1.7
    },
    {
      "id": "e83ad09b-cf11-4482-bf9d-816ba07bb975",
      "name": "Adding Summary to file",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1328,
        -64
      ],
      "parameters": {
        "columns": {
          "value": {
            "Url": "={{ $('Get URL to Transcript').item.json.Url }}",
            "Status": "Done",
            "Topics": "={{ $json.topics }}",
            "Summary": "={{ $json.summary }}",
            "Key Points": "={{ $json.key_points }}"
          },
          "schema": [
            {
              "id": "Url",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Url",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Status",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Status",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Transcript",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Transcript",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Summary",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Summary",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Key Points",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Key Points",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Topics",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Topics",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "row_number",
              "type": "number",
              "display": true,
              "removed": true,
              "readOnly": true,
              "required": false,
              "displayName": "row_number",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "Url"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "update",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 1314611397,
          "cachedResultUrl": "",
          "cachedResultName": ""
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1eOEzWh5wWXimIGQ1h5exKGZdPd5S1e7K7erePo-f6eQ",
          "cachedResultUrl": "",
          "cachedResultName": ""
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "f8fe7ac8-5b2c-423b-999e-465b22eef8d8",
      "name": "Adding transcript to file",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        672,
        -64
      ],
      "parameters": {
        "columns": {
          "value": {
            "Url": "={{ $('Get URL to Transcript').item.json.Url }}",
            "Transcript": "={{ $json.content }}"
          },
          "schema": [
            {
              "id": "Url",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Url",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Status",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Status",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Transcript",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Transcript",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "row_number",
              "type": "number",
              "display": true,
              "removed": true,
              "readOnly": true,
              "required": false,
              "displayName": "row_number",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "Url"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "update",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 1314611397,
          "cachedResultUrl": "",
          "cachedResultName": ""
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1eOEzWh5wWXimIGQ1h5exKGZdPd5S1e7K7erePo-f6eQ",
          "cachedResultUrl": "",
          "cachedResultName": ""
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "6f8017d6-d14a-411a-9e48-3f707e46d2d4",
      "name": "Get URL to Transcript",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        224,
        -64
      ],
      "parameters": {
        "options": {
          "returnFirstMatch": true
        },
        "filtersUI": {
          "values": [
            {
              "lookupValue": "Pending",
              "lookupColumn": "Status"
            }
          ]
        },
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 1314611397,
          "cachedResultUrl": "",
          "cachedResultName": ""
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1eOEzWh5wWXimIGQ1h5exKGZdPd5S1e7K7erePo-f6eQ",
          "cachedResultUrl": "",
          "cachedResultName": ""
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "a33faf41-8e19-40b8-80fd-d24ea542018b",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "disabled": true,
      "position": [
        -48,
        -240
      ],
      "parameters": {
        "width": 872,
        "height": 476,
        "content": "## Generating Transcript \nHere we get transcript.\nI use supadata.ai. There are 100 free credit"
      },
      "typeVersion": 1
    },
    {
      "id": "954acc03-f58d-4008-883f-c2981a0dbeb9",
      "name": "Generating transcript",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        448,
        -64
      ],
      "parameters": {
        "url": "=https://api.supadata.ai/v1/youtube/transcript?url={{ $json.Url }}&text=true",
        "options": {
          "response": {
            "response": {
              "responseFormat": "json"
            }
          }
        },
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "x-api-key",
              "value": "ADD HERE YOUR API KEY"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "f12e32a1-7a5e-4134-8545-46d61f8ab188",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "disabled": true,
      "position": [
        832,
        -240
      ],
      "parameters": {
        "width": 748,
        "height": 476,
        "content": "## Generating Summary\nHere we generating summary\n"
      },
      "typeVersion": 1
    },
    {
      "id": "0e7b2c56-4c3a-46dc-80bf-e84e5522d182",
      "name": "Clear code",
      "type": "n8n-nodes-base.code",
      "position": [
        1152,
        -64
      ],
      "parameters": {
        "jsCode": "return items.map(item => {\n  const rawText = $input.first().json.text;\n\n \n  const cleaned = rawText\n    .replace(/^```json\\s*/, '')\n    .replace(/\\s*```$/, '')\n    .trim();\n\n  let parsed;\n  try {\n    parsed = JSON.parse(cleaned);\n  } catch (e) {\n    throw new Error('Error aprsing field \"text\".');\n  }\n\n  const data = parsed[0];\n\n  return {\n    json: {\n      summary: data.summary,\n      key_points: data.key_points.join('\\n'),\n      topics: data.topics.join(', ')\n    }\n  };\n});"
      },
      "typeVersion": 2
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "9975c464-aed1-472b-8fec-95159ea59976",
  "connections": {
    "Clear code": {
      "main": [
        [
          {
            "node": "Adding Summary to file",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Summary": {
      "main": [
        [
          {
            "node": "Clear code",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "DeepSeek Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Generate Summary",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Generating transcript": {
      "main": [
        [
          {
            "node": "Adding transcript to file",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get URL to Transcript": {
      "main": [
        [
          {
            "node": "Generating transcript",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Adding Summary to file": {
      "main": [
        []
      ]
    },
    "Adding transcript to file": {
      "main": [
        [
          {
            "node": "Generate Summary",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking \u2018Execute workflow\u2019": {
      "main": [
        [
          {
            "node": "Get URL to Transcript",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}