Documentation Index
Fetch the complete documentation index at: https://mintlify.com/darkzOGx/youtube-automation-agent/llms.txt
Use this file to discover all available pages before exploring further.
Overview
TheContentStrategyAgent analyzes YouTube trends, competitor channels, and historical performance to generate optimized content strategies. It identifies trending topics, selects optimal publishing times, and creates data-driven content recommendations.
Constructor
Database instance for storing and retrieving content data
Credentials manager with YouTube API access
Properties
Database connection instance
YouTube API credentials manager
Logger instance for tracking agent operations
Array of currently trending topics with scores and sources
Analysis data from competitor channels
Scheduled content calendar entries
Methods
initialize()
Initializes the agent, loads historical data, and analyzes current trends.Returns true when initialization is complete
generateContentStrategy(requestedTopic)
Generates a comprehensive content strategy for a topic.Specific topic to create strategy for. If not provided, selects optimal trending topic.
Complete content strategy object
Selected content topic
Unique content angle generated for the topic
Identified target audience demographic
Content type (Tutorial, Explainer, List, Review, Story)
Extracted keywords for SEO optimization
Predicted view count based on topic score
ISO timestamp for optimal publishing time
Insights from competitor analysis
fetchYouTubeTrends()
Fetches trending videos from YouTube API.Array of trending video data
analyzeCompetitors()
Analyzes competitor channels specified in environment variables.Competitor analysis data including top topics and performance metrics
getChannelVideos(channelId)
Retrieves recent videos from a specific channel.YouTube channel ID to analyze
Array of video details with statistics
analyzeVideoPerformance(videos)
Analyzes performance metrics for a collection of videos.Array of video objects with statistics
Performance analysis including top topics, average views, and upload frequency
Top 10 performing topics with average views
Average view count across all videos
Number of videos analyzed
extractKeywords(text)
Extracts meaningful keywords from text by filtering stop words.Text to extract keywords from
Array of extracted keywords (words > 3 characters, excluding stop words)
selectOptimalTopic()
Selects the best topic from trending topics using scoring algorithm.Selected topic with score
identifyTargetAudience(topic)
Identifies the target audience for a given topic.Content topic
Target audience description
selectContentType(topic)
Determines the optimal content type based on topic keywords.Content topic
Content type: Tutorial, List, Review, Explainer, News, or Story
calculateBestPublishTime()
Calculates the optimal publishing time based on historical performance.ISO timestamp for next optimal publish time
Environment Variables
YouTube region code for trending videos
Comma-separated list of competitor channel IDs to analyze
Usage Example
Error Handling
The agent implements comprehensive error handling:Best Practices
Optimize Trend Analysis
Optimize Trend Analysis
Call
initialize() periodically (e.g., daily) to refresh trending topics and competitor analysis. The agent caches data to minimize API calls.Configure Competitors
Configure Competitors
Set
COMPETITOR_CHANNELS environment variable with relevant channel IDs in your niche for better strategy recommendations.Monitor Historical Performance
Monitor Historical Performance
The agent learns from historical content performance. Ensure you’re saving analytics data back to the database for improved predictions.
Topic Rotation
Topic Rotation
The agent automatically avoids repeating topics within 7 days. This prevents content fatigue and maintains audience interest.