Skip to content

KunalMehra075/Youtube-Upload-Automation

Repository files navigation

📹 YouTube AI Uploader 🤖

An automation tool built using Node.js, Puppeteer, and Gemini AI, designed to download videos, generate YouTube-optimized metadata (title, description, hashtags), and upload them automatically — all without touching your mouse or keyboard!


🚀 Features

  1. 🔽 Download Videos

    • Fetches video URLs from your MongoDB database.
    • Downloads videos into the media/ folder using APIHut API.
    • Just run:
      npm run download
      
  2. 📤 Upload Videos to YouTube

    • Automatically uploads videos from the media/ folder to YouTube.
    • Uses Gemini API to generate viral titles, descriptions, and hashtags.
    • Fully automates the upload via Puppeteer: no manual interaction needed.
    • Supports batch uploading and configuration via settings.js.
    • To start upload:
      npm run upload
      
  3. 🧹 Flush Videos Folder

    • Deletes all videos from the videos/ folder (cleanup helper).
    • Run:
      npm run flush
      

💡 For best YouTube reach, it's recommended to upload 1 video per day instead of bulk uploading all at once (though it's supported).


⚙️ Folder Structure

  • media/ → Downloaded videos (used for uploading)
  • videos/ → Raw videos (must be moved to videos/ before uploading)
  • settings.js → Control visibility (public/private/unlisted), audience (made for kids or not), etc.

🧠 How It Works

  1. Pulls videos from your MongoDB DB and downloads them via APIHut.
  2. Uses the filename as a base to generate metadata using Gemini API:
    • Title
    • Description
    • Hashtags
  3. Opens a Chromium browser via Puppeteer.
  4. Uploads videos to YouTube with complete automation.

🔐 Environment Variables

Create a .env file in your root directory and fill in the following:

GEMINI_API_KEY=your_gemini_api_key

YOUTUBE_ACCOUNT_EMAIL=your_email@gmail.com
YOUTUBE_ACCOUNT_PASSWORD=your_password
YOUTUBE_ACCOUNT_RECOVERY_EMAIL=your_recovery_email@gmail.com

MONGO_URI=your_mongo_connection_string
APIHUT_KEY=your_apihut_api_key

Buy Me a Pizza or Coffee 🥹

Buy Me A Coffee

About

An automation tool built using Node.js, Puppeteer, and Gemini AI, designed to download videos, generate YouTube-optimized metadata (title, description, hashtags), and upload them automatically — all without touching your mouse or keyboard!

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors