2
3
4
5
#!/usr/bin/env python3
import subprocess
def download_media(url, audio_only=False):
ydl_opts = ["yt-dlp", "--progress", "-o", "%(title)s.%(ext)s"]
if audio_only:
ydl_opts.extend(["-x", "--audio-format", "mp3", "--audio-quality", "0"])
else:
ydl_opts.extend(["-f", "bestvideo+bestaudio/best", "--merge-output-format", "mp4"])
ydl_opts.append(url)
print("⬇ Starte Download...")
subprocess.run(ydl_opts, check=True)
print("✅ Download erfolgreich abgeschlossen!")
if __name__ == "__main__":
video_url = "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
print("Starte YouTube Download Script...")
Python 3.12.2 (main, Feb 2026, 64-bit)
Klicke auf [▶ Run], um das aktuelle Skript auszuführen...