YouTube Transcript API を使って YouTube 動画 の 字幕 を抽出

中級

これはMarket Research, Miscellaneous, Multimodal AI分野の自動化ワークフローで、13個のノードを含みます。主にCode, Webhook, HttpRequest, GoogleSheets, RespondToWebhookなどのノードを使用。 Google SheetsまたはAPIウェブフックを使ってYouTubeの字幕を抽出

前提条件
  • HTTP Webhookエンドポイント(n8nが自動生成)
  • ターゲットAPIの認証情報が必要な場合あり
  • Google Sheets API認証情報
ワークフロープレビュー
ノード接続関係を可視化、ズームとパンをサポート
ワークフローをエクスポート
以下のJSON設定をn8nにインポートして、このワークフローを使用できます
{
  "name": "Extract YouTube video transcripts using YouTube Transcript API",
  "nodes": [
    {
      "id": "main-explanation-note",
      "name": "メインテンプレートの説明",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        200,
        -200
      ],
      "parameters": {
        "color": 7,
        "width": 700,
        "height": 800,
        "content": "# YouTube Transcript Extractor\n\nThis n8n template demonstrates how to extract transcripts from YouTube videos using two different approaches: automated Google Sheets monitoring and direct webhook API calls.\n\n**Use cases:** Content creation, research, accessibility, meeting notes, content repurposing, SEO analysis, or building transcript databases for analysis.\n\n## How it works\n- **Google Sheets Integration:** Monitor a sheet for new YouTube URLs and automatically extract transcripts\n- **Direct API Access:** Send YouTube URLs via webhook and get instant transcript responses\n- **Smart Parsing:** Extracts video ID from various YouTube URL formats (youtube.com, youtu.be, embed)\n- **Rich Metadata:** Returns video title, channel, publish date, duration, and category alongside transcript\n- **Fallback Handling:** Gracefully handles videos without available transcripts\n\n## Two Workflow Paths\n1. **Automated Sheet Processing:** Add URLs to Google Sheet → Auto-extract → Save results to sheet\n2. **Webhook API:** Send POST request with video URL → Get instant transcript response\n\n## How to set up\n1. Replace \"Dummy YouTube Transcript API\" credentials with your YouTube Transcript API key\n2. Create your own Google Sheet with columns: \"url\" (input sheet) and \"video title\", \"transcript\" (results sheet)\n3. Update Google Sheets credentials to connect your sheets\n4. Test each workflow path separately\n5. Customize the webhook path and authentication as needed\n\n## Requirements\n- YouTube Transcript API access (youtube-transcript.io or similar)\n- Google Sheets API credentials (for automated workflow)\n- n8n instance (cloud or self-hosted)\n- YouTube videos with available transcripts\n\n## How to customize\n- Modify transcript processing in the Code nodes\n- Add additional metadata extraction\n- Connect to other storage solutions (databases, CMS)\n- Add text analysis or summarization steps\n- Set up notifications for new transcripts"
      },
      "typeVersion": 1
    },
    {
      "id": "sheets-workflow-note",
      "name": "Sheets ワークフローノート",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        512,
        -128
      ],
      "parameters": {
        "color": 3,
        "width": 600,
        "height": 100,
        "content": "## Google Sheets Automated Processing\n\nMonitors Google Sheet for new YouTube URLs and processes them automatically"
      },
      "typeVersion": 1
    },
    {
      "id": "webhook-workflow-note",
      "name": "Webhook ワークフローノート",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        512,
        320
      ],
      "parameters": {
        "color": 4,
        "width": 600,
        "height": 100,
        "content": "## Webhook Direct Processing\n\nSend POST request with YouTube URL to get instant transcript response"
      },
      "typeVersion": 1
    },
    {
      "id": "sheets-trigger",
      "name": "URL のための Google シートを監視",
      "type": "n8n-nodes-base.googleSheetsTrigger",
      "position": [
        528,
        32
      ],
      "parameters": {
        "event": "rowAdded",
        "options": {},
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        },
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "urls",
          "cachedResultName": "urls"
        },
        "documentId": {
          "__rl": true,
          "mode": "url",
          "value": "YOUR_GOOGLE_SHEET_ID",
          "cachedResultName": "Your YouTube Transcript Sheet"
        }
      },
      "credentials": {
        "googleSheetsTriggerOAuth2Api": {
          "id": "google-sheets-credentials",
          "name": "Google Sheets API"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "extract-video-id-sheets",
      "name": "YouTube 動画 ID の抽出 (Sheets)",
      "type": "n8n-nodes-base.code",
      "position": [
        768,
        32
      ],
      "parameters": {
        "jsCode": "// Get the URL from n8n input\nconst url = $input.first().json.url;\n\n// Function to extract YouTube video ID\nfunction getVideoId(url) {\n  if (!url) return null;\n  const match = url.match(/(?:v=|youtu\\.be\\/|embed\\/)([^&\\n?#]+)/);\n  return match ? match[1] : null;\n}\n\n// Extract the video ID\nconst videoId = getVideoId(url);\n\n// Return the result for n8n\nreturn {\n  json: {\n    url: url,\n    videoId: videoId,\n    success: videoId ? true : false\n  }\n};"
      },
      "typeVersion": 2
    },
    {
      "id": "fetch-transcript-sheets",
      "name": "動画トランスクリプトデータの取得 (Sheets)",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1008,
        32
      ],
      "parameters": {
        "url": "https://www.youtube-transcript.io/api/transcripts",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"ids\": [\n    \"{{ $json.videoId }}\"\n  ]\n} ",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "={{ $credentials.youtubeTranscriptApi.token }}"
            }
          ]
        }
      },
      "credentials": {
        "youtubeTranscriptApi": {
          "id": "youtube-transcript-api",
          "name": "Dummy YouTube Transcript API"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "parse-transcript-sheets",
      "name": "トランスクリプトテキストの解析 (Sheets)",
      "type": "n8n-nodes-base.code",
      "position": [
        1232,
        32
      ],
      "parameters": {
        "jsCode": "const data = $input.first().json;\n\nreturn {\n  json: {\n    fullTranscript: data.tracks[0].transcript.map(segment => segment.text).join(' ')\n  }\n};"
      },
      "typeVersion": 2
    },
    {
      "id": "save-to-sheet",
      "name": "トランスクリプトをシートに保存",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1440,
        32
      ],
      "parameters": {
        "columns": {
          "value": {
            "transcript": "={{ $json.fullTranscript }}",
            "video title": "={{ $('Fetch Video Transcript Data (Sheets)').item.json.microformat.playerMicroformatRenderer.title.simpleText }}"
          },
          "schema": [
            {
              "id": "video title",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "video title",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "transcript",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "transcript",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "transcripts",
          "cachedResultName": "transcripts"
        },
        "documentId": {
          "__rl": true,
          "mode": "url",
          "value": "YOUR_GOOGLE_SHEET_ID",
          "cachedResultName": "Your YouTube Transcript Sheet"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "google-sheets-credentials",
          "name": "Google Sheets API"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "webhook-trigger",
      "name": "Webhook トリガー (直接入力)",
      "type": "n8n-nodes-base.webhook",
      "position": [
        512,
        464
      ],
      "webhookId": "extract-youtube-transcript",
      "parameters": {
        "path": "extract-youtube-transcript",
        "options": {},
        "httpMethod": "POST",
        "responseMode": "responseNode"
      },
      "typeVersion": 2.1
    },
    {
      "id": "extract-video-id-webhook",
      "name": "YouTube 動画 ID の抽出 (Webhook)",
      "type": "n8n-nodes-base.code",
      "position": [
        752,
        464
      ],
      "parameters": {
        "jsCode": "// Get the video_url from n8n input\nconst url = $input.first().json.body.video_url;\n\n// Function to extract YouTube video ID\nfunction getVideoId(url) {\n  if (!url) return null;\n  const match = url.match(/(?:v=|youtu\\.be\\/|embed\\/)([^&\\n?#]+)/);\n  return match ? match[1] : null;\n}\n\n// Extract the video ID\nconst videoId = getVideoId(url);\n\n// Return the result for n8n\nreturn {\n  json: {\n    url: url,\n    videoId: videoId,\n    success: !!videoId\n  }\n};\n"
      },
      "typeVersion": 2
    },
    {
      "id": "fetch-transcript-webhook",
      "name": "動画トランスクリプトデータの取得 (Webhook)",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1008,
        464
      ],
      "parameters": {
        "url": "https://www.youtube-transcript.io/api/transcripts",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"ids\": [\n    \"{{ $json.videoId }}\"\n  ]\n} ",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "={{ $credentials.youtubeTranscriptApi.token }}"
            }
          ]
        }
      },
      "credentials": {
        "youtubeTranscriptApi": {
          "id": "youtube-transcript-api",
          "name": "Dummy YouTube Transcript API"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "parse-transcript-webhook",
      "name": "トランスクリプトテキストの解析 (Webhook)",
      "type": "n8n-nodes-base.code",
      "position": [
        1264,
        464
      ],
      "parameters": {
        "jsCode": "const data = $input.first().json;\n\nlet fullTranscript = null;\n\n// ✅ If transcript exists in POST response\nif (data.tracks && data.tracks.length > 0) {\n  fullTranscript = data.tracks[0].transcript\n    .map(segment => segment.text)\n    .join(' ');\n}\n\n// ✅ Fallback if transcript missing\nif (!fullTranscript && data.microformat?.playerMicroformatRenderer?.description?.simpleText) {\n  fullTranscript = data.microformat.playerMicroformatRenderer.description.simpleText;\n}\n\nreturn {\n  json: {\n    id: data.id,\n    title: data.title,\n    channel: data.microformat?.playerMicroformatRenderer?.ownerChannelName,\n    publishDate: data.microformat?.playerMicroformatRenderer?.publishDate,\n    duration: data.microformat?.playerMicroformatRenderer?.lengthSeconds,\n    category: data.microformat?.playerMicroformatRenderer?.category,\n    fullTranscript,\n    hasTranscript: (data.tracks?.length ?? 0) > 0\n  }\n};\n\n"
      },
      "typeVersion": 2
    },
    {
      "id": "return-transcript",
      "name": "トランスクリプト応答を返す",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        1488,
        464
      ],
      "parameters": {
        "options": {},
        "respondWith": "json",
        "responseBody": "={\n  \"success\": true,\n  \"video\": {\n    \"id\": \"{{ $json.id }}\",\n    \"title\": \"{{ $json.title }}\",\n    \"channel\": \"{{ $json.channel }}\",\n    \"duration\": \"{{ $json.duration }}\",\n    \"hasTranscript\": {{ $json.hasTranscript }}\n  },\n  \"transcript\": \"{{ $json.fullTranscript }}\"\n}"
      },
      "typeVersion": 1.4
    }
  ],
  "connections": {
    "sheets-trigger": {
      "main": [
        [
          {
            "node": "extract-video-id-sheets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "parse-transcript-sheets": {
      "main": [
        [
          {
            "node": "save-to-sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "webhook-trigger": {
      "main": [
        [
          {
            "node": "extract-video-id-webhook",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "parse-transcript-webhook": {
      "main": [
        [
          {
            "node": "return-transcript",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "extract-video-id-sheets": {
      "main": [
        [
          {
            "node": "fetch-transcript-sheets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "extract-video-id-webhook": {
      "main": [
        [
          {
            "node": "fetch-transcript-webhook",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "fetch-transcript-sheets": {
      "main": [
        [
          {
            "node": "parse-transcript-sheets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "fetch-transcript-webhook": {
      "main": [
        [
          {
            "node": "parse-transcript-webhook",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
よくある質問

このワークフローの使い方は?

上記のJSON設定コードをコピーし、n8nインスタンスで新しいワークフローを作成して「JSONからインポート」を選択、設定を貼り付けて認証情報を必要に応じて変更してください。

このワークフローはどんな場面に適していますか?

中級 - 市場調査, その他, マルチモーダルAI

有料ですか?

このワークフローは完全無料です。ただし、ワークフローで使用するサードパーティサービス(OpenAI APIなど)は別途料金が発生する場合があります。

関連ワークフロー

任意の LLM モデルを使用して AI 駆動型の UX/UI プロトタイプ名を生成(テンプレート)
OpenAI を使用して UX/UI プロトタイプの多様な名称を生成する
Code
Webhook
Agent
+
Code
Webhook
Agent
9 ノードDahiana
コンテンツ作成
競合他社コンテンツギャップ分析ツール:構題マッピングの自動化
Gemini AI、Apify、Google Sheetsを使用して競合企業のコンテンツギャップを分析
If
Set
Code
+
If
Set
Code
30 ノードMychel Garzon
その他
Google Driveで保存し、TelegramでリマインドしてInstagram Reelをダウンロードを自動化
Google Drive の保存と Telegram によるリマインダーで Instagram Reel ダウンロードを自動化
If
Code
Webhook
+
If
Code
Webhook
11 ノードAryan Shinde
ファイル管理
リード呼出を自動化:VAPI、Googleスheetsへの記録、カレンダー予約
リード呼出の自動化:VAPI、Googleスプレッドシートへの記録とカレンダー予約
Set
Code
Webhook
+
Set
Code
Webhook
13 ノードMeak
コンテンツ作成
AIを活用したリード生成による不動産権益メールと電話販売
Llama AI、VAPIコール、Gmailマーケティングで不動産マーケティングを自動化する
Code
Wait
Gmail
+
Code
Wait
Gmail
23 ノードOneclick AI Squad
リードナーチャリング
ドメイン権威指標をバッチで確認し、結果をGoogleテーブルに記録
RapidAPI を使用してドメイン権威性指標をバッチで確認し、Google スプレッドシートに記録
Code
Form Trigger
Http Request
+
Code
Form Trigger
Http Request
9 ノードSk developer
市場調査
ワークフロー情報
難易度
中級
ノード数13
カテゴリー3
ノードタイプ7
難易度説明

経験者向け、6-15ノードの中程度の複雑さのワークフロー

作成者
Dahiana

Dahiana

@mssporto

No-Code Specialist with more than 10 years of experience in Digital Marketing. Currently working with Bubble. Webflow, AI, Agents and N8N.

外部リンク
n8n.ioで表示

このワークフローを共有

カテゴリー

カテゴリー: 34