🎥 Python YouTube Upload – Vollautomatisierte Content-Pipeline

Instagram-Scraping → Video-Compilation → Thumbnail-Generierung → täglicher YouTube-Upload im 24/7-Betrieb

PythonYouTube APIInstagramffmpegAutomation

🚀 Content-Automatisierung für YouTube-Channel-Growth?

Vereinbaren Sie ein unverbindliches Strategiegespräch

📞 02406 803 7603 ✉️ info@computerkumpel.de

📊 Business Value

Eine vollautomatisierte Content-Pipeline, die täglich neue YouTube-Videos produziert und hochlädt. Von der Content-Quelle (Instagram) über die Videobearbeitung bis zum Upload – komplett hands-free.

🤖
24/7 Automation
Täglicher automatischer Upload um 20:00 Uhr via schedule-Library. Fehler-Resilienz durch attemptRoutine-Retry.
📥
Content-Scraping
Automatischer Download von Instagram-Videos der letzten 1-2 Tage. Filterung nach Beliebtheit und Relevanz.
✂️
Smart Compilation
Intelligente Video-Kompilation mit konfigurierbarer Länge (13 Min), Clip-Längen (5-19s) und optionalen Intro/Outro-Clips.

💻 Pipeline-Ablauf

Vier automatisierte Schritte in einer Routine – designed für täglichen, unbeaufsichtigten Betrieb.

1️⃣
Scrape Videos
scrapeVideos() mit Instagram-Credentials. Lädt Videos der letzten Tage in /DankMemes_MMM_YYYY_VDD/.
2️⃣
Make Compilation
makeCompilation() mit ffmpeg. Konfigurierbare Gesamtlänge, Clip-Längen und optionale Intro/Outro-Videos.
3️⃣
Upload
uploadYtvid() mit Google OAuth. Titel, Description mit Hashtags, Copyright-Disclaimer und Google API v3.

📝 Echte Code-Snippets

Die Haupt-Routine mit vollständigem Pipeline-Durchlauf:

def routine():
    # GoogleAPI OAuth
    creds = Credentials.from_authorized_user_file(TOKEN_NAME, SCOPES) \
        if os.path.exists(TOKEN_NAME) else None
    if not creds or not creds.valid:
        if creds and creds.expired and creds.refresh_token:
            creds.refresh(Request())
        else:
            flow = InstalledAppFlow.from_client_secrets_file(client_secrets_file, SCOPES)
            creds = flow.run_console()
    
    googleAPI = build('youtube', 'v3', credentials=creds)
    
    # Step 1: Scrape Instagram Videos
    scrapeVideos(username=IG_USERNAME, password=IG_PASSWORD, 
                 output_folder=videoDirectory, days=1)
    
    # Step 2: Video Compilation erstellen
    makeCompilation(path=videoDirectory, introName=INTRO_VID, 
                    outroName=OUTRO_VID, totalVidLength=TOTAL_VID_LENGTH,
                    maxClipLength=MAX_CLIP_LENGTH, minClipLength=MIN_CLIP_LENGTH,
                    outputFile=outputFile)
    
    # Step 3: YouTube Upload
    uploadYtvid(VIDEO_FILE_NAME=outputFile, title=title,
                description=description, googleAPI=googleAPI)

Schedule-System für täglichen Betrieb mit Retry-Logik:

def attemptRoutine():
    while True:
        try:
            routine()
            break
        except OSError as err:
            print(f"Routine Failed: {err}")
            time.sleep(60 * 60)  # 1h Pause bei Fehler

schedule.every().day.at(DAILY_SCHEDULED_TIME).do(attemptRoutine)

while True:
    schedule.run_pending()
    time.sleep(60)

🔧 Technologie-Stack

Python 3 Google YouTube API v3 OAuth 2.0 ffmpeg schedule instaloader shutil

🚀 Kernfunktionen