Skip to main content

πŸš€ Process YouTube transcripts with Apify, OpenAI & Pinecone database

Workflow preview

Workflow preview
100%
πŸš€ Process YouTube transcripts with Apify, OpenAI & Pinecone database preview
Open on n8n.io

Important notice

This workflow is provided as-is. Please review and test before using in production.

1. Workflow Overview

YouTube Transcript Indexing Backend for Pinecone This tutorial explains how to build the backend workflow in n8n that indexes YouTube video transcripts into a Pinecone vector database. Note...

Best for

  • Document Extraction automation workflows
  • AI RAG automation workflows
  • advanced n8n builders looking for reusable templates

Tools used

n8n-nodes-base.airtable, n8n-nodes-base.splitinbatches, n8n-nodes-base.wait, n8n-nodes-base.httprequest, n8n-nodes-base.code, n8n-nodes-base.set, @n8n/n8n-nodes-langchain.vectorstorepinecone, @n8n/n8n-nodes-langchain.embeddingsopenai

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by Adyl Itto.

Original n8n.io source

1.1 Workflow description

Title
πŸš€ Process YouTube transcripts with Apify, OpenAI & Pinecone database
Workflow name
πŸš€ Process YouTube transcripts with Apify, OpenAI & Pinecone database

πŸš€ YouTube Transcript Indexing Backend for Pinecone πŸŽ₯πŸ’Ύ

This tutorial explains how to build the backend workflow in n8n that indexes YouTube video transcripts into a Pinecone vector database. Note: This workflow handles the processing and indexing of transcripts onlyβ€”the retrieval agent (which searches these embeddings) is implemented separately.


πŸ“‹ Workflow Overview

This backend workflow performs the following tasks:

  1. Fetch Video Records from Airtable πŸ“₯
    Retrieves video URLs and related metadata.

  2. Scrape YouTube Transcripts Using Apify 🎬
    Triggers an Apify actor to scrape transcripts with timestamps from each video.

  3. Update Airtable with Transcript Data πŸ”„
    Stores the fetched transcript JSON back in Airtable linked via video ID.

  4. Process & Chunk Transcripts βœ‚οΈ
    Parses the transcript JSON, converts "mm:ss" timestamps to seconds, and groups entries into meaningful chunks. Each chunk is enriched with metadataβ€”such as video title, description, start/end timestamps, and a direct URL linking to that video moment.

  5. Generate Embeddings & Index in Pinecone πŸ’Ύ
    Uses OpenAI to create vector embeddings for each transcript chunk and indexes them in Pinecone. This enables efficient semantic searches later by a separate retrieval agent.


πŸ”§ Step-by-Step Guide

Step 1: Retrieve Video Records from Airtable πŸ“₯

  • Airtable Search Node:

    • Setup: Configure the node to fetch video records (with essential fields like url and metadata) from your Airtable base.
  • Loop Over Items:

    • Use a SplitInBatches node to process each video record individually.

Step 2: Scrape YouTube Transcripts Using Apify 🎬

  • Trigger Apify Actor:

    • HTTP Request Node ("Apify NinjaPost"):
      • Method: POST
      • Endpoint: https://api.apify.com/v2/acts/topaz_sharingan~youtube-transcript-scraper-1/runs?token=<YOUR_TOKEN>
      • Payload Example:
        {
          "includeTimestamps": "Yes",
          "startUrls": ["{{ $json.url }}"]
        }
        
    • Purpose: Initiates transcript scraping for each video URL.
  • Wait for Processing:

    • Wait Node:
      • Duration: Approximately 1 minute to allow Apify to generate the transcript.
  • Retrieve Transcript Data:

    • HTTP Request Node ("Get JSON TS"):
      • Method: GET
      • Endpoint: https://api.apify.com/v2/acts/topaz_sharingan~youtube-transcript-scraper-1/runs/last/dataset/items?token=<YOUR_TOKEN>

Step 3: Update Airtable with Transcript Data πŸ”„

  • Format Transcript Data:

    • Code Node ("Code"):
      • Task: Convert the fetched transcript JSON into a formatted string.
        const jsonObject = items[0].json;
        const jsonString = JSON.stringify(jsonObject, null, 2);
        return { json: { stringifiedJson: jsonString } };
        
  • Extract the Video ID:

    • Set Node ("Edit Fields"):
      • Expression:
        {{$json.url.split('v=')[1].split('&')[0]}}
        
  • Update Airtable Record:

    • Airtable Update Node ("Airtable1"):
      • Updates:
        • ts: Stores the transcript string.
        • videoid: Uses the extracted video ID to match the record.

Step 4: Process Transcripts into Semantic Chunks βœ‚οΈ

  • Retrieve Updated Records:

    • Airtable Search Node ("Airtable2"):
      • Purpose: Fetch records that now contain transcript data.
  • Parse and Chunk Transcripts:

    • Code Node ("Code4"):
      • Functionality:
        • Parses transcript JSON.
        • Converts "mm:ss" timestamps to seconds.
        • Groups transcript entries into chunks based on a 3-second gap.
        • Creates an object for each chunk that includes:
          • Text: The transcript segment.
          • Video Metadata: Video ID, title, description, published date, thumbnail.
          • Chunk Details: Start and end timestamps.
          • Direct URL: A link to the exact moment in the video (e.g., https://youtube.com/watch?v=VIDEOID&t=XXs).
  • Enrich & Split Text:

    • Default Data Loader Node:
      • Attaches additional metadata (e.g., video title, description) to each chunk.
    • Recursive Character Text Splitter Node:
      • Settings: Typically set to 500-character chunks with a 50-character overlap.
      • Purpose: Ensures long transcript texts are broken into manageable segments for embedding.

Step 5: Generate Embeddings & Index in Pinecone πŸ’Ύ

  • Generate Embeddings:

    • Embeddings OpenAI Node:
      • Task: Convert each transcript chunk into a vector embedding.
      • Tip: Adjust the batch size (e.g., 512) based on your data volume.
  • Index in Pinecone:

    • Pinecone Vector Store Node:
      • Configuration:
        • Index: Specify your Pinecone index (e.g., "videos").
        • Namespace: Use a dedicated namespace (e.g., "transcripts").
      • Outcome: Each enriched transcript chunk is stored in Pinecone, ready for semantic retrieval by a separate retrieval agent.

πŸŽ‰ Final Thoughts

This backend workflow is dedicated to processing and indexing YouTube video transcripts so that a separate retrieval agent can perform efficient semantic searches. With this setup:

  • Transcripts Are Indexed:
    Chunks of transcripts are enriched with metadata and stored as vector embeddings.

  • Instant Topic Retrieval:
    A retrieval agent (implemented separately) can later query Pinecone to find the exact moment in a video where a topic is discussed, thanks to the direct URL and metadata stored with each chunk.

  • Scalable & Modular:
    The separation between indexing and retrieval allows for easy updates and scalability.

Happy automating and enjoy building powerful search capabilities with your YouTube content! πŸŽ‰

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - Airtable

Type / Role
n8n-nodes-base.airtable - airtable
Config choices
Version 2.1

Block 2 - Loop Over Items

Type / Role
n8n-nodes-base.splitInBatches - splitInBatches
Config choices
Version 3

Block 3 - Airtable1

Type / Role
n8n-nodes-base.airtable - airtable
Config choices
Version 2.1

Block 4 - Wait

Type / Role
n8n-nodes-base.wait - wait
Config choices
Version 1.1

Block 5 - Apify NinjaPost

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.2

Block 6 - Get JSON TS

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.2

Block 7 - JSON Stringifier

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 8 - Edit Fields

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 9 - Airtable2

Type / Role
n8n-nodes-base.airtable - airtable
Config choices
Version 2.1

Block 10 - Pinecone Vector Store

Type / Role
@n8n/n8n-nodes-langchain.vectorStorePinecone - vectorStorePinecone
Config choices
Version 1

Block 11 - Embeddings OpenAI

Type / Role
@n8n/n8n-nodes-langchain.embeddingsOpenAi - embeddingsOpenAi
Config choices
Version 1.2

Block 12 - When clicking β€˜Test workflow’

Type / Role
n8n-nodes-base.manualTrigger - manualTrigger
Config choices
Version 1

Block 13 - Transcript Processor

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 14 - Default Data Loader

Type / Role
@n8n/n8n-nodes-langchain.documentDefaultDataLoader - documentDefaultDataLoader
Config choices
Version 1

Block 15 - Recursive Character Text Splitter1

Type / Role
@n8n/n8n-nodes-langchain.textSplitterRecursiveCharacterTextSplitter - textSplitterRecursiveCharacterTextSplitter
Config choices
Version 1

Block 16 - Installation Tutorial

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

3. Summary Table

Workflow πŸš€ Process YouTube transcripts with Apify, OpenAI & Pinecone database
Complexity advanced
Nodes 16
Categories Document Extraction, AI RAG
Author Adyl Itto
Published 16 Mar 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/3184/3184.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does πŸš€ Process YouTube transcripts with Apify, OpenAI & Pinecone database do?

YouTube Transcript Indexing Backend for Pinecone This tutorial explains how to build the backend workflow in n8n that indexes YouTube video transcripts into a Pinecone vector database. Note...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your Document Extraction, AI RAG use case.