AutomationFlowsAI & RAG › Youtube Shorts Generator

Youtube Shorts Generator

youtube-shorts-generator. Uses executeCommand, readWriteFile, crypto, googleSheets. Event-driven trigger; 18 nodes.

Event trigger★★★★☆ complexityAI-powered18 nodesExecute CommandRead Write FileCryptoGoogle SheetsYouTubeAgentGoogle Gemini ChatOutput Parser Structured
AI & RAG Trigger: Event Nodes: 18 Complexity: ★★★★☆ AI nodes: yes Added:

This workflow follows the Agent → Google Sheets recipe pattern — see all workflows that pair these two integrations.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "name": "youtube-shorts-generator",
  "nodes": [
    {
      "parameters": {
        "command": "=yt-dlp -f bestvideo+bestaudio --merge-output-format mp4 -o \"{{ $json.data }}top.mp4\" {{ $json.top }}"
      },
      "type": "n8n-nodes-base.executeCommand",
      "typeVersion": 1,
      "position": [
        1880,
        -240
      ],
      "id": "8d039931-d6e9-4585-ac96-68d5c68e3779",
      "name": "Execute Command2"
    },
    {
      "parameters": {
        "command": "=yt-dlp -f bestvideo+bestaudio --merge-output-format mp4 -o \"{{ $('Crypto').item.json.data }}bot.mp4\" {{ $('Limit').item.json.bot }}"
      },
      "type": "n8n-nodes-base.executeCommand",
      "typeVersion": 1,
      "position": [
        2080,
        -240
      ],
      "id": "4b0a340b-6b22-4584-bb43-9ac6daba491d",
      "name": "Execute Command3"
    },
    {
      "parameters": {
        "fileSelector": "=/home/node/{{ $('Crypto').item.json.data }}vert.mp4",
        "options": {}
      },
      "type": "n8n-nodes-base.readWriteFile",
      "typeVersion": 1,
      "position": [
        1520,
        0
      ],
      "id": "3dafcc51-7438-4e7b-904f-f0fa5aea61c0",
      "name": "Read/Write Files from Disk"
    },
    {
      "parameters": {
        "command": "=yt-dlp --write-auto-sub --convert-subs=srt --sub-lang tr --skip-download -o \"{{ $('Crypto').item.json.data }}srt\" {{ $('Limit').item.json.top }}\n"
      },
      "type": "n8n-nodes-base.executeCommand",
      "typeVersion": 1,
      "position": [
        1720,
        0
      ],
      "id": "6ae7b058-9ed6-4f5e-9694-1d7e715db411",
      "name": "Execute Command1"
    },
    {
      "parameters": {
        "command": "=ffmpeg -i {{ $('Crypto').item.json.data }}vert.mp4 \\\n-vf \"subtitles={{ $('Crypto').item.json.data }}srt.tr.srt:force_style='Fontname=Gill\\ Sans\\ MT,Fontsize=12,borderstyle=3,outline=3,OutlineColour=&H80000000,PrimaryColour=&H0000d7ff,Alignment=10'\" \\\n-c:a copy {{ $('Crypto').item.json.data }}output.mp4"
      },
      "type": "n8n-nodes-base.executeCommand",
      "typeVersion": 1,
      "position": [
        1940,
        0
      ],
      "id": "f776994e-75cb-469c-b88a-084b1b8d7ea6",
      "name": "Execute Command4"
    },
    {
      "parameters": {
        "action": "generate"
      },
      "type": "n8n-nodes-base.crypto",
      "typeVersion": 1,
      "position": [
        1680,
        -240
      ],
      "id": "f0bf1f51-bff4-444d-a288-26d88e67c09b",
      "name": "Crypto"
    },
    {
      "parameters": {
        "fileSelector": "=/home/node/{{ $('Crypto').item.json.data }}bot.mp4",
        "options": {}
      },
      "type": "n8n-nodes-base.readWriteFile",
      "typeVersion": 1,
      "position": [
        1120,
        0
      ],
      "id": "3de96625-965d-4d35-a309-66298f8a3d5d",
      "name": "Read/Write Files from Disk2"
    },
    {
      "parameters": {},
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        1060,
        -240
      ],
      "id": "72f083ff-792c-4ace-9bb0-24c5bfaaf84e",
      "name": "When clicking \u2018Execute workflow\u2019"
    },
    {
      "parameters": {
        "documentId": {
          "__rl": true,
          "value": "1MjtmEVHBa6vuxakm3fJBVNjFC-fBWqmC3J_tBqfqc7A",
          "mode": "list",
          "cachedResultName": "youtube-short-links",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1MjtmEVHBa6vuxakm3fJBVNjFC-fBWqmC3J_tBqfqc7A/edit?usp=drivesdk"
        },
        "sheetName": {
          "__rl": true,
          "value": "gid=0",
          "mode": "list",
          "cachedResultName": "Sayfa1",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1MjtmEVHBa6vuxakm3fJBVNjFC-fBWqmC3J_tBqfqc7A/edit#gid=0"
        },
        "options": {
          "dataLocationOnSheet": {
            "values": {
              "rangeDefinition": "specifyRange",
              "firstDataRow": "={{ $today.day + 1 }}"
            }
          }
        }
      },
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.6,
      "position": [
        1260,
        -240
      ],
      "id": "d797b462-df82-49b8-878c-80ea90d7b139",
      "name": "Google Sheets",
      "alwaysOutputData": true,
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {},
      "type": "n8n-nodes-base.limit",
      "typeVersion": 1,
      "position": [
        1460,
        -240
      ],
      "id": "d349efda-1f34-48b3-ab9b-e317a0f97d7e",
      "name": "Limit"
    },
    {
      "parameters": {
        "command": "=ffmpeg -i \"{{ $('Crypto').item.json.data }}top.mp4\" \\\n  -i \"{{ $('Crypto').item.json.data }}bot.mp4\" \\\n  -filter_complex \"\n  [0:v]crop=iw:ih*0.5:0:ih*0.25[top];\n  [1:v]crop=iw:ih*0.5:0:ih*0.25[bot];\n  [top][bot]vstack=inputs=2[out]\n  \" \\\n  -map \"[out]\" -map 0:a \\\n  -c:v libx264 -crf 18 -preset veryfast \\\n  -c:a aac -b:a 128k \\\n  \"{{ $('Crypto').item.json.data }}vert.mp4\"\n"
      },
      "type": "n8n-nodes-base.executeCommand",
      "typeVersion": 1,
      "position": [
        1320,
        0
      ],
      "id": "539d0a34-0362-466d-9722-4fea0bc4bb51",
      "name": "Execute Command5"
    },
    {
      "parameters": {
        "resource": "video",
        "operation": "upload",
        "title": "={{ $('AI Agent').item.json.output.title }}",
        "regionCode": "TR",
        "categoryId": "1",
        "options": {
          "description": "={{ $('AI Agent').item.json.output.title }}",
          "tags": "={{ $('AI Agent').item.json.output.tags }}"
        }
      },
      "type": "n8n-nodes-base.youTube",
      "typeVersion": 1,
      "position": [
        1920,
        300
      ],
      "id": "d193e961-033b-4322-9db1-1f587c3191ec",
      "name": "YouTube",
      "credentials": {
        "youTubeOAuth2Api": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "jsCode": "const binaryData = items[0].binary.data.data;\nconst vttText = Buffer.from(binaryData, 'base64').toString('utf-8');\n\nconst lines = vttText.split('\\n');\n\nconst filteredLines = lines.filter(line => {\n  // Sadece bo\u015f olmayan sat\u0131rlar ve \"WEBVTT\" hari\u00e7\n  return line.trim() !== '' && line !== 'WEBVTT';\n});\n\nitems[0].json.cleanedVtt = filteredLines.join('\\n');\nreturn items;\n"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        1120,
        300
      ],
      "id": "3bfddbfc-f982-4990-b519-d935acbc1086",
      "name": "Code"
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "={{ $json.cleanedVtt }}\n\nyukar\u0131daki scripte bak bu script t\u00fcrk\u00e7e bir i\u00e7eriktir ve komik bir i\u00e7eriktir. \u0130\u00e7erikte mizah ama\u00e7lanm\u0131\u015ft\u0131r. \u0130\u00e7erikle ilgili tag'leri ve title'\u0131 \u00fcret.\n\u00d6rnek \u00e7\u0131kt\u0131:\ntitle:\"\",\ntags:\"tag1,tag2\" bo\u015f olan k\u0131s\u0131mlar\u0131 videoya g\u00f6re doldur.\n\n",
        "hasOutputParser": true,
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 1.9,
      "position": [
        1300,
        300
      ],
      "id": "b8302f9b-e8a3-402a-a690-f9d7fbc3b526",
      "name": "AI Agent"
    },
    {
      "parameters": {
        "modelName": "models/gemini-2.0-flash-thinking-exp",
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "typeVersion": 1,
      "position": [
        1280,
        520
      ],
      "id": "618bca69-01f0-41f1-9931-37945eb8447a",
      "name": "Google Gemini Chat Model",
      "credentials": {
        "googlePalmApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "jsonSchemaExample": "{\n\t\"title\": \"title\",\n\t\"tags\": \"tag1,tag2\"\n}"
      },
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "typeVersion": 1.2,
      "position": [
        1480,
        520
      ],
      "id": "c7da1735-56b6-4a84-ad31-de940a3adef8",
      "name": "Structured Output Parser"
    },
    {
      "parameters": {
        "fileSelector": "=/home/node/{{ $('Crypto').item.json.data }}srt.tr.srt",
        "options": {}
      },
      "type": "n8n-nodes-base.readWriteFile",
      "typeVersion": 1,
      "position": [
        2140,
        0
      ],
      "id": "5fe5e43e-2105-48bb-86dd-d76832a3f829",
      "name": "Read/Write Files from Disk3"
    },
    {
      "parameters": {
        "fileSelector": "=/home/node/{{ $('Crypto').item.json.data }}output.mp4",
        "options": {}
      },
      "type": "n8n-nodes-base.readWriteFile",
      "typeVersion": 1,
      "position": [
        1660,
        300
      ],
      "id": "1e443da2-e833-4382-8c77-29f2154e2dbf",
      "name": "Read/Write Files from Disk1"
    }
  ],
  "connections": {
    "Execute Command2": {
      "main": [
        [
          {
            "node": "Execute Command3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Execute Command3": {
      "main": [
        [
          {
            "node": "Read/Write Files from Disk2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Read/Write Files from Disk": {
      "main": [
        [
          {
            "node": "Execute Command1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Execute Command1": {
      "main": [
        [
          {
            "node": "Execute Command4",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Execute Command4": {
      "main": [
        [
          {
            "node": "Read/Write Files from Disk3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Crypto": {
      "main": [
        [
          {
            "node": "Execute Command2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Read/Write Files from Disk2": {
      "main": [
        [
          {
            "node": "Execute Command5",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking \u2018Execute workflow\u2019": {
      "main": [
        [
          {
            "node": "Google Sheets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Sheets": {
      "main": [
        [
          {
            "node": "Limit",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Limit": {
      "main": [
        [
          {
            "node": "Crypto",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Execute Command5": {
      "main": [
        [
          {
            "node": "Read/Write Files from Disk",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "AI Agent",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "Read/Write Files from Disk1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Read/Write Files from Disk3": {
      "main": [
        [
          {
            "node": "Code",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Read/Write Files from Disk1": {
      "main": [
        [
          {
            "node": "YouTube",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "569d19c8-25c0-4e7a-87be-296704b53757",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "id": "hpluTYnF4bNTsQPD",
  "tags": []
}

Credentials you'll need

Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.

Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

youtube-shorts-generator. Uses executeCommand, readWriteFile, crypto, googleSheets. Event-driven trigger; 18 nodes.

Source: https://gist.github.com/omergocmen/efb10f602dfe55e56ac641e63295dfd2 — original creator credit. Request a take-down →

More AI & RAG workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

AI & RAG

🪄 Prompt To Video (MagicHour API) with Music & YouTube

Google Sheets Trigger, Chat Trigger, Agent +6
AI & RAG

Scale short-form content without scaling your team. This template turns idea discovery → prompt & text generation → Veo-3 video rendering → vertical formatting → multi-channel publishing into one cohe

YouTube, Google Gemini Chat, Output Parser Structured +6
AI & RAG

Community nodes can only be installed on self-hosted instances of n8n.

N8N Nodes Mcp, Agent, Google Gemini Chat +5
AI & RAG

NCompanyProfiling. Uses agent, lmChatGoogleGemini, mongoDb, outputParserStructured. Event-driven trigger; 11 nodes.

Agent, Google Gemini Chat, MongoDB +3
AI & RAG

NCompanyProfiling. Uses agent, lmChatGoogleGemini, mongoDb, outputParserStructured. Event-driven trigger; 11 nodes.

Agent, Google Gemini Chat, MongoDB +3