feat: implement downloading and processing of Kick and Twitch URLs
This commit is contained in:
+4
-4
@@ -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}")
|
||||
|
||||
Reference in New Issue
Block a user