YouTube Kommentar Manager — KI-gestützte Prozessautomatisierung

Automatische Kommentar-Erfassung via YouTube Data API v3, KI-basierte Antwortgenerierung mit OpenAI GPT und Web-Dashboard mit MySQL/jQuery

YouTube Data API v3OpenAI GPTPythonMySQLjQuery

🚀 Bereit für Ihre digitale Transformation?

Vereinbaren Sie ein unverbindliches Strategiegespräch

📞 02406 803 7603 ✉️ info@computerkumpel.de

📊 Business Value

Dieses Tool automatisiert den gesamten YouTube-Kommentar-Workflow: Erfassung aller Kanal-Kommentare via API, KI-gestützte Antwortgenerierung und manuelle Freigabe über ein Web-Dashboard. Spart Stunden manueller Arbeit pro Woche.

⏱️
Zeitersparnis
Kommentare werden automatisch via youtube.commentThreads().list() erfasst und gespeichert – kein manuelles Durchscrollen mehr nötig.
💰
Kostensenkung
Drei GPT-generierte Antwortvorschläge pro Kommentar – Sie wählen nur noch aus, statt selbst zu formulieren.
🎯
Qualität
KI-generierte Antworten im Kanal-Stil – konsistent und markenkonform, kein Community-Manager-Burnout.
📈
Skalierung
Paginierte API-Abfragen mit nextPageToken – verarbeitet beliebig viele Kommentare ohne Performance-Einbruch.

⚙️ Architektur & Datenfluss

1
🐍

Python Backend

comment.py authentifiziert via OAuth 2.0, ruft commentThreads().list() auf und speichert neue Kommentare in MySQL.

2
🗄️

MySQL-Datenbank

Zentrale Speicherung aller Kommentare mit Status-Tracking: Original, Version A/B/C, Custom-Antwort.

3
🤖

GPT Antwortgenerierung

PHP sendet Prompt an OpenAI API, erhält 3 Antwortvarianten – on demand per Klick, parametrisiert mit Temperature 0.1.

4
🖥️

Web-Dashboard

jQuery/AJAX-Interface: Kommentare anzeigen, Antworten generieren, editieren, löschen – ohne Reload.

💻 Echter Code aus dem Projekt

Direkt aus dem Git-Repository D:\arbeit\git\verkooyen\ – produktiv eingesetzter Code.

🔐 Python: YouTube API Authentifizierung & Kommentar-Fetch (comment.py)

import os
import config
import pymysql
from google.oauth2.credentials import Credentials
from googleapiclient.discovery import build
from google.auth.transport.requests import Request
from google_auth_oauthlib.flow import InstalledAppFlow

channelID = config.channelID
base_dir = config.base_dirB
TOKEN_NAME = base_dir + "token.json"

SCOPES = ["https://www.googleapis.com/auth/youtube.upload",
          "https://www.googleapis.com/auth/youtube.force-ssl",
          "https://www.googleapis.com/auth/youtube"]
os.environ["OAUTHLIB_INSECURE_TRANSPORT"] = "1"
client_secrets_file = base_dir + "googleAPI.json"

creds = None
if os.path.exists(TOKEN_NAME):
    creds = Credentials.from_authorized_user_file(TOKEN_NAME, SCOPES)

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()
        with open(TOKEN_NAME, 'w') as token:
            token.write(creds.to_json())

youtube = build('youtube', 'v3', credentials=creds)

🔄 Python: Paginierte Kommentar-Erfassung mit MySQL-Backend

connection = pymysql.connect(
    host=config.host, user=config.user,
    password=config.password  # aus Config-Datei, db=config.database,
    charset='utf8mb4', cursorclass=pymysql.cursors.DictCursor)

cursor = connection.cursor()
page_token = None

while True:
    request = youtube.commentThreads().list(
        part="snippet",
        allThreadsRelatedToChannelId=channelID,
        textFormat="plainText",
        pageToken=page_token
    )
    response = request.execute()

    for comment_thread in response['items']:
        if (comment_thread['snippet']['totalReplyCount'] == 0 or
            comment_thread['snippet']['topLevelComment']
            ['snippet']['authorChannelId']['value'] == channelID):
            comment = comment_thread['snippet']\
                ['topLevelComment']['snippet']['textDisplay']
            ytID = comment_thread['snippet']\
                ['topLevelComment']['id']
            print(f"Neuer Kommentar: {comment}")
            query = "INSERT INTO coments (ytID, original) VALUES (%s, %s)"
            cursor.execute(query, (ytID, comment))
            connection.commit()

    if 'nextPageToken' not in response:
        break
    page_token = response['nextPageToken']

cursor.close()
connection.close()

⚙️ Python: Zentrale Konfiguration (config.py)

# Aus D:\arbeit\git\verkooyen\config.py
base_dir = '/var/www/vhosts/computerkumpel.de/upload/verkooyen/'
base_dirB = '/var/www/vhosts/computerkumpel.de/upload/verkooyen/'

# MySQL-Verbindungsinformationen
host = 'localhost'
user = 'comentai'
password = 'DEIN_PASSWORT'
database = 'admin_coments'

channelID = "UCi27ZfrFa8nJGfm4ex0-GGA"
openai_api_key = "DEIN_OPENAI_API_KEY"

SCOPES = ["https://www.googleapis.com/auth/youtube.upload",
          "https://www.googleapis.com/auth/youtube.force-ssl",
          "https://www.googleapis.com/auth/youtube"]

🛠️ Technologie-Stack

🐍
Python 3
Backend mit google-api-python-client, google-auth-oauthlib, pymysql für YouTube-API und DB.
🐘
PHP + cURL
Server-seitige OpenAI-API-Integration via cURL, AJAX-Endpunkte für das Dashboard.
🗄️
MySQL
coments-Tabelle: ytID, original, versionA/B/C, custom, done-Status.
jQuery + AJAX
Asynchrones Frontend: CRUD ohne Seiten-Reload, direkte UI-Updates.
🔐
OAuth 2.0
Google OAuth mit Token-Refresh, InstalledAppFlow, automatische Persistenz.
🤖
OpenAI GPT-3
Davinci-Modell mit Rollen-Prompting, Temperature 0.1 für konsistente Ergebnisse, n=3 Varianten.

🚀 In Tagen zum MVP — nicht in Monaten

📞 02406 803 7603 ✉️ info@computerkumpel.de

Bereit für Ihren Wettbewerbsvorteil?

Als Brückenbauer zwischen Business und Technik unterstütze ich Sie bei der digitalen Transformation — pragmatisch, ergebnisorientiert, ohne Berater-Bullshit.

📞 Jetzt anrufen ✉️ E-Mail senden