- Primary Keywords
- Topic Variations
- Long-Tail Keywords
Main topics and themes (highest priority)
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Discover how the SEO Optimizer Agent maximizes your video discoverability through intelligent metadata optimization
async optimize(script, strategy) {
this.logger.info(`Optimizing SEO for: ${script.title}`);
// Generate optimized title
const title = await this.optimizeTitle(script.title, strategy);
// Generate description
const description = await this.generateDescription(script, strategy);
// Extract and optimize tags
const tags = await this.generateTags(script, strategy);
// Generate hashtags
const hashtags = await this.generateHashtags(strategy);
// Create chapters/timestamps
const chapters = await this.generateChapters(script);
// Generate end screen elements
const endScreen = await this.generateEndScreenStrategy();
// Calculate SEO score
const seoScore = await this.calculateSEOScore(title, description, tags);
const seoData = {
title,
description,
tags,
hashtags,
chapters,
endScreen,
seoScore,
metadata: {
primaryKeyword: strategy.keywords[0],
secondaryKeywords: strategy.keywords.slice(1, 5),
targetLength: this.calculateOptimalLength(strategy.contentType),
language: 'en',
category: this.selectCategory(strategy)
},
createdAt: new Date().toISOString()
};
await this.db.saveSEOData(seoData);
return seoData;
}
async optimizeTitle(originalTitle, strategy) {
let optimizedTitle = originalTitle;
// Add power words if not present
const powerWords = ['Ultimate', 'Complete', 'Essential', 'Proven',
'Secret', 'Amazing', 'Powerful'];
const hasPowerWord = powerWords.some(word =>
originalTitle.toLowerCase().includes(word.toLowerCase())
);
if (!hasPowerWord && originalTitle.length < 60) {
const randomPowerWord = powerWords[Math.floor(Math.random() * powerWords.length)];
optimizedTitle = `${randomPowerWord} ${originalTitle}`;
}
// Add year if relevant and not present
const currentYear = new Date().getFullYear();
if (!optimizedTitle.includes(currentYear.toString()) && optimizedTitle.length < 70) {
optimizedTitle = `${optimizedTitle} (${currentYear})`;
}
// Ensure primary keyword is in title
const primaryKeyword = strategy.keywords[0];
if (primaryKeyword && !optimizedTitle.toLowerCase().includes(primaryKeyword.toLowerCase())) {
optimizedTitle = `${optimizedTitle} - ${primaryKeyword}`;
}
// Truncate if too long (YouTube limit: 100 characters)
if (optimizedTitle.length > 100) {
optimizedTitle = optimizedTitle.substring(0, 97) + '...';
}
return this.titleCase(optimizedTitle);
}
Optimal Length: 60-70 Characters
if (title.length >= 60 && title.length <= 70) score += 10;
Include Power Words
const powerWords = ['Ultimate', 'Complete', 'Essential', 'Proven', 'Secret'];
Add Numbers
if (/\d/.test(title)) score += 5;
Use Current Year
if (title.includes(new Date().getFullYear().toString())) score += 5;
async generateDescription(script, strategy) {
let description = '';
// First 125 characters - most important for SEO
const hook = `${script.title} - In this video, you'll discover ${strategy.angle.toLowerCase()}.`;
description += hook + '\n\n';
// Video overview
description += '📺 WHAT YOU\'LL LEARN:\n';
if (script.mainContent && script.mainContent.sections) {
script.mainContent.sections.slice(0, 5).forEach(section => {
description += `• ${section.title}\n`;
});
}
description += '\n';
// Timestamps/Chapters
description += '⏱️ TIMESTAMPS:\n';
description += '00:00 Introduction\n';
let timestamp = 20;
script.mainContent.sections.forEach(section => {
const minutes = Math.floor(timestamp / 60);
const seconds = timestamp % 60;
description += `${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')} ${section.title}\n`;
timestamp += section.duration || 60;
});
// ... additional sections
return description;
}
async generateTags(script, strategy) {
const tags = new Set();
// Add primary keywords
strategy.keywords.forEach(keyword => tags.add(keyword));
// Add topic variations
const topic = strategy.topic.toLowerCase();
tags.add(topic);
tags.add(topic.replace(/\s+/g, ''));
tags.add(topic.replace(/\s+/g, '_'));
// Add content type tags
const contentTypeTags = {
'Tutorial': ['how to', 'tutorial', 'guide', 'step by step', 'learn'],
'Explainer': ['explained', 'what is', 'understanding', 'explanation'],
'Review': ['review', 'comparison', 'vs', 'best', 'top'],
'List': ['top 10', 'best', 'list', 'countdown'],
'Story': ['story', 'journey', 'experience', 'case study']
};
const typeTags = contentTypeTags[strategy.contentType] || [];
typeTags.forEach(tag => tags.add(tag));
// Add long-tail keywords
const longTailKeywords = this.generateLongTailKeywords(strategy);
longTailKeywords.forEach(keyword => tags.add(keyword));
// Ensure total doesn't exceed 500 characters
const tagArray = Array.from(tags);
const prioritizedTags = this.prioritizeTags(tagArray, strategy);
let totalLength = 0;
const finalTags = [];
for (const tag of prioritizedTags) {
if (totalLength + tag.length + 1 <= 500) {
finalTags.push(tag);
totalLength += tag.length + 1;
}
}
return finalTags;
}
strategy.keywords.forEach(keyword => tags.add(keyword));
tags.add(topic);
tags.add(topic.replace(/\s+/g, '')); // "aitrends"
tags.add(topic.replace(/\s+/g, '_')); // "ai_trends"
'Tutorial': ['how to', 'tutorial', 'guide', 'step by step']
`how to ${strategy.topic}`
`${strategy.topic} for beginners`
async generateChapters(script) {
const chapters = [];
let currentTime = 0;
// Introduction
chapters.push({
time: '00:00',
title: 'Introduction',
seconds: 0
});
currentTime = 20; // Intro duration
// Main content chapters
script.mainContent.sections.forEach(section => {
const minutes = Math.floor(currentTime / 60);
const seconds = currentTime % 60;
const timeString = `${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}`;
chapters.push({
time: timeString,
title: section.title || 'Section',
seconds: currentTime
});
currentTime += section.duration || 60;
});
return chapters;
}
async calculateSEOScore(title, description, tags) {
let score = 0;
// Title scoring (30 points max)
if (title.length >= 60 && title.length <= 70) score += 10;
else if (title.length >= 50 && title.length <= 100) score += 5;
if (/\d/.test(title)) score += 5; // Contains number
if (/[A-Z]/.test(title)) score += 5; // Proper capitalization
if (title.includes(new Date().getFullYear().toString())) score += 5;
if (['how', 'what', 'why', 'best', 'top'].some(word =>
title.toLowerCase().includes(word))) score += 5;
// Description scoring (40 points max)
if (description.length >= 200) score += 10;
if (description.length >= 500) score += 10;
if (description.includes('TIMESTAMPS')) score += 5;
if (description.includes('http')) score += 5;
if (description.split('\n').length > 10) score += 5;
if (description.substring(0, 125).includes(tags[0])) score += 5;
// Tags scoring (30 points max)
if (tags.length >= 10) score += 10;
if (tags.length >= 15) score += 5;
if (tags.some(tag => tag.split(' ').length > 2)) score += 5;
if (tags.join('').length <= 500) score += 5;
if (new Set(tags).size === tags.length) score += 5;
return Math.min(100, score);
}
selectCategory(strategy) {
const categories = {
'technology': 28, // Science & Technology
'gaming': 20, // Gaming
'education': 27, // Education
'business': 27, // Education (closest match)
'lifestyle': 22, // People & Blogs
'health': 26, // Howto & Style
'entertainment': 24 // Entertainment
};
const niche = this.identifyNiche(strategy);
return categories[niche] || 22; // Default to People & Blogs
}
async generateHashtags(strategy) {
const hashtags = [];
// Primary hashtag
hashtags.push(`#${strategy.topic.replace(/\s+/g, '')}`);
// Content type hashtag
hashtags.push(`#${strategy.contentType.toLowerCase()}`);
// Niche-specific hashtags
const niche = this.identifyNiche(strategy);
const nicheHashtags = {
'technology': ['#tech', '#technology', '#innovation'],
'gaming': ['#gaming', '#gamer', '#games'],
'education': ['#education', '#learning', '#study']
};
hashtags.push(...(nicheHashtags[niche] || []).slice(0, 2));
// General engagement hashtags
hashtags.push('#youtube', '#viral', '#trending');
// Limit to 15 hashtags (YouTube recommendation)
return hashtags.slice(0, 15);
}
{
"title": "Ultimate AI Technology Trends (2026) - Complete Guide",
"description": "Ultimate AI Technology Trends (2026) - Complete Guide - In this video, you'll discover ai technology trends: what nobody is telling you.\n\n📺 WHAT YOU'LL LEARN:\n• Deep Dive\n• Real-World Examples\n\n⏱️ TIMESTAMPS:\n00:00 Introduction\n00:20 Deep Dive\n01:50 Real-World Examples\n...",
"tags": [
"technology",
"trends",
"ai technology",
"how to ai technology",
"ai technology for beginners",
"tutorial",
"guide",
"2026"
],
"hashtags": [
"#aitechnology",
"#explainer",
"#tech",
"#technology",
"#youtube",
"#trending"
],
"seoScore": 87,
"metadata": {
"primaryKeyword": "technology",
"secondaryKeywords": ["trends", "artificial", "intelligence"],
"targetLength": "5-10 minutes",
"language": "en",
"category": 28
}
}
Front-Load Keywords
Use All Available Space
Include Timestamps
Monitor SEO Score