🚀 Bereit für Ihre digitale Transformation?
Vereinbaren Sie ein unverbindliches Strategiegespräch
📊 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.
youtube.commentThreads().list() erfasst und gespeichert – kein manuelles Durchscrollen mehr nötig.nextPageToken – verarbeitet beliebig viele Kommentare ohne Performance-Einbruch.⚙️ Architektur & Datenfluss
Python Backend
comment.py authentifiziert via OAuth 2.0, ruft commentThreads().list() auf und speichert neue Kommentare in MySQL.
MySQL-Datenbank
Zentrale Speicherung aller Kommentare mit Status-Tracking: Original, Version A/B/C, Custom-Antwort.
GPT Antwortgenerierung
PHP sendet Prompt an OpenAI API, erhält 3 Antwortvarianten – on demand per Klick, parametrisiert mit Temperature 0.1.
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
google-api-python-client, google-auth-oauthlib, pymysql für YouTube-API und DB.coments-Tabelle: ytID, original, versionA/B/C, custom, done-Status.InstalledAppFlow, automatische Persistenz.🚀 In Tagen zum MVP — nicht in Monaten
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.