feat: implement downloading and processing of Kick and Twitch URLs

This commit is contained in:
Renato
2026-07-03 17:11:58 +02:00
parent 4b0e66f5c2
commit b67d3f3a82
2 changed files with 41 additions and 14 deletions
+4 -4
View File
@@ -473,7 +473,7 @@ def download_youtube_video(url, output_dir="."):
import time
import sys
print("📥 Downloading video from YouTube using custom solver...")
print("📥 Downloading video using custom solver...")
step_start_time = time.time()
# Ensure output_dir is absolute path
@@ -492,14 +492,14 @@ def download_youtube_video(url, output_dir="."):
result = subprocess.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
if result.returncode != 0:
print("🚨 YOUTUBE DOWNLOAD ERROR 🚨", file=sys.stderr)
print("🚨 DOWNLOAD ERROR 🚨", file=sys.stderr)
print(result.stderr, file=sys.stderr)
raise Exception(f"YouTube download failed: {result.stderr}")
raise Exception(f"Video download failed: {result.stderr}")
try:
output_data = json.loads(result.stdout.strip())
downloaded_file = output_data['filepath']
video_title = output_data.get('title', 'youtube_video')
video_title = output_data.get('title', 'video')
sanitized_title = sanitize_filename(video_title)
except Exception as e:
print(f"⚠️ JSON parsing failed, trying fallback detection. Error: {e}")