|
| 1 | +# YouTube Video Downloader |
| 2 | + |
| 3 | +A small Python script that downloads a YouTube video from a URL you provide, letting you pick the save folder through a native file browser dialog. |
| 4 | + |
| 5 | +## Features |
| 6 | + |
| 7 | +- Prompts for a YouTube URL directly in the terminal |
| 8 | +- Opens a native folder-picker dialog (via `tkinter`) so you can choose where the video is saved |
| 9 | +- Uses [`yt-dlp`](https://github.com/yt-dlp/yt-dlp) under the hood to handle the actual download, so it benefits from yt-dlp's format support and site compatibility |
| 10 | +- Saves the file using the video's title as the filename |
| 11 | + |
| 12 | +## Requirements |
| 13 | + |
| 14 | +- Python 3.7+ |
| 15 | +- [`yt-dlp`](https://pypi.org/project/yt-dlp/) |
| 16 | +- `tkinter` (included with most standard Python installs; on some Linux distros you may need to install it separately, e.g. `sudo apt install python3-tk`) |
| 17 | + |
| 18 | +Install the dependency with: |
| 19 | + |
| 20 | +```bash |
| 21 | +pip install yt-dlp |
| 22 | +``` |
| 23 | + |
| 24 | +## Usage |
| 25 | + |
| 26 | +Run the script: |
| 27 | + |
| 28 | +```bash |
| 29 | +python downloader.py |
| 30 | +``` |
| 31 | + |
| 32 | +You'll be prompted to: |
| 33 | + |
| 34 | +1. Enter the YouTube URL you want to download |
| 35 | +2. Choose a destination folder in the dialog that pops up |
| 36 | + |
| 37 | +The video will then download to that folder, named after its title. |
| 38 | + |
| 39 | +## How it works |
| 40 | + |
| 41 | +1. `open_file_dialog()` opens a folder-selection dialog using `tkinter.filedialog.askdirectory()` and returns the chosen path. |
| 42 | +2. `download_video()` configures `yt-dlp` with an output template (`%(title)s.%(ext)s`) pointed at that folder and the `"best"` format, then downloads the video. |
| 43 | +3. Errors during download (invalid URL, network issues, etc.) are caught and printed rather than crashing the script. |
| 44 | + |
| 45 | +## Limitations & ideas for contribution |
| 46 | + |
| 47 | +- Only supports a single video URL per run (no playlist support) |
| 48 | +- Always downloads the `"best"` format — no option to choose resolution, audio-only, or a specific format |
| 49 | +- No progress bar; you won't see download progress until it finishes or errors |
| 50 | +- No URL validation before attempting the download |
| 51 | +- Could be extended with: |
| 52 | + - A simple GUI wrapping the whole flow (not just the folder picker) |
| 53 | + - Format/quality selection (e.g. audio-only extraction) |
| 54 | + - Playlist and batch URL support |
| 55 | + - A progress hook using `yt-dlp`'s `progress_hooks` option |
| 56 | + - Retry logic for transient network failures |
| 57 | + |
| 58 | +## License |
| 59 | + |
| 60 | +MIT (or update to match your project's license). |
0 commit comments