How to extract YouTube transcripts in a workflow

You get an n8n workflow that pulls the transcript of each YouTube video you list and files it in Notion with the title, channel, views, language and the full text. YouTube's official captions.download only works for videos you have permission to edit and costs 200 quota units per download, so public videos need a hosted transcript tool like the one this workflow calls.

Do it now

The workflow from YouTube transcripts to Notion, ready to import into n8n: YouTube Caption & Whisper AI Transcript Extractor on Apify, then Notion.

n8n workflowyoutube-transcripts-to-notion.n8n.json

Actor on Apify
{
  "name": "YouTube transcripts to Notion",
  "nodes": [
    {
      "id": "f9a2555a-34fc-4eb6-af83-9fab894e14e3",
      "name": "Run by hand",
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        0,
        0
      ],
      "parameters": {}
    },
    {
      "id": "3eb67cba-4372-4380-a012-2599c8ad1ad3",
      "name": "Every day",
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.2,
      "position": [
        0,
        200
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "triggerAtHour": 8
            }
          ]
        }
      },
      "notes": "Activate the workflow to run on this schedule."
    },
    {
      "id": "f8f70f7e-55a1-426d-a972-f4a42f93b6cb",
      "name": "Run Apify Actor",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        260,
        100
      ],
      "parameters": {
        "method": "POST",
        "url": "https://api.apify.com/v2/actors/nimbryxo-studio~youtube-caption-and-whisper-ai-transcript/run-sync-get-dataset-items",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "{\n  \"mode\": \"videos\",\n  \"videoUrls\": [\n    \"https://www.youtube.com/watch?v=jNQXAC9IVRw\"\n  ],\n  \"includeAutoGenerated\": true,\n  \"useWhisper\": true,\n  \"whisperModel\": \"tiny\",\n  \"includeWordTimings\": false,\n  \"proxyCountry\": \"GB\"\n}",
        "options": {
          "timeout": 310000
        }
      },
      "notes": "Actor: nimbryxo-studio/youtube-caption-and-whisper-ai-transcript. Select a Header Auth credential: name Authorization, value Bearer + your Apify token. Edit the JSON body to change the input.",
      "notesInFlow": false
    },
    {
      "id": "152fae2a-ee17-48ae-ab4c-e4d3446a182b",
      "name": "Only records not sent before",
      "type": "n8n-nodes-base.removeDuplicates",
      "typeVersion": 2,
      "position": [
        500,
        100
      ],
      "parameters": {
        "operation": "removeItemsSeenInPreviousExecutions",
        "logic": "removeItemsWithAlreadySeenKeyValues",
        "dedupeValue": "={{ $json.video_id }}",
        "options": {
          "scope": "node",
          "historySize": 10000
        }
      },
      "notes": "Remembers each video_id it has passed on (up to 10,000) across runs, so a record is sent once. Needs n8n 1.64 or later."
    },
    {
      "id": "e318ffea-1be5-4c08-a183-cd85021aedaf",
      "name": "Keep main fields",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        740,
        100
      ],
      "parameters": {
        "jsCode": "// Keeps the Actor's main fields as flat, spreadsheet-safe values.\nconst columns = [\"title\",\"views\",\"canonicalUrl\",\"inputUrl\",\"video_id\",\"channel_name\",\"publishedAt\",\"transcript_language\",\"segment_count\",\"success\",\"transcript_available\",\"transcript_source\",\"accessStatus\",\"errorCode\",\"full_text\"];\n// A dotted name such as author.name reads the nested value.\nconst read = (obj, key) => (key in obj ? obj[key] : key.split('.').reduce((v, part) => (v && typeof v === 'object' ? v[part] : undefined), obj));\nreturn $input.all().map((item) => {\n  const row = {};\n  const present = columns.filter((key) => read(item.json, key) !== undefined);\n  // A record shaped differently from the published schema keeps its own fields rather than arriving blank.\n  for (const key of present.length >= 2 ? present : Object.keys(item.json)) {\n    const value = read(item.json, key);\n    row[key] = value === null || value === undefined ? '' : typeof value === 'object' ? JSON.stringify(value) : value;\n  }\n  return { json: row };\n});"
      }
    },
    {
      "id": "8a32b812-4547-4a68-aa4f-0dd12f22f1c3",
      "name": "Send to Notion",
      "type": "n8n-nodes-base.notion",
      "typeVersion": 2.2,
      "position": [
        980,
        100
      ],
      "parameters": {
        "resource": "databasePage",
        "databaseId": {
          "__rl": true,
          "value": "",
          "mode": "list"
        },
        "title": "={{ [$json.title].filter((v) => v !== undefined && v !== null && v !== '').join(': ') || 'Untitled' }}",
        "propertiesUi": {
          "propertyValues": []
        },
        "blockUi": {
          "blockValues": [
            {
              "type": "paragraph",
              "textContent": "={{ [[\"views\", $json.views], [\"canonicalUrl\", $json.canonicalUrl], [\"inputUrl\", $json.inputUrl], [\"video_id\", $json.video_id], [\"channel_name\", $json.channel_name], [\"publishedAt\", $json.publishedAt], [\"transcript_language\", $json.transcript_language], [\"segment_count\", $json.segment_count], [\"success\", $json.success], [\"transcript_available\", $json.transcript_available]].filter(([, v]) => v !== undefined && v !== null && v !== '').map(([k, v]) => k + ': ' + (typeof v === 'object' ? JSON.stringify(v) : v)).join(' | ').slice(0, 1900) || ' ' }}"
            },
            {
              "type": "paragraph",
              "textContent": "={{ String($json.full_text ?? '').slice(0, 1900) || ' ' }}"
            },
            {
              "type": "paragraph",
              "textContent": "={{ String($json.full_text ?? '').slice(1900, 3800) || ' ' }}"
            },
            {
              "type": "paragraph",
              "textContent": "={{ String($json.full_text ?? '').slice(3800, 5700) || ' ' }}"
            },
            {
              "type": "paragraph",
              "textContent": "={{ String($json.full_text ?? '').slice(5700, 7600) || ' ' }}"
            },
            {
              "type": "paragraph",
              "textContent": "={{ String($json.full_text ?? '').slice(7600, 9500) || ' ' }}"
            },
            {
              "type": "paragraph",
              "textContent": "={{ String($json.full_text ?? '').slice(9500, 11400) || ' ' }}"
            },
            {
              "type": "paragraph",
              "textContent": "={{ String($json.full_text ?? '').slice(11400, 13300) || ' ' }}"
            },
            {
              "type": "paragraph",
              "textContent": "={{ String($json.full_text ?? '').slice(13300, 15200) || ' ' }}"
            }
          ]
        },
        "options": {}
      },
      "notes": "Pick your Notion database. Each page gets the record's main fields and the first 15200 characters of full_text as its content; map extra database properties if you want to filter on them."
    },
    {
      "id": "c04abe52-f683-4924-a56c-adc189e23f67",
      "name": "Setup",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        0,
        -370
      ],
      "parameters": {
        "content": "## YouTube Caption & Whisper AI Transcript Extractor\n\nSource: [nimbryxo-studio/youtube-caption-and-whisper-ai-transcript](https://apify.com/nimbryxo-studio/youtube-caption-and-whisper-ai-transcript) on Apify.\n\n1. In **Run Apify Actor**, create a Header Auth credential: name `Authorization`, value `Bearer YOUR_APIFY_TOKEN` with your token.\n2. Open **Send to Notion** and connect your Notion account.\n3. Edit the JSON body of **Run Apify Actor** to change the input.\n\nGenerated by recipeforagents.com. Validated, not executed: runs are billed to your Apify account.",
        "height": 340,
        "width": 460,
        "color": 6
      }
    }
  ],
  "connections": {
    "Run by hand": {
      "main": [
        [
          {
            "node": "Run Apify Actor",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Every day": {
      "main": [
        [
          {
            "node": "Run Apify Actor",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Run Apify Actor": {
      "main": [
        [
          {
            "node": "Only records not sent before",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Only records not sent before": {
      "main": [
        [
          {
            "node": "Keep main fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Keep main fields": {
      "main": [
        [
          {
            "node": "Send to Notion",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "pinData": {},
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "meta": {
    "templateCredsSetupCompleted": false
  },
  "tags": []
}
Validated, not executed: 11 of 11 checks pass
  • It has a nodes array and a connections object
  • Every node has a name, type, typeVersion, position and parameters
  • Node names are unique
  • Every node type is a known n8n core node (or the Apify node)
  • Every node uses a typeVersion that n8n ships
  • Every connection points at an existing node
  • At least one trigger starts the workflow
  • Every working node is reachable from a trigger
  • Apify calls use POST and a credential for the token
  • Actor input matches the Actor's published input schema
  • No token or credential value is embedded

The YouTube Transcripts to Notion recipe calls a hosted Actor that reads a video's captions, uses auto-generated captions when there are no manual ones, and can transcribe the audio with Whisper when a video has no captions at all. Each Notion page records which of those sources the text came from, so the workflow stays honest about where the words came from.

What you need

  • The YouTube video URLs you want transcribed.
  • n8n with an Apify Header Auth credential: name Authorization, value Bearer followed by your token.
  • A Notion database shared with your n8n Notion integration.
  • For your own channel's videos, the YouTube Data API and OAuth access if you prefer the official captions.download route.

Where it breaks

Some videos have captions turned off and no clear speech, so the transcript comes back empty with an error code in the page; check the transcript source and availability fields before you rely on a page. Notion caps the text per block, so very long transcripts arrive in several blocks and the longest are cut.

Method

  1. Import the YouTube transcripts to Notion workflow and add the Header Auth credential on Run Apify Actor with Bearer followed by your Apify API token.

  2. Put your videos in videoUrls in the JSON body; keep auto-generated captions on and Whisper on so videos without captions still get a transcript.

  3. Connect Send to Notion to your database; each page is titled with the video title and holds the channel, views, language, source and full text.

  4. Run it by hand once to check a page, then activate the daily schedule; Only records not sent before files each video ID once.

Ready-made recipe

YouTube transcripts to Notion: an n8n workflow you can import, using YouTube Caption & Whisper AI Transcript Extractor.

Troubleshooting

Why does the workflow or script stop with HTTP 408?

The synchronous endpoint waits at most 300 seconds. After that it answers 408 while the run keeps going in Apify. Lower the result limit, or start the run asynchronously, wait for it to finish and then read its dataset.

Source: Apify API: run Actor synchronously and get dataset items

What do 400, 401, 402 and 403 from the Apify API mean?

Read error.type in the response body. 400 is invalid Actor input. 401 (user-or-token-not-found) means a token reached Apify but it is wrong or revoked. 402 with x402-payment-required means no token reached Apify at all: the n8n credential or the Authorization: Bearer header is missing, and Apify is offering its pay-per-run x402 route for agents instead; any other 402 is an exhausted usage limit on the account that pays for the run. 403 is a token without permission for that Actor or storage.

Source: Apify API: authentication; Apify documentation: agentic payments with x402; Apify API: run Actor synchronously and get dataset items

n8n says Install this node to use it after import. Why?

The workflow names a node or node version your instance does not have, usually a community node. The workflows here use only built-in nodes at versions n8n has shipped since 1.80, so they import on n8n Cloud and older self-hosted instances without community nodes.

Source: n8n issue: unrecognized node type after import

Why does the HTTP Request node time out before Apify answers?

Set the node's Timeout option to at least 300000 ms so n8n waits as long as Apify's synchronous endpoint. The workflows here already set 310000. A failure at exactly 30 seconds points to a proxy in front of n8n.

Source: n8n HTTP Request node documentation

Why does starting an Actor through the API return run information instead of scraped results?

The Run Actor endpoint starts the Actor and immediately returns a Run object without waiting for completion. For results stored in the default dataset, pass the response's defaultDatasetId to Get dataset items; to wait and receive output directly, use the synchronous endpoint for dataset items or a key-value store record.

Source: Apify Run Actor API

Questions

Can I use the official YouTube API instead?

Only for videos you can edit. captions.download needs that permission and costs 200 quota units per call, so it suits your own channel, not public videos.

What if a video has no captions?

The Actor can transcribe the audio with Whisper. The Notion page shows the transcript source so you know whether the text came from captions or from speech recognition.

Can I transcribe a whole channel?

Yes. Switch the mode in the request body to a channel or playlist input, and each video becomes its own Notion page.

Will a video be filed twice?

No. The workflow remembers each video ID it has filed and skips it on later runs.

Sources