N8n youtube summarize videos workflow (+ template)

N8n youtube summarize videos workflow (+ template)

Brief Summary

This tutorial explains how to create an N8N automation to summarize YouTube videos using Google Gemini. It covers setting up a workflow from scratch, obtaining video transcripts using Apify, formatting the transcript for AI processing, and using Google Gemini to generate a concise summary. The tutorial also demonstrates how to integrate the summarizer into a Telegram bot for on-the-go summaries.

  • Setting up N8N workflow from scratch
  • Using Apify to get YouTube transcripts
  • Formatting transcripts for AI
  • Summarizing with Google Gemini
  • Integrating with Telegram bot

Introduction

The video introduces a solution for quickly summarizing lengthy YouTube videos using AI. It promises a tutorial on setting up an N8N automation that retrieves YouTube transcripts and uses Google Gemini to create concise summaries, all for free. The presenter, Ysqander, emphasizes a step-by-step approach, starting from a blank account to ensure clarity and replicability for viewers.

Setting Up the Workflow

Ysqander begins by creating a new workflow in N8N, named "YouTube video summarizer." The first step involves adding an "Execute Sub Workflow" node, configured to be triggered by another workflow. A field named "query" is added to accept a YouTube video URL as input. Mock data, including a sample YouTube video link, is used for testing purposes. The input field "query" is then renamed to "YouTube URL" for clarity in subsequent steps.

Fetching Transcripts with Apify

The next step involves adding an HTTP Request node to fetch the transcript from Apify, a service providing access to various scrapers and APIs. Ysqander guides viewers to sign up on Apify, obtain their API token, and configure generic credentials in N8N using the Query Auth type. The API token is then used to authenticate the request to Apify's "caramel YouTube transcripts" scraper. The necessary parameters, including the YouTube URL, are sent in the request body as JSON.

Formatting the Transcript

After successfully retrieving the transcript from Apify, Ysqander adds a Code node to format the transcript for better processing by the LLM. The JavaScript code cleans up HTML symbols and standardizes punctuation to ensure clean text. The code iterates through each item in the captions, performs the necessary cleaning, and compiles the transcript into a single block of text, along with the video ID for tracking.

AI Summarization with Google Gemini

Ysqander adds an "LLM Chain" node to generate the AI summary. The prompt is defined as "summarize the transcript below," and the transcript from the Code node is fed into it. A Google Gemini chat model is selected, requiring new credentials. Ysqander demonstrates how to obtain an API key from Google Cloud Console by creating a new project, enabling the Gemini API, and generating the API key. The API key is then used to create the Google Gemini credentials in N8N.

Finalizing the Workflow and Testing

To finalize the workflow, Ysqander adds a "Set Field" node to track the video ID and the generated summary for debugging purposes. The video ID from the Code node and the summary text from the LLM Chain node are mapped to the output. The entire workflow is tested to ensure everything functions correctly, and the final output, including the video ID and summary, is verified.

Integration with Telegram

Ysqander showcases his setup, which integrates the YouTube video summarizer with a Telegram bot. He references a video by Leon van Zyl for setting up the Telegram personal assistant. Ysqander tests the summarizer by sending a YouTube video link to his Telegram bot and receiving a concise summary in return, demonstrating the convenience of on-the-go video summarization.

Watch the Video

Share

Stay Informed with Quality Articles

Discover curated summaries and insights from across the web. Save time while staying informed.

© 2024 BriefRead