├── .babelrc ├── .dockerignore ├── .env.example ├── .eslintrc.json ├── .gitignore ├── .prettierrc ├── Dockerfile ├── LICENSE ├── Makefile ├── README.md ├── assets ├── images │ ├── banner1.png │ └── banner2.png └── videos │ ├── demo.mp4 │ └── intro.mp4 ├── docs ├── guides │ ├── setup_guide.md │ └── usage_guide.md └── references │ ├── api_reference.md │ └── developer_notes.md ├── package.json ├── public └── templates │ └── videoTemplate.mp4 ├── src ├── config │ └── config.js ├── controllers │ ├── audioController.js │ ├── commentController.js │ ├── videoController.js │ └── youtubeController.js ├── extra_modules │ ├── module1.js │ ├── module2.js │ └── module3.js ├── index.js ├── mock_data │ ├── data1.json │ ├── data2.json │ └── data3.json ├── routes │ └── api.js ├── services │ ├── aiPersonaService.js │ ├── commentAnalysisService.js │ ├── gameplayService.js │ ├── textToSpeechService.js │ ├── text_analysis.rs │ ├── trendAnalysisService.js │ ├── trendAnalysisService.ts │ ├── videoGenerationService.js │ └── youtubeService.js ├── tests │ ├── test1.spec.js │ ├── test2.spec.js │ └── test3.spec.js └── utils │ ├── configValidator.js │ └── logger.js ├── start_project.sh ├── tools ├── configs │ ├── config1.yml │ └── config2.yml └── scripts │ ├── build_script.sh │ └── deploy_script.sh └── tsconfig.json /.babelrc: -------------------------------------------------------------------------------- 1 | 2 | { 3 | "presets": [ 4 | "@babel/preset-env", 5 | "@babel/preset-react" 6 | ], 7 | "plugins": [ 8 | "@babel/plugin-transform-runtime" 9 | ] 10 | } 11 | -------------------------------------------------------------------------------- /.dockerignore: -------------------------------------------------------------------------------- 1 | 2 | node_modules 3 | npm-debug.log 4 | Dockerfile 5 | .dockerignore 6 | .env 7 | coverage 8 | -------------------------------------------------------------------------------- /.env.example: -------------------------------------------------------------------------------- 1 | 2 | GOOGLE_API_KEY=your-google-api-key 3 | YOUTUBE_API_KEY=your-youtube-api-key 4 | APP_PORT=3000 5 | -------------------------------------------------------------------------------- /.eslintrc.json: -------------------------------------------------------------------------------- 1 | 2 | { 3 | "env": { 4 | "browser": true, 5 | "es2021": true 6 | }, 7 | "extends": [ 8 | "eslint:recommended", 9 | "plugin:react/recommended" 10 | ], 11 | "parserOptions": { 12 | "ecmaFeatures": { 13 | "jsx": true 14 | }, 15 | "ecmaVersion": 12, 16 | "sourceType": "module" 17 | }, 18 | "plugins": [ 19 | "react" 20 | ], 21 | "rules": { 22 | "semi": ["error", "always"], 23 | "quotes": ["error", "double"] 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | node_modules/ 3 | .env 4 | dist/ 5 | coverage/ 6 | .DS_Store 7 | logs/ 8 | *.log 9 | *.bak 10 | -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | 2 | { 3 | "semi": true, 4 | "singleQuote": false, 5 | "printWidth": 80, 6 | "tabWidth": 2, 7 | "trailingComma": "all" 8 | } 9 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | 2 | # Use official Node.js LTS image 3 | FROM node:16 4 | 5 | # Set working directory 6 | WORKDIR /app 7 | 8 | # Copy package files and install dependencies 9 | COPY package*.json ./ 10 | RUN npm install 11 | 12 | # Copy application files 13 | COPY . . 14 | 15 | # Expose application port 16 | EXPOSE 3000 17 | 18 | # Start the application 19 | CMD ["npm", "start"] 20 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2025 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | 2 | install: 3 | npm install 4 | 5 | start: 6 | npm start 7 | 8 | test: 9 | npm test 10 | 11 | lint: 12 | npm run lint 13 | 14 | build: 15 | npm run build 16 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 🚀 SmartCreator AI: Redefining YouTube Content Creation with Advanced AI 2 | 3 | ![SmartCreator AI Header](https://i.ibb.co/hx5mnJk/DALL-E-2025-01-05-22-31-1.png) 4 | 5 | SmartCreator AI is **not just a tool**—it's your **ultimate AI-powered YouTube partner**, capable of managing every aspect of your content creation journey. From generating high-quality videos to engaging with your audience, SmartCreator AI combines the power of AI and automation to unlock endless possibilities for creators. 6 | 7 | Imagine a future where your channel grows autonomously, with videos posted daily, comments replied to intelligently, and your audience kept engaged—all while you sit back and focus on your creative vision. 8 | 9 | --- 10 | 11 | ## 🌟 Key Highlights 12 | 13 | | **Feature** | **Description** | **What Makes It Unique?** | 14 | |----------------------------|-----------------------------------------------------------------------------------------------------|----------------------------------------------------------------| 15 | | 🎥 **Video Generation** | Automatically create videos with visuals, voiceovers, and subtitles in minutes. | AI reacts to gameplay, auto-fills trending keywords. | 16 | | 🗣️ **Voice Customization** | Full control over tone, pitch, language, and personality of the voiceover. | Clone voices or create entirely unique personalities. | 17 | | 📅 **Automated Scheduling**| Publish videos at peak audience times with metadata optimized for reach. | Integrated audience analytics ensure maximum engagement. | 18 | | 💬 **Audience Interaction**| Respond to comments, start polls, and moderate discussions autonomously. | Human-like empathy and tone for authentic interactions. | 19 | | 🔍 **Trend Integration** | Analyze trending topics and auto-generate content ideas to stay relevant. | Competitor insights and AI-suggested topics included. | 20 | | 📊 **Advanced Analytics** | Gain actionable insights into video performance and audience retention. | AI provides solutions for better watch time and engagement. | 21 | | 🤖 **Dynamic Personalities**| AI adapts its tone and style based on audience feedback and content needs. | Real-time learning ensures long-term audience loyalty. | 22 | | 🕹️ **Gameplay AI** | Commentate on gameplay or interact with live gaming sessions as if playing. | Hyper-realistic reactions to in-game events. | 23 | | 🎭 **AI Skits & Stories** | Create engaging storylines or skits with multiple AI characters and voices. | Expand into storytelling or entertainment effortlessly. | 24 | 25 | --- 26 | 27 | ## 🌌 Unparalleled Features 28 | 29 | ### 1. **Content Creation Redefined** 30 | - Generate **studio-grade videos** with: 31 | - AI-generated intros, outros, and transitions. 32 | - Integrated sound effects and background music selection. 33 | - Automated subtitles in **50+ languages**. 34 | - AI-powered **gameplay reaction videos**: 35 | - Your AI can narrate gameplay, react to moments, and strategize like a pro. 36 | 37 | ### 2. **Voice Personalization Beyond Limits** 38 | - Choose from **thousands of voice options** across multiple accents and languages. 39 | - Adjust **intonation**, **emotion**, and **pacing** to craft the perfect voiceover. 40 | - **Upload a reference audio clip** for AI voice cloning. 41 | 42 | | **Feature** | **Description** | **Example Use Case** | 43 | |----------------------|------------------------------------|------------------------------------------------------| 44 | | Voice Emotion Control| AI can express joy, anger, or calm| Use a cheerful tone for fun content, serious for news| 45 | | Multilingual Support | AI speaks 50+ languages fluently | Expand your reach to global audiences. | 46 | | Celebrity Voice Clone| Mimic iconic voices (ethical use) | Add familiar tones to your narration. | 47 | 48 | ### 3. **Full Automation Suite** 49 | - **Dynamic Scheduling**: 50 | - Post at **peak times** based on audience analytics. 51 | - Automatically queue weekly or monthly content plans. 52 | - **SEO Optimization**: 53 | - Auto-generate titles, tags, and descriptions for better discoverability. 54 | - Create engaging thumbnails using AI. 55 | 56 | ### 4. **AI-Driven Audience Engagement** 57 | - Respond to comments in real time with **context-aware replies**. 58 | - Start **community polls** and discussions based on trending topics. 59 | - **Moderate comments** with AI to filter out spam or offensive content. 60 | 61 | | **Interaction Type** | **AI Behavior** | **Benefit** | 62 | |-----------------------|---------------------------------------------------------|------------------------------------------------------| 63 | | Comment Replies | Human-like, witty, and empathetic | Strengthens community trust. | 64 | | Community Posts | Initiate polls, share updates, and ask questions | Keeps your audience engaged and informed. | 65 | | Spam Detection | Filters harmful or irrelevant comments automatically | Saves time and ensures a healthy comment section. | 66 | 67 | --- 68 | 69 | ## 🔮 The Future of SmartCreator AI 70 | 71 | We’re constantly innovating! Here’s a glimpse of what’s next: 72 | 73 | | **Feature** | **Planned Release** | **Description** | 74 | |-------------------------|---------------------|---------------------------------------------------------------------------------| 75 | | **Live AI Streaming** | Q3 2025 | Real-time AI interaction during live streams, including Q&A and narration. | 76 | | **AI-Generated Ads** | Q4 2025 | Create high-converting ads tailored for your audience. | 77 | | **Virtual Reality** | Q2 2026 | Generate immersive VR content with interactive AI narration. | 78 | | **NFT Integration** | Q4 2026 | Convert exclusive content into NFTs for fan engagement and monetization. | 79 | 80 | --- 81 | 82 | ## 🌟 Why Creators Love SmartCreator AI 83 | 84 | - **Monetization Boost**: Maximize your revenue with AI-optimized videos and SEO strategies. 85 | - **Global Reach**: Multilingual capabilities allow you to connect with audiences worldwide. 86 | - **Effortless Scalability**: Manage thousands of videos and interactions without breaking a sweat. 87 | 88 | | **Problem** | **Solution with SmartCreator AI** | 89 | |--------------------------------|------------------------------------------------------| 90 | | Inconsistent Upload Schedule | AI automates scheduling, ensuring consistency. | 91 | | Limited Audience Interaction | AI replies to comments and initiates discussions. | 92 | | Time-Intensive Editing | AI handles editing, subtitles, and audio seamlessly. | 93 | 94 | --- 95 | 96 | ## 📖 How It Works 97 | 98 | 1. **Input Your Idea**: Provide a text prompt or let AI suggest topics. 99 | 2. **Choose Your Persona**: Select or customize your AI’s personality and voice. 100 | 3. **Generate and Publish**: Watch your video come to life and auto-upload to YouTube. 101 | 4. **Engage with Your Fans**: Let AI handle comments and community engagement. 102 | 103 | --- 104 | 105 | ## 📬 Get Started 106 | 1. **Documentation**: https://smartcreatoria.gitbook.io/ 107 | 2. **Download**: Clone the repository or access the desktop app. 108 | 3. **Create Your First Video**: Let AI handle the hard work while you enjoy the results. 109 | 110 | --- 111 | -------------------------------------------------------------------------------- /assets/images/banner1.png: -------------------------------------------------------------------------------- 1 | Placeholder content for banner1.png 2 | -------------------------------------------------------------------------------- /assets/images/banner2.png: -------------------------------------------------------------------------------- 1 | Placeholder content for banner2.png 2 | -------------------------------------------------------------------------------- /assets/videos/demo.mp4: -------------------------------------------------------------------------------- 1 | Placeholder content for demo.mp4 2 | -------------------------------------------------------------------------------- /assets/videos/intro.mp4: -------------------------------------------------------------------------------- 1 | Placeholder content for intro.mp4 2 | -------------------------------------------------------------------------------- /docs/guides/setup_guide.md: -------------------------------------------------------------------------------- 1 | Placeholder content for setup_guide.md 2 | -------------------------------------------------------------------------------- /docs/guides/usage_guide.md: -------------------------------------------------------------------------------- 1 | Placeholder content for usage_guide.md 2 | -------------------------------------------------------------------------------- /docs/references/api_reference.md: -------------------------------------------------------------------------------- 1 | Placeholder content for api_reference.md 2 | -------------------------------------------------------------------------------- /docs/references/developer_notes.md: -------------------------------------------------------------------------------- 1 | Placeholder content for developer_notes.md 2 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | 2 | { 3 | "name": "nodejs-ai-video-project", 4 | "version": "1.0.0", 5 | "description": "A project to create AI-generated videos with voiceovers for YouTube.", 6 | "main": "src/index.js", 7 | "scripts": { 8 | "start": "node src/index.js" 9 | }, 10 | "dependencies": { 11 | "express": "^4.18.2", 12 | "google-text-to-speech": "^3.1.0", 13 | "ffmpeg-static": "^4.4.0", 14 | "fluent-ffmpeg": "^2.1.2", 15 | "googleapis": "^100.0.0", 16 | "dotenv": "^16.0.3" 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /public/templates/videoTemplate.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SmartCreatorAI/SmartCreatorIA/d4dc93f829ebb72deb7974c17d14a01327ae5a64/public/templates/videoTemplate.mp4 -------------------------------------------------------------------------------- /src/config/config.js: -------------------------------------------------------------------------------- 1 | 2 | module.exports = { 3 | googleApiKey: process.env.GOOGLE_API_KEY, 4 | youtubeApiKey: process.env.YOUTUBE_API_KEY, 5 | }; 6 | -------------------------------------------------------------------------------- /src/controllers/audioController.js: -------------------------------------------------------------------------------- 1 | 2 | const ttsService = require('../services/textToSpeechService'); 3 | 4 | exports.generateAudio = async (req, res) => { 5 | try { 6 | const audioPath = await ttsService.generateAudio(req.body.text); 7 | res.status(200).json({ message: 'Audio created', audioPath }); 8 | } catch (error) { 9 | res.status(500).json({ error: error.message }); 10 | } 11 | }; 12 | -------------------------------------------------------------------------------- /src/controllers/commentController.js: -------------------------------------------------------------------------------- 1 | const commentAnalysisService = require('../services/commentAnalysisService'); 2 | 3 | exports.respondToComment = async (req, res) => { 4 | try { 5 | const { comment } = req.body; 6 | if (!comment) throw new Error("Comment text is required."); 7 | 8 | const response = await commentAnalysisService.generateReply(comment); 9 | res.status(200).json({ reply: response }); 10 | } catch (error) { 11 | res.status(500).json({ error: error.message }); 12 | } 13 | }; -------------------------------------------------------------------------------- /src/controllers/videoController.js: -------------------------------------------------------------------------------- 1 | 2 | const videoService = require('../services/videoGenerationService'); 3 | 4 | exports.generateVideo = async (req, res) => { 5 | try { 6 | const videoPath = await videoService.createVideo(req.body.text); 7 | res.status(200).json({ message: 'Video created', videoPath }); 8 | } catch (error) { 9 | res.status(500).json({ error: error.message }); 10 | } 11 | }; 12 | -------------------------------------------------------------------------------- /src/controllers/youtubeController.js: -------------------------------------------------------------------------------- 1 | 2 | const youtubeService = require('../services/youtubeService'); 3 | 4 | exports.uploadVideo = async (req, res) => { 5 | try { 6 | const uploadStatus = await youtubeService.upload(req.body.videoPath, req.body.title, req.body.description); 7 | res.status(200).json({ message: 'Video uploaded', uploadStatus }); 8 | } catch (error) { 9 | res.status(500).json({ error: error.message }); 10 | } 11 | }; -------------------------------------------------------------------------------- /src/extra_modules/module1.js: -------------------------------------------------------------------------------- 1 | Placeholder content for module1.js 2 | -------------------------------------------------------------------------------- /src/extra_modules/module2.js: -------------------------------------------------------------------------------- 1 | Placeholder content for module2.js 2 | -------------------------------------------------------------------------------- /src/extra_modules/module3.js: -------------------------------------------------------------------------------- 1 | Placeholder content for module3.js 2 | -------------------------------------------------------------------------------- /src/index.js: -------------------------------------------------------------------------------- 1 | require('dotenv').config(); 2 | const express = require('express'); 3 | const routes = require('./routes/api'); 4 | const { log } = require('./utils/logger'); 5 | const { errorHandler } = require('./utils/errorHandler'); 6 | 7 | const app = express(); 8 | const PORT = process.env.PORT || 3000; 9 | 10 | app.use(express.json()); 11 | app.use('/api', routes); 12 | 13 | // Custom middleware to log requests 14 | app.use((req, res, next) => { 15 | log(`Incoming request: ${req.method} ${req.url}`); 16 | next(); 17 | }); 18 | 19 | // Error handler middleware 20 | app.use(errorHandler); 21 | 22 | app.listen(PORT, () => log(`Server running on port ${PORT}`)); -------------------------------------------------------------------------------- /src/mock_data/data1.json: -------------------------------------------------------------------------------- 1 | Placeholder content for data1.json 2 | -------------------------------------------------------------------------------- /src/mock_data/data2.json: -------------------------------------------------------------------------------- 1 | Placeholder content for data2.json 2 | -------------------------------------------------------------------------------- /src/mock_data/data3.json: -------------------------------------------------------------------------------- 1 | Placeholder content for data3.json 2 | -------------------------------------------------------------------------------- /src/routes/api.js: -------------------------------------------------------------------------------- 1 | const express = require('express'); 2 | const videoController = require('../controllers/videoController'); 3 | const audioController = require('../controllers/audioController'); 4 | const youtubeController = require('../controllers/youtubeController'); 5 | const commentController = require('../controllers/commentController'); 6 | 7 | const router = express.Router(); 8 | 9 | router.post('/generate-video', videoController.generateVideo); 10 | router.post('/generate-audio', audioController.generateAudio); 11 | router.post('/upload', youtubeController.uploadVideo); 12 | router.post('/comment', commentController.respondToComment); 13 | 14 | module.exports = router; -------------------------------------------------------------------------------- /src/services/aiPersonaService.js: -------------------------------------------------------------------------------- 1 | exports.getVoiceOptions = () => { 2 | return [ 3 | { id: 1, name: "Friendly Voice", pitch: 1.2, speed: 1.0 }, 4 | { id: 2, name: "Professional Voice", pitch: 0.8, speed: 0.9 }, 5 | { id: 3, name: "Energetic Voice", pitch: 1.5, speed: 1.2 } 6 | ]; 7 | }; 8 | 9 | exports.customizePersona = (settings) => { 10 | // Simulate applying AI persona settings 11 | return `Persona updated with settings: ${JSON.stringify(settings)}`; 12 | }; -------------------------------------------------------------------------------- /src/services/commentAnalysisService.js: -------------------------------------------------------------------------------- 1 | const axios = require('axios'); 2 | 3 | exports.generateReply = async (comment) => { 4 | // Simulate AI response generation (can integrate OpenAI API or other ML models) 5 | const predefinedReplies = [ 6 | "Thank you for your feedback!", 7 | "That's an interesting point!", 8 | "We appreciate your support!" 9 | ]; 10 | 11 | // Placeholder logic to pick a random reply 12 | const reply = predefinedReplies[Math.floor(Math.random() * predefinedReplies.length)]; 13 | return reply; 14 | }; -------------------------------------------------------------------------------- /src/services/gameplayService.js: -------------------------------------------------------------------------------- 1 | const fs = require('fs'); 2 | 3 | exports.analyzeGameplay = async (videoPath) => { 4 | if (!fs.existsSync(videoPath)) throw new Error("Gameplay video not found."); 5 | 6 | // Placeholder logic for analysis 7 | const events = [ 8 | { timestamp: 10, action: "Player scored!" }, 9 | { timestamp: 20, action: "Enemy defeated!" } 10 | ]; 11 | 12 | return events.map(event => `At ${event.timestamp}s: ${event.action}`); 13 | }; -------------------------------------------------------------------------------- /src/services/textToSpeechService.js: -------------------------------------------------------------------------------- 1 | const fs = require('fs'); 2 | const util = require('util'); 3 | const textToSpeech = require('@google-cloud/text-to-speech'); 4 | 5 | const client = new textToSpeech.TextToSpeechClient(); 6 | 7 | exports.generateAudio = async (text, options = {}) => { 8 | if (!text) throw new Error("Text is required for TTS generation."); 9 | 10 | const { 11 | languageCode = 'en-US', 12 | ssmlGender = 'NEUTRAL', 13 | speakingRate = 1.0, 14 | pitch = 0.0, 15 | } = options; 16 | 17 | const request = { 18 | input: { text }, 19 | voice: { languageCode, ssmlGender }, 20 | audioConfig: { audioEncoding: 'MP3', speakingRate, pitch }, 21 | }; 22 | 23 | const [response] = await client.synthesizeSpeech(request); 24 | 25 | const writeFile = util.promisify(fs.writeFile); 26 | const outputPath = './public/uploads/audio.mp3'; 27 | 28 | await writeFile(outputPath, response.audioContent, 'binary'); 29 | return outputPath; 30 | }; -------------------------------------------------------------------------------- /src/services/text_analysis.rs: -------------------------------------------------------------------------------- 1 | use std::collections::HashMap; 2 | 3 | /// Analyze word frequency and additional text statistics. 4 | pub struct TextAnalysisResult { 5 | pub word_frequencies: HashMap, 6 | pub total_words: usize, 7 | pub unique_words: usize, 8 | pub average_word_length: f64, 9 | pub most_frequent_word: Option<(String, usize)>, 10 | } 11 | 12 | /// Analyze text for word frequency and other statistics. 13 | pub fn analyze_text(text: &str, stop_words: Option>) -> TextAnalysisResult { 14 | let stop_words_set: HashMap = stop_words 15 | .unwrap_or_default() 16 | .into_iter() 17 | .map(|word| (word.to_string(), true)) 18 | .collect(); 19 | 20 | let mut word_frequencies = HashMap::new(); 21 | let mut total_word_length = 0; 22 | 23 | for word in text.split_whitespace() { 24 | let word_cleaned = word.to_lowercase(); 25 | if stop_words_set.contains_key(&word_cleaned) { 26 | continue; 27 | } 28 | let count = word_frequencies.entry(word_cleaned.clone()).or_insert(0); 29 | *count += 1; 30 | total_word_length += word_cleaned.len(); 31 | } 32 | 33 | let total_words = word_frequencies.values().sum::(); 34 | let unique_words = word_frequencies.len(); 35 | let average_word_length = if total_words > 0 { 36 | total_word_length as f64 / total_words as f64 37 | } else { 38 | 0.0 39 | }; 40 | 41 | let most_frequent_word = word_frequencies 42 | .iter() 43 | .max_by_key(|&(_, count)| count) 44 | .map(|(word, count)| (word.clone(), *count)); 45 | 46 | TextAnalysisResult { 47 | word_frequencies, 48 | total_words, 49 | unique_words, 50 | average_word_length, 51 | most_frequent_word, 52 | } 53 | } 54 | 55 | #[cfg(test)] 56 | mod tests { 57 | use super::*; 58 | 59 | #[test] 60 | fn test_analyze_text() { 61 | let text = "Hello world Hello Rust Rust Rust programming"; 62 | let result = analyze_text(text, None); 63 | 64 | assert_eq!(result.total_words, 6); 65 | assert_eq!(result.unique_words, 4); 66 | assert_eq!(result.word_frequencies.get("hello"), Some(&2)); 67 | assert_eq!(result.word_frequencies.get("rust"), Some(&3)); 68 | assert_eq!(result.word_frequencies.get("programming"), Some(&1)); 69 | assert!(result.average_word_length > 0.0); 70 | assert_eq!(result.most_frequent_word, Some(("rust".to_string(), 3))); 71 | } 72 | 73 | #[test] 74 | fn test_analyze_text_with_stop_words() { 75 | let text = "Hello world Hello Rust Rust Rust programming"; 76 | let stop_words = vec!["hello", "rust"]; 77 | let result = analyze_text(text, Some(stop_words)); 78 | 79 | assert_eq!(result.total_words, 2); 80 | assert_eq!(result.unique_words, 2); 81 | assert_eq!(result.word_frequencies.get("world"), Some(&1)); 82 | assert_eq!(result.word_frequencies.get("programming"), Some(&1)); 83 | assert_eq!(result.most_frequent_word, Some(("world".to_string(), 1))); 84 | } 85 | 86 | #[test] 87 | fn test_empty_text() { 88 | let text = ""; 89 | let result = analyze_text(text, None); 90 | 91 | assert_eq!(result.total_words, 0); 92 | assert_eq!(result.unique_words, 0); 93 | assert_eq!(result.average_word_length, 0.0); 94 | assert_eq!(result.most_frequent_word, None); 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /src/services/trendAnalysisService.js: -------------------------------------------------------------------------------- 1 | const axios = require('axios'); 2 | 3 | exports.getTrendingTopics = async (region = 'US') => { 4 | try { 5 | // Simulated API call (replace with actual YouTube or trend API) 6 | const trendingTopics = [ 7 | "AI-generated content", 8 | "Top 10 gameplay tips", 9 | "Best productivity hacks" 10 | ]; 11 | 12 | return trendingTopics; 13 | } catch (error) { 14 | throw new Error("Failed to fetch trending topics."); 15 | } 16 | }; -------------------------------------------------------------------------------- /src/services/trendAnalysisService.ts: -------------------------------------------------------------------------------- 1 | interface Trend { 2 | keyword: string; 3 | popularity: number; 4 | } 5 | 6 | /** 7 | * Simulate fetching trending topics. 8 | */ 9 | export const getTrendingTopics = async (): Promise => { 10 | const simulatedTrends: Trend[] = [ 11 | { keyword: "AI Content Creation", popularity: 92 }, 12 | { keyword: "YouTube Growth Tips", popularity: 85 }, 13 | { keyword: "Top Gaming Strategies", popularity: 78 }, 14 | ]; 15 | 16 | return simulatedTrends.sort((a, b) => b.popularity - a.popularity); 17 | }; 18 | 19 | /** 20 | * Suggest topics based on a keyword. 21 | * @param keyword The keyword to search trends for. 22 | */ 23 | export const suggestTopics = async (keyword: string): Promise => { 24 | const trends = await getTrendingTopics(); 25 | return trends.filter(trend => trend.keyword.toLowerCase().includes(keyword.toLowerCase())); 26 | }; -------------------------------------------------------------------------------- /src/services/videoGenerationService.js: -------------------------------------------------------------------------------- 1 | const ffmpeg = require('fluent-ffmpeg'); 2 | const path = require('path'); 3 | 4 | exports.createVideo = async (text, options = {}) => { 5 | const { 6 | inputImage = './public/templates/videoTemplate.mp4', 7 | audioPath = './public/uploads/audio.mp3', 8 | outputFormat = 'mp4', 9 | subtitles = null, 10 | } = options; 11 | 12 | const outputVideo = `./public/uploads/output.${outputFormat}`; 13 | 14 | return new Promise((resolve, reject) => { 15 | let command = ffmpeg(inputImage) 16 | .input(audioPath) 17 | .videoCodec('libx264') 18 | .audioCodec('aac') 19 | .format(outputFormat) 20 | .outputOptions('-shortest') // Ensures video length matches audio 21 | .output(outputVideo); 22 | 23 | if (subtitles) { 24 | const subtitlesPath = path.resolve('./public/uploads/subtitles.srt'); 25 | fs.writeFileSync(subtitlesPath, subtitles, 'utf-8'); 26 | command = command.input(subtitlesPath).outputOptions('-vf subtitles=subtitles.srt'); 27 | } 28 | 29 | command 30 | .on('end', () => resolve(outputVideo)) 31 | .on('error', reject) 32 | .run(); 33 | }); 34 | }; -------------------------------------------------------------------------------- /src/services/youtubeService.js: -------------------------------------------------------------------------------- 1 | const { google } = require('googleapis'); 2 | const fs = require('fs'); 3 | 4 | exports.upload = async (videoPath, { title, description, tags = [], playlistId = null }) => { 5 | if (!fs.existsSync(videoPath)) throw new Error("Video file not found."); 6 | 7 | const auth = new google.auth.GoogleAuth({ 8 | keyFile: './config/credentials.json', 9 | scopes: ['https://www.googleapis.com/auth/youtube.upload'], 10 | }); 11 | 12 | const youtube = google.youtube({ version: 'v3', auth }); 13 | 14 | const requestBody = { 15 | snippet: { 16 | title, 17 | description, 18 | tags, 19 | }, 20 | status: { 21 | privacyStatus: 'public', 22 | }, 23 | }; 24 | 25 | if (playlistId) { 26 | requestBody.snippet.playlistId = playlistId; 27 | } 28 | 29 | const response = await youtube.videos.insert({ 30 | part: 'snippet,status', 31 | requestBody, 32 | media: { body: fs.createReadStream(videoPath) }, 33 | }); 34 | 35 | return response.data; 36 | }; -------------------------------------------------------------------------------- /src/tests/test1.spec.js: -------------------------------------------------------------------------------- 1 | Placeholder content for test1.spec.js 2 | -------------------------------------------------------------------------------- /src/tests/test2.spec.js: -------------------------------------------------------------------------------- 1 | Placeholder content for test2.spec.js 2 | -------------------------------------------------------------------------------- /src/tests/test3.spec.js: -------------------------------------------------------------------------------- 1 | Placeholder content for test3.spec.js 2 | -------------------------------------------------------------------------------- /src/utils/configValidator.js: -------------------------------------------------------------------------------- 1 | exports.validateConfig = (config) => { 2 | const requiredKeys = ["GOOGLE_API_KEY", "YOUTUBE_API_KEY"]; 3 | requiredKeys.forEach(key => { 4 | if (!config[key]) throw new Error(`Missing required configuration: ${key}`); 5 | }); 6 | return true; 7 | }; -------------------------------------------------------------------------------- /src/utils/logger.js: -------------------------------------------------------------------------------- 1 | 2 | exports.log = (message) => console.log(`[LOG]: ${message}`); 3 | -------------------------------------------------------------------------------- /start_project.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Colors for formatting 4 | GREEN="\033[0;32m" 5 | RED="\033[0;31m" 6 | YELLOW="\033[1;33m" 7 | NC="\033[0m" # No Color 8 | 9 | # Function to display messages 10 | function log() { 11 | echo -e "${GREEN}[YouTube-IA]${NC} $1" 12 | } 13 | 14 | function error() { 15 | echo -e "${RED}[ERROR]${NC} $1" 16 | } 17 | 18 | # Step 1: Check Node.js installation 19 | if ! command -v node &> /dev/null; then 20 | error "Node.js is not installed. Please install Node.js (v14+) and try again." 21 | exit 1 22 | else 23 | log "Node.js is installed." 24 | fi 25 | 26 | # Step 2: Check npm installation 27 | if ! command -v npm &> /dev/null; then 28 | error "npm is not installed. Please install npm and try again." 29 | exit 1 30 | else 31 | log "npm is installed." 32 | fi 33 | 34 | # Step 3: Install dependencies 35 | log "Installing dependencies..." 36 | npm install 37 | if [ $? -ne 0 ]; then 38 | error "Failed to install dependencies. Please check the errors above." 39 | exit 1 40 | fi 41 | 42 | # Step 4: Check .env file 43 | if [ ! -f ".env" ]; then 44 | error "The .env file is missing. Please create a .env file with your API keys." 45 | exit 1 46 | else 47 | log "Environment file (.env) found." 48 | fi 49 | 50 | # Step 5: Start the project 51 | log "Starting YouTube-IA project..." 52 | npm start 53 | if [ $? -ne 0 ]; then 54 | error "Failed to start the project. Please check the errors above." 55 | exit 1 56 | fi 57 | -------------------------------------------------------------------------------- /tools/configs/config1.yml: -------------------------------------------------------------------------------- 1 | Placeholder content for config1.yml 2 | -------------------------------------------------------------------------------- /tools/configs/config2.yml: -------------------------------------------------------------------------------- 1 | Placeholder content for config2.yml 2 | -------------------------------------------------------------------------------- /tools/scripts/build_script.sh: -------------------------------------------------------------------------------- 1 | Placeholder content for build_script.sh 2 | -------------------------------------------------------------------------------- /tools/scripts/deploy_script.sh: -------------------------------------------------------------------------------- 1 | Placeholder content for deploy_script.sh 2 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | 2 | { 3 | "compilerOptions": { 4 | "target": "ES2020", 5 | "module": "commonjs", 6 | "strict": true, 7 | "esModuleInterop": true, 8 | "skipLibCheck": true, 9 | "forceConsistentCasingInFileNames": true 10 | }, 11 | "include": ["src/**/*.ts"], 12 | "exclude": ["node_modules"] 13 | } 14 | --------------------------------------------------------------------------------