Skip to content

About

No description, website, or topics provided.

Resources

Stars

32 stars

Watchers

0 watching

Forks

Latest commit

 

History

3 Commits

Folders and files

Repository files navigation

YouTube Channel Auto-Uploader

A Go-based script that automatically scrapes a target YouTube channel, downloads its videos using yt-dlp, and re-uploads them to your authenticated YouTube channel using the YouTube Data API v3.

This script natively tracks videos that have already been uploaded (via uploaded.txt) so it never uploads duplicates. It deletes temporary video files automatically, and deletes the YouTube API authentication token upon finishing so you can re-authenticate freely.

📋 Prerequisites

Before running the application, make sure you have the following installed on your system:

  1. Go: Ensure Go (v1.18+) is installed.
  2. yt-dlp: Must be installed and accessible in your system's PATH.
  3. ffmpeg: Must be installed and in your system's PATH (required by yt-dlp to merge high-quality video and audio tracks).

⚙️ Google Cloud API Setup (Step-by-Step)

To upload to your channel, you need to generate a client_secret.json file from Google Cloud.

  1. Go to the Google Cloud Console.
  2. Create a new Project (or select an existing one).
  3. Enable the API:
    • Go to APIs & Services > Library.
    • Search for YouTube Data API v3 and click Enable.
  4. Configure OAuth Consent Screen:
    • Go to APIs & Services > OAuth consent screen.
    • Choose External and click Create.
    • Fill in the required fields (App name, support email, developer email).
    • Under Test Users, click ADD USERS and add the Google/YouTube email address you plan to upload videos to! (If you skip this, Google will block you from authenticating).
    • Save and continue.
  5. Create Credentials:
    • Go to APIs & Services > Credentials.
    • Click Create Credentials > OAuth client ID.
    • For Application type, select Desktop app (give it any name).
    • Click Create.
  6. Download:
    • Click the "Download JSON" button on the popup (or the down arrow icon next to your new credential).
    • Rename the downloaded file to exactly client_secret.json.
    • Place this file in the exact same folder as your main.go code.

▶️ Running the Application

  1. Open your terminal in the project directory.
  2. Run the code:
    go run main.go
  3. Authentication (First Run):
    • The terminal will print a Google authorization link.
    • Ctrl+Click (or copy-paste) the link into your browser.
    • Log into the Google account that owns the channel you want to upload to.
    • Click Continue (ignore the "Google hasn't verified this app" warning by clicking Advanced -> Continue).
    • Grant the required permissions.
    • Copy the authorization code provided at the end.
    • Paste it back into your terminal and hit Enter.
  4. The script will automatically scrape the channel, download videos, and upload them!

Note on Token Deletion: As configured, the application deletes token.json automatically once the script finishes running. This means you will need to re-authorize the application the next time you run it.


🐳 Running with Docker

You can also run the application using Docker and Docker Compose. This avoids needing to install Go, yt-dlp, and ffmpeg locally.

  1. Ensure your .env and client_secret.json are in the project root.
  2. Build and start the container in detached mode:
    docker compose up -d
  3. Authentication (First Run): Since the container requires interactive authorization the first time, attach to it to see the prompts:
    docker attach ytclone
    Follow the authorization link, paste your authorization code in the terminal, and press Enter. You can then safely detach from the container's output by pressing Ctrl+P, then Ctrl+Q.

📂 File Explanations

  • main.go: The core application code.
  • client_secret.json: Your private Google OAuth credentials.
  • .env: Holds configurations (target channel, max workers, privacy).
  • uploaded.txt: Auto-generated by the script. It logs the IDs of successfully uploaded videos so they aren't downloaded/uploaded twice.
  • temp/: An auto-generated folder where yt-dlp stores videos before they get uploaded. (Files here get deleted automatically).

About

No description, website, or topics provided.

Resources

Stars

32 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages