YouTube Search PraisonAI Integration
Guide for integrating YouTube search capabilities with PraisonAI agents using the YouTube Search API
from praisonaiagents import Agent
agent = Agent(
name="YouTubeAgent",
instructions="Extract and analyse YouTube video content.",
)
agent.start("Summarise the key points from this video: https://www.youtube.com/watch?v=example")The user shares a video link or search topic; the agent finds content and summarises transcripts or metadata.
YouTube Search PraisonAI Integration
pip install youtube_search praisonai langchain_community langchain# tools.py
from langchain_community.tools import YouTubeSearchTool# agents.yaml
framework: crewai
topic: research about the causes of lung disease
agents: # Canonical: use 'agents' instead of 'roles'
research_analyst:
instructions: # Canonical: use 'instructions' instead of 'backstory' Experienced in analyzing scientific data related to respiratory health.
goal: Analyze data on lung diseases
role: Research Analyst
tasks:
data_analysis:
description: Gather and analyze data on the causes and risk factors of lung
diseases.
expected_output: Report detailing key findings on lung disease causes.
tools:
- 'YouTubeSearchTool'Quick Start
- Install
bash pip install praisonaiagents youtube-transcript-api - Extract video content with agent
python from praisonaiagents import Agent agent = Agent( name="YouTubeAgent", instructions="Extract and analyze YouTube video content.", ) agent.start("Summarize the key points from this video: https://www.youtube.com/watch?v=example")
Best Practices
Use transcript extraction for content analysis
YouTube transcripts provide the full spoken content – much richer than titles or descriptions.
Search before extracting
Search for videos first, then extract transcripts from the most relevant ones.
Handle missing transcripts
Not all videos have transcripts – always check for None before processing.
Chunk long transcripts
Long video transcripts may exceed context limits – chunk them into segments for analysis.