Convert YouTube videos into blog posts with Gemini API and n8n | Alpha | PandaiTech

Convert YouTube videos into blog posts with Gemini API and n8n

Build a workflow that takes a YouTube URL, retrieves the full transcript using the Gemini API, and generates a fully formatted blog article directly into Airtable.

Learning Timeline
Key Insights

Exclusive Advantage of Gemini API

Currently, only the Gemini API allows you to send a YouTube URL directly for analysis. Other models like Anthropic (Claude) or OpenAI (GPT) require the text transcript to be extracted beforehand.

Choosing the Best Model for Writing

While Gemini is powerful for video analysis, using Claude 3.5 Sonnet in this workflow is recommended for the article writing phase due to its more 'human-like' and well-structured language quality.
Prompts

Transcript Extraction Prompt (Gemini)

Target: Gemini API
Provide a word for word transcript of this video.

Blog Transformation Prompt (AI Agent)

Target: Claude 3.5 Sonnet / Gemini
You're going to get a video URL and a transcript, and this is how you should basically convert that into a well-formatted blog article.
Step by Step

Building a YouTube-to-Blog Workflow with n8n & Gemini

  1. Create a new workflow in n8n and start with the 'n8n Form Trigger' node to receive the YouTube URL input.
  2. Add an 'HTTP Request' or 'Google Gemini' node to make a custom API call to the Gemini API.
  3. Configure the JSON body in the API call by including the 'file_data' parameter that contains the YouTube URL.
  4. Enter a prompt instructing Gemini to generate a 'word-for-word' transcript from the video.
  5. Connect the transcript output to an AI Agent node (Claude 3.5 Sonnet or Gemini) for the blog writing process.
  6. Set up a System Prompt in the AI Agent node to define the writing style, header structure (H1, H2), and the inclusion of an 'embedded video'.
  7. Add an 'Airtable' node and select the 'Create a record' action.
  8. Map the markdown output from the AI Agent to the corresponding fields in Airtable.
  9. Connect the final result back to the form submission node to display the article to the user immediately.

More from Build & Deploy Autonomous AI Agents

View All