Created
February 14, 2026 09:23
-
-
Save Askill/e3812fee3dad0b62dd10761fdef33cff to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import subprocess | |
| import sys | |
| from pathlib import Path | |
| if len(sys.argv) != 2: | |
| print("Usage: python download_youtube.py <URL | playlist | channel | txt file>") | |
| sys.exit(1) | |
| source = sys.argv[1] | |
| cmd = [ | |
| "python -m yt_dlp", | |
| "-f", "bv*+ba/b", # best video + best audio | |
| "--merge-output-format", "mkv", | |
| "--embed-metadata", | |
| "--embed-thumbnail", | |
| "--add-metadata", | |
| "--yes-playlist", | |
| "--ignore-errors", | |
| "--ffmpeg-location \"C:\dev\ffmpeg-8.0.1\bin\"", | |
| "-o", "./yt_downloads/%(uploader)s/%(title)s.%(ext)s", | |
| ] | |
| if Path(source).suffix == ".txt": | |
| cmd.extend(["-a", source]) | |
| else: | |
| cmd.append(source) | |
| print(" ".join(cmd)) | |
| subprocess.run(cmd, check=False) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment