Yigit033/youtube_video_automation

youtube_video_shorts

0

stars

7

commits

JavaScript

primary language

Jan 11, 2026

updated

README

YouTube Shorts Automation Platform

A complete Node.js application that automatically generates and uploads YouTube Shorts using only free and open-source tools.

πŸš€ Features

  • AI-Powered Script Generation - Uses HuggingFace's free inference API
  • Text-to-Speech - Local Piper TTS integration (open-source)
  • Stock Video Fetching - Pexels API for vertical video clips
  • Automated Video Assembly - FFmpeg for montage, audio, and subtitles
  • YouTube Upload - Automatic upload with scheduling capabilities
  • Web Dashboard - Clean, responsive interface for easy management

πŸ“‹ Prerequisites

Required Software

  1. Node.js (v16 or higher)

    node --version
    
  2. FFmpeg (for video processing)

    • Windows: Run the setup script below or download from ffmpeg.org
    • macOS/Linux:
      # macOS
      brew install ffmpeg
      
      # Ubuntu/Debian
      sudo apt update && sudo apt install ffmpeg
      
  3. Windows Setup (Recommended) Run the setup script as Administrator:

    # Open PowerShell as Administrator and run:
    Set-ExecutionPolicy Bypass -Scope Process -Force
    .\setup-tts-windows.ps1
    

    This will install:

    • eSpeak (local TTS)
    • FFmpeg (if not already installed)
    • Configure system paths
  4. Manual Installation (Alternative)

    • eSpeak - For local TTS fallback
    • FFmpeg - For audio/video processing

API Keys (All Free)

  1. HuggingFace API Key (Required for AI and Cloud TTS)

  2. Pexels API Key

  3. YouTube Data API

πŸš€ Getting Started

  1. Clone the repository

    git clone https://github.com/yourusername/youtube-shorts-automation.git
    cd youtube-shorts-automation
    
  2. Run the setup script (Windows)

    # Run as Administrator
    .\setup-tts-windows.ps1
    

    This will install all required dependencies and verify the setup.

  3. Environment Setup

    cp .env.example .env
    # Edit .env with your API keys
    
  4. Create Required Directories

    mkdir -p temp/audio temp/videos temp/output
    
  5. Optional: Install Piper TTS

    mkdir piper
    cd piper
    # Download Piper for your platform:
    # https://github.com/rhasspy/piper/releases
    
    # Download a voice model (example):
    mkdir models
    cd models
    wget https://huggingface.co/rhasspy/piper-voices/resolve/v1.0.0/en/en_US/lessac/medium/en_US-lessac-medium.onnx
    wget https://huggingface.co/rhasspy/piper-voices/resolve/v1.0.0/en/en_US/lessac/medium/en_US-lessac-medium.onnx.json
    

🎯 Usage

  1. Start the Server

    npm start
    # or for development
    npm run dev
    
  2. Open Dashboard

  3. Generate Shorts

    • Enter your topic (e.g., "space exploration", "cooking tips")
    • Select number of videos to generate
    • Optionally set a publish date/time
    • Click "Generate & Upload Shorts"
  4. Monitor Progress

    • Watch real-time progress in the dashboard
    • View generated videos once complete
    • Access your videos directly on YouTube

πŸ—οΈ Architecture

β”œβ”€β”€ server.js              # Main Express server
β”œβ”€β”€ services/
β”‚   β”œβ”€β”€ ai.js             # HuggingFace text generation
β”‚   β”œβ”€β”€ tts.js            # Piper TTS integration
β”‚   β”œβ”€β”€ video.js          # FFmpeg video assembly
β”‚   β”œβ”€β”€ youtube.js        # YouTube Data API
β”‚   └── pexels.js         # Stock video fetching
β”œβ”€β”€ public/
β”‚   β”œβ”€β”€ index.html        # Dashboard UI
β”‚   └── script.js         # Frontend JavaScript
β”œβ”€β”€ routes/
β”‚   └── api.js           # API routes and testing
└── temp/                # Temporary files (auto-created)
    β”œβ”€β”€ audio/           # Generated TTS files
    β”œβ”€β”€ videos/          # Downloaded stock videos
    └── output/          # Final assembled videos

πŸ”§ Configuration

Environment Variables

VariableDescriptionRequired
HUGGINGFACE_API_KEYHuggingFace inference API keyYes
PEXELS_API_KEYPexels stock video API keyYes
YOUTUBE_CLIENT_IDYouTube OAuth client IDYes
YOUTUBE_CLIENT_SECRETYouTube OAuth client secretYes
YOUTUBE_REDIRECT_URIOAuth redirect URINo
PORTServer portNo

Workflow

  1. Script Generation: AI generates engaging script with title and description
  2. Voice Narration: Piper TTS converts script to audio
  3. Stock Videos: Pexels API fetches relevant vertical video clips
  4. Video Assembly: FFmpeg combines clips, adds audio and subtitles
  5. Upload: YouTube Data API uploads with metadata and scheduling

πŸ›  Troubleshooting

Common Issues

  1. TTS Not Working

    • Check if eSpeak is installed: espeak --version
    • Verify FFmpeg is in your PATH: ffmpeg -version
    • Ensure your HuggingFace API key is set in .env
  2. FFmpeg not found

    • Run the setup script as Administrator
    • Or install manually:
      # Linux
      sudo apt install ffmpeg
      
      # macOS
      brew install ffmpeg
      
      # Windows
      # Download from https://ffmpeg.org/download.html
      
  3. Piper TTS not working

    • Falls back to espeak or silent audio
    • Download Piper binary and models manually
    • Check file permissions
  4. YouTube authentication fails

    • Verify OAuth credentials in Google Console
    • Check redirect URI matches exactly
    • Ensure YouTube Data API v3 is enabled
  5. Pexels videos not downloading

    • Check API key validity
    • Verify internet connection
    • System falls back to colored backgrounds

Performance Tips

  • Start with 1-2 videos to test the workflow
  • Ensure stable internet for video downloads
  • Monitor temp directory size (auto-cleanup implemented)
  • Use specific topics for better video matching

πŸ“ License

MIT License - Feel free to modify and distribute

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Submit a pull request

⚑ Quick Start

# 1. Install dependencies
npm install

# 2. Set up environment
cp .env.example .env
# Edit .env with your API keys

# 3. Start the server
npm start

# 4. Open http://localhost:3000
# 5. Authenticate with YouTube
# 6. Generate your first Short!

πŸ“Š System Requirements

  • RAM: 2GB minimum (4GB recommended)
  • Storage: 1GB free space for temporary files
  • Network: Stable internet for API calls and downloads
  • OS: Linux, macOS, or Windows with WSL

🎬 Ready to create viral YouTube Shorts automatically!

Contributors

Yigit033

7 commits

Yigit033/youtube_video_automation

youtube_video_shorts

0

stars

7

commits

JavaScript

primary language

Jan 11, 2026

updated

README

YouTube Shorts Automation Platform

A complete Node.js application that automatically generates and uploads YouTube Shorts using only free and open-source tools.

πŸš€ Features

  • AI-Powered Script Generation - Uses HuggingFace's free inference API
  • Text-to-Speech - Local Piper TTS integration (open-source)
  • Stock Video Fetching - Pexels API for vertical video clips
  • Automated Video Assembly - FFmpeg for montage, audio, and subtitles
  • YouTube Upload - Automatic upload with scheduling capabilities
  • Web Dashboard - Clean, responsive interface for easy management

πŸ“‹ Prerequisites

Required Software

  1. Node.js (v16 or higher)

    node --version
    
  2. FFmpeg (for video processing)

    • Windows: Run the setup script below or download from ffmpeg.org
    • macOS/Linux:
      # macOS
      brew install ffmpeg
      
      # Ubuntu/Debian
      sudo apt update && sudo apt install ffmpeg
      
  3. Windows Setup (Recommended) Run the setup script as Administrator:

    # Open PowerShell as Administrator and run:
    Set-ExecutionPolicy Bypass -Scope Process -Force
    .\setup-tts-windows.ps1
    

    This will install:

    • eSpeak (local TTS)
    • FFmpeg (if not already installed)
    • Configure system paths
  4. Manual Installation (Alternative)

    • eSpeak - For local TTS fallback
    • FFmpeg - For audio/video processing

API Keys (All Free)

  1. HuggingFace API Key (Required for AI and Cloud TTS)

  2. Pexels API Key

  3. YouTube Data API

πŸš€ Getting Started

  1. Clone the repository

    git clone https://github.com/yourusername/youtube-shorts-automation.git
    cd youtube-shorts-automation
    
  2. Run the setup script (Windows)

    # Run as Administrator
    .\setup-tts-windows.ps1
    

    This will install all required dependencies and verify the setup.

  3. Environment Setup

    cp .env.example .env
    # Edit .env with your API keys
    
  4. Create Required Directories

    mkdir -p temp/audio temp/videos temp/output
    
  5. Optional: Install Piper TTS

    mkdir piper
    cd piper
    # Download Piper for your platform:
    # https://github.com/rhasspy/piper/releases
    
    # Download a voice model (example):
    mkdir models
    cd models
    wget https://huggingface.co/rhasspy/piper-voices/resolve/v1.0.0/en/en_US/lessac/medium/en_US-lessac-medium.onnx
    wget https://huggingface.co/rhasspy/piper-voices/resolve/v1.0.0/en/en_US/lessac/medium/en_US-lessac-medium.onnx.json
    

🎯 Usage

  1. Start the Server

    npm start
    # or for development
    npm run dev
    
  2. Open Dashboard

  3. Generate Shorts

    • Enter your topic (e.g., "space exploration", "cooking tips")
    • Select number of videos to generate
    • Optionally set a publish date/time
    • Click "Generate & Upload Shorts"
  4. Monitor Progress

    • Watch real-time progress in the dashboard
    • View generated videos once complete
    • Access your videos directly on YouTube

πŸ—οΈ Architecture

β”œβ”€β”€ server.js              # Main Express server
β”œβ”€β”€ services/
β”‚   β”œβ”€β”€ ai.js             # HuggingFace text generation
β”‚   β”œβ”€β”€ tts.js            # Piper TTS integration
β”‚   β”œβ”€β”€ video.js          # FFmpeg video assembly
β”‚   β”œβ”€β”€ youtube.js        # YouTube Data API
β”‚   └── pexels.js         # Stock video fetching
β”œβ”€β”€ public/
β”‚   β”œβ”€β”€ index.html        # Dashboard UI
β”‚   └── script.js         # Frontend JavaScript
β”œβ”€β”€ routes/
β”‚   └── api.js           # API routes and testing
└── temp/                # Temporary files (auto-created)
    β”œβ”€β”€ audio/           # Generated TTS files
    β”œβ”€β”€ videos/          # Downloaded stock videos
    └── output/          # Final assembled videos

πŸ”§ Configuration

Environment Variables

VariableDescriptionRequired
HUGGINGFACE_API_KEYHuggingFace inference API keyYes
PEXELS_API_KEYPexels stock video API keyYes
YOUTUBE_CLIENT_IDYouTube OAuth client IDYes
YOUTUBE_CLIENT_SECRETYouTube OAuth client secretYes
YOUTUBE_REDIRECT_URIOAuth redirect URINo
PORTServer portNo

Workflow

  1. Script Generation: AI generates engaging script with title and description
  2. Voice Narration: Piper TTS converts script to audio
  3. Stock Videos: Pexels API fetches relevant vertical video clips
  4. Video Assembly: FFmpeg combines clips, adds audio and subtitles
  5. Upload: YouTube Data API uploads with metadata and scheduling

πŸ›  Troubleshooting

Common Issues

  1. TTS Not Working

    • Check if eSpeak is installed: espeak --version
    • Verify FFmpeg is in your PATH: ffmpeg -version
    • Ensure your HuggingFace API key is set in .env
  2. FFmpeg not found

    • Run the setup script as Administrator
    • Or install manually:
      # Linux
      sudo apt install ffmpeg
      
      # macOS
      brew install ffmpeg
      
      # Windows
      # Download from https://ffmpeg.org/download.html
      
  3. Piper TTS not working

    • Falls back to espeak or silent audio
    • Download Piper binary and models manually
    • Check file permissions
  4. YouTube authentication fails

    • Verify OAuth credentials in Google Console
    • Check redirect URI matches exactly
    • Ensure YouTube Data API v3 is enabled
  5. Pexels videos not downloading

    • Check API key validity
    • Verify internet connection
    • System falls back to colored backgrounds

Performance Tips

  • Start with 1-2 videos to test the workflow
  • Ensure stable internet for video downloads
  • Monitor temp directory size (auto-cleanup implemented)
  • Use specific topics for better video matching

πŸ“ License

MIT License - Feel free to modify and distribute

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Submit a pull request

⚑ Quick Start

# 1. Install dependencies
npm install

# 2. Set up environment
cp .env.example .env
# Edit .env with your API keys

# 3. Start the server
npm start

# 4. Open http://localhost:3000
# 5. Authenticate with YouTube
# 6. Generate your first Short!

πŸ“Š System Requirements

  • RAM: 2GB minimum (4GB recommended)
  • Storage: 1GB free space for temporary files
  • Network: Stable internet for API calls and downloads
  • OS: Linux, macOS, or Windows with WSL

🎬 Ready to create viral YouTube Shorts automatically!

Contributors

Yigit033

7 commits

Languages

JavaScript

87.9%

HTML

8.1%

Python

2.9%