Dokumentation durchsuchen
Anleitungen
Kopiere Befehle für Video, Audio, Untertitel, Datensätze und das Fortsetzen von Sammlungen.
Auf dieser Seite
Setup und Command Konventionen
python -m pip install -U --pre "yt-dlp[default,curl-cffi]"
deno --version
ffmpeg -version
python -m yt_dlp --list-impersonate-targetsDie Download-Rezepte verwenden Deno und --impersonate="" als Grundlinie. Das letzte erfordert curl-cffi und lässt es einen verfügbaren Browser-Fingerprint auswählen. Linux/macOS befehlt die Benutzung von Bash Syntax; für einen geplanten Arbeitnehmer, machen diese Abhängigkeiten auch in diesem Service-Umfeld zur Verfügung.
Diese Terminal-Exemplen verwenden die Python-Installation von yt-dlp. Verwenden Sie Ihre virtuelle Umgebung Python, oder ersetzen Sie Python -m yt_dlp mit der Standalone yt-dlp-Kommand. Verwenden Sie Linux zuerst, mit macOS und Windows-Alternativen im Setup-Guide. Installieren Sie FFmpeg/ffprobe für die Fusion und Deno für die YouTube-Problemlösung. Ersetzen Sie die URL-Adresse mit Ihrer Quelle.
| Übereinkommen | Warum es wichtig ist |
|---|---|
| URLs und Templates | Die Schale interpretiert anders Charaktere wie &, Räume und Parenthesen. |
| %(ext)s in Filenamen halten | Die ausgewählten Medien und Post-Verarbeitung bestimmen die Erweiterung. |
| Verwenden Sie --no-playlist für eine Uhr URL | Ein Video, das von einer Playlist verknüpft wird, sollte nicht unerwartet Ihre Arbeit erweitern. |
| Überprüfen Sie Ihre gespeicherten Konfiguration | Beispiele können eine globale Konfiguration erben. Verwenden Sie --ignore-config für einen isolierten Test. |
| Windows .bat: doppelte Prozentsatz-Signale | Verwenden Sie %%(id)s in einem Battch-Datei, aber %(id)s in interaktiven PowerShell und normalen Konfigurierungsdateien. |
Videoqualität und MP4
Baseline: neueste Nacht, Deno und FFmpeg, mit --impersonate="". Die Rezepte verwenden Bash; ersetzen Sie die URL der Probe mit Ihrer Quelle.
python -m yt_dlp --js-runtimes deno --impersonate="" --no-playlist -P downloads \
-o "%(id)s.%(ext)s" "https://www.youtube.com/watch?v=jNQXAC9IVRw"python -m yt_dlp --js-runtimes deno --impersonate="" --no-playlist \
-F "https://www.youtube.com/watch?v=jNQXAC9IVRw"python -m yt_dlp --js-runtimes deno --impersonate="" --no-playlist -S "res:1080" \
"https://www.youtube.com/watch?v=jNQXAC9IVRw"python -m yt_dlp --js-runtimes deno --impersonate="" --no-playlist \
-f "bv*[height<=1080]+ba/b[height<=1080]" "https://www.youtube.com/watch?v=jNQXAC9IVRw"python -m yt_dlp --js-runtimes deno --impersonate="" --no-playlist \
-f "bv[vcodec^=avc1][height<=1080]+ba[acodec^=mp4a]/b[vcodec^=avc1][acodec^=mp4a][height<=1080]" \
--merge-output-format mp4 "https://www.youtube.com/watch?v=jNQXAC9IVRw"AI-Daten: MP4 + Kaptionen + Metadaten
python -m yt_dlp --js-runtimes deno --impersonate="" --no-playlist \
-f "bestvideo+bestaudio/best" --merge-output-format mp4 --remux-video mp4 \
--write-info-json --write-subs --write-auto-subs --sub-langs "en" --sub-format "vtt/best" \
--sleep-subtitles 5 --concurrent-fragments 1 -P dataset -o "%(id)s/%(id)s.%(ext)s" \
"https://www.youtube.com/watch?v=jNQXAC9IVRw"Externe Downloader: aria2c
python -m yt_dlp --js-runtimes deno --impersonate="" --no-playlist --downloader aria2c \
--downloader "dash,m3u8:native" --downloader-args "aria2c:-x 2 -s 2 -j 1" \
--concurrent-fragments 1 -P downloads "https://www.youtube.com/watch?v=jNQXAC9IVRw"aria2 hat eine eigene Netzwerkimplementierung. yt-dlp Impersonenierung curl-cffi konfiguriert nicht aria2 Fingerabdruck. Wenn nur der externe Downloader versagt, verwenden Sie --downloader native und vergleichen Sie die gleiche Quelle und Proxy-Route.
Audio und MP3
python -m yt_dlp --js-runtimes deno --impersonate="" --no-playlist -f ba -P audio \
-o "%(id)s.%(ext)s" "https://www.youtube.com/watch?v=jNQXAC9IVRw"python -m yt_dlp --js-runtimes deno --impersonate="" --no-playlist -f ba -x \
--audio-format mp3 --audio-quality 192K -P audio \
"https://www.youtube.com/watch?v=jNQXAC9IVRw"python -m yt_dlp --js-runtimes deno --impersonate="" --no-playlist -f "ba[ext=m4a]" -P audio \
"https://www.youtube.com/watch?v=jNQXAC9IVRw"python -m yt_dlp --js-runtimes deno --impersonate="" --no-playlist -f ba -x \
--audio-format mp3 --embed-metadata --embed-thumbnail -P audio \
"https://www.youtube.com/watch?v=jNQXAC9IVRw"Kapitel und Untertitel
python -m yt_dlp --js-runtimes deno --impersonate="" --no-playlist \
--list-subs "https://www.youtube.com/watch?v=jNQXAC9IVRw"python -m yt_dlp --js-runtimes deno --impersonate="" --skip-download --write-subs \
--sub-langs "en.*" --sub-format "vtt/best" -P captions -o "%(id)s.%(ext)s" \
"https://www.youtube.com/watch?v=jNQXAC9IVRw"python -m yt_dlp --js-runtimes deno --impersonate="" --skip-download --write-subs \
--write-auto-subs --sub-langs "en.*" --sub-format "vtt/best" -P captions \
-o "%(id)s.%(ext)s" "https://www.youtube.com/watch?v=jNQXAC9IVRw"python -m yt_dlp --js-runtimes deno --impersonate="" --skip-download --write-subs \
--write-auto-subs --sub-langs "en" --convert-subs srt -P captions \
"https://www.youtube.com/watch?v=jNQXAC9IVRw"python -m yt_dlp --js-runtimes deno --impersonate="" --write-subs --sub-langs "en" \
--embed-subs --remux-video mkv -P downloads "https://www.youtube.com/watch?v=jNQXAC9IVRw"Die Anfrage aller Übersetzungssprachen kann die Anzahl der Anfragen und Dateien erheblich erhöhen. Halten Sie die angestrebten Sprachen für die Routinearbeit ausdrücklich. Bewahren Sie die Quell-ID und Sprache in Ihrem Datensatz-Inventor, damit Transcripts nicht von den Medien, die sie beschreiben, abgesehen werden.
Metadaten und Ausgangswege
python -m yt_dlp --js-runtimes deno --impersonate="" --no-playlist \
--dump-json "https://www.youtube.com/watch?v=jNQXAC9IVRw" > video.jsonpython -m yt_dlp --js-runtimes deno --impersonate="" --skip-download --write-info-json \
-P metadata -o "%(id)s.%(ext)s" "https://www.youtube.com/watch?v=jNQXAC9IVRw"python -m yt_dlp --js-runtimes deno --impersonate="" --skip-download --write-thumbnail \
-P thumbnails -o "%(id)s.%(ext)s" "https://www.youtube.com/watch?v=jNQXAC9IVRw"python -m yt_dlp --js-runtimes deno --impersonate="" --no-playlist \
--print after_move:filepath -P downloads -o "%(id)s.%(ext)s" \
"https://www.youtube.com/watch?v=jNQXAC9IVRw"python -m yt_dlp --js-runtimes deno --impersonate="" --no-playlist \
--print-to-file after_move:filepath completed-paths.txt -P downloads \
"https://www.youtube.com/watch?v=jNQXAC9IVRw"Zeiträume und Kapitel
python -m yt_dlp --js-runtimes deno --impersonate="" --no-playlist \
--download-sections "*00:00:05-00:00:10" -o "clips/%(id)s-%(section_start)s.%(ext)s" \
"https://www.youtube.com/watch?v=jNQXAC9IVRw"python -m yt_dlp --js-runtimes deno --impersonate="" --no-playlist \
--download-sections "*00:00:05-00:00:10" --force-keyframes-at-cuts \
-o "clips/%(id)s-%(section_start)s.%(ext)s" "https://www.youtube.com/watch?v=jNQXAC9IVRw"python -m yt_dlp --split-chapters -o "chapter:%(id)s-%(section_number)03d.%(ext)s" \
"https://www.youtube.com/watch?v=YOUR_VIDEO_ID"Verwenden Sie eine andere Ausgangsrichtlinie oder Archiv für Clips und vollständige Videos. Eine Quell-Level-Archiv-Einträge verschlüsselt nicht die ausgewählten start/end-Träume, so dass ein gemeinsamer Archiv einen späteren Klip, den Sie erstellen möchten, abschalten kann.
Playlisten und URL-Listen
python -m yt_dlp --no-playlist --batch-file urls.txt -P collection -o "%(id)s.%(ext)s"python -m yt_dlp --flat-playlist \
--dump-json "https://www.youtube.com/playlist?list=YOUR_PLAYLIST_ID" > playlist.jsonlpython -m yt_dlp --playlist-items 1:5 -P collection -o "%(playlist_index)03d-%(id)s.%(ext)s" \
"https://www.youtube.com/playlist?list=YOUR_PLAYLIST_ID"python -m yt_dlp --dateafter 20260101 --match-filters "!is_live & duration <= 1800" \
--batch-file urls.txtpython -m yt_dlp --download-archive archive.txt --max-downloads 10 --batch-file urls.txtArchiv und Wiederherstellung
python -m yt_dlp --download-archive archive.txt --continue --no-abort-on-error -P collection \
-o "%(id)s.%(ext)s" --batch-file urls.txtpython -m yt_dlp --sleep-requests 1 --sleep-interval 5 --max-sleep-interval 10 --retries 3 \
--fragment-retries 3 --socket-timeout 30 --batch-file urls.txtpython -m yt_dlp --js-runtimes deno --impersonate="" --limit-rate 2M \
"https://www.youtube.com/watch?v=jNQXAC9IVRw"python -m yt_dlp --js-runtimes deno --impersonate="" --concurrent-fragments 1 \
"https://www.youtube.com/watch?v=jNQXAC9IVRw"Konfiguration und Filenamen
python -m yt_dlp --ignore-config --config-locations yt-dlp-work.conf --batch-file urls.txtpython -m yt_dlp --js-runtimes deno --impersonate="" -P downloads \
-o "%(channel_id)s/%(upload_date)s-%(title).150B [%(id)s].%(ext)s" \
"https://www.youtube.com/watch?v=jNQXAC9IVRw"python -m yt_dlp --js-runtimes deno --impersonate="" -P "home:downloads" -P "temp:work" \
-o "%(id)s.%(ext)s" "https://www.youtube.com/watch?v=jNQXAC9IVRw"Für langlebige Sammlungen entscheiden Sie, ob Filenamen menschlich gelesen oder stabile Anwendungsschlüssel sein sollten. Kanalnamen und Titel können sich ändern. Channel/video IDs sind bessere Schlüssel für Deduplikation, mit beschreibenden Feldern in Metadaten gehalten.
Cookies und Runtime-Paths
python -m yt_dlp --js-runtimes deno --impersonate="" \
--cookies-from-browser "chrome:Profile 1" \
--no-playlist "https://www.youtube.com/watch?v=jNQXAC9IVRw"python -m yt_dlp --js-runtimes deno --impersonate="" --cookies private/youtube-cookies.txt \
--no-playlist "https://www.youtube.com/watch?v=jNQXAC9IVRw"python -m yt_dlp --js-runtimes "deno:/opt/deno/bin/deno" --impersonate="" \
--no-playlist "https://www.youtube.com/watch?v=jNQXAC9IVRw"Diagnose und Verifizierung
python -m yt_dlp --js-runtimes deno --impersonate="" --ignore-config --verbose --simulate \
--no-playlist "https://www.youtube.com/watch?v=jNQXAC9IVRw"python -m yt_dlp --js-runtimes deno --impersonate="" --ignore-config --verbose --simulate \
--no-playlist "https://www.youtube.com/watch?v=jNQXAC9IVRw" > diagnostic.log 2>&1ffprobe -v error -show_entries format=duration,size:stream=codec_type,codec_name,width,height -of json "YOUR_OUTPUT_FILE"ffmpeg -v error -i "YOUR_OUTPUT_FILE" -f null -python -m pip install -U --pre "yt-dlp[default,curl-cffi]"
python -m yt_dlp --version