Skip to the content.

Login with TikTok

Auto Upload CLI for TikTok & YouTube Shorts with AI Story Generation & Voiceover

A command-line Python tool that:

  1. Generates multi-part suspenseful stories via OpenAI
  2. Converts those scripts to voiceovers using ElevenLabs TTS
  3. Creates subtitle files and overlays them on background videos via FFmpeg
  4. Automatically uploads the finished videos to TikTok and/or YouTube Shorts

This end-to-end pipeline enables you to go from idea to published content with a single script.


🔍 Description

auto_upload.py orchestrates the full content creation process:

  1. Story generation: calls OpenAI to produce 2–4 part narratives, each ~20–30s long, with cliffhangers.
  2. Voiceover: uses ElevenLabs to generate high-quality MP3 narrations for each part.
  3. Subtitles: transcribes the TTS output (via Whisper), re-chunks into timed segments, and writes SRT files.
  4. Video composition: overlays subtitles on a random background clip using FFmpeg, syncing with the audio.
  5. Publishing: uploads the final MP4s to TikTok and/or YouTube Shorts with metadata from a JSON file.

⚙️ Features


🛠 Prerequisites


⚡️ Installation

  1. Clone the repo

    git clone https://github.com/yourusername/auto-upload.git
    cd auto-upload
    
  2. Install FFmpeg (if not already):

    • macOS: brew install ffmpeg
    • Ubuntu: sudo apt install ffmpeg
  3. Install Python deps

    pip install openai python-dotenv elevenlabs requests google-auth-oauthlib google-api-python-client whisper
    
  4. Create a .env file in the project root:

    OPENAI_API_KEY=sk-...
    ELEVENLABS_API_KEY=eleven-...
    TIKTOK_ACCESS_TOKEN=...
    YOUTUBE_CLIENT_SECRETS_FILE=client_secrets.json
    

🚀 Usage

python auto_upload.py \
  --video /path/to/backgrounds/videoplayback.mp4 \
  --meta /path/to/stories.json \
  --platform both

The script will generate story scripts, voiceovers, subtitles, videos, and then upload them, printing API responses.


🔐 OAuth Callback Endpoint

TikTok’s OAuth flow requires a publicly accessible HTTPS Redirect URI to receive the authorization code. Simply hosting your code in a public Git repository does not provide this endpoint—you’ll still need one of the following:

Local Server + ngrok


📅 Scheduling

Automate the entire pipeline via:


📝 License

This project is licensed under the MIT License.


Ready to generate, voice, and publish? Let’s go!, voice, and publish? Let’s go!*