|
| 1 | +# YouTube Downloader (yt-dlp) |
| 2 | + |
| 3 | +A simple Python script for downloading videos or audio from YouTube using the `yt-dlp` tool. |
| 4 | + |
| 5 | +## Features |
| 6 | + |
| 7 | +- Download multiple YouTube videos or audio tracks at once. |
| 8 | +- Automatically saves downloads in a `downloads` folder located in the same directory as the script. |
| 9 | +- Supports downloading in either `mp4` (video) or `mp3` (audio) formats. |
| 10 | + |
| 11 | +## Prerequisites |
| 12 | + |
| 13 | +1. **Python 3.x**: |
| 14 | + - Ensure you have Python 3 installed on your system. You can download it from [python.org](https://www.python.org/). |
| 15 | + |
| 16 | +2. **yt-dlp**: |
| 17 | + - Install the `yt-dlp` tool using pip: |
| 18 | + ```bash |
| 19 | + pip install yt-dlp |
| 20 | + ``` |
| 21 | + |
| 22 | +3. **FFmpeg** (required for audio extraction): |
| 23 | + - Install FFmpeg for your platform: |
| 24 | + - **Linux**: Install via your package manager (e.g., `sudo apt install ffmpeg`). |
| 25 | + - **MacOS**: Install via Homebrew (`brew install ffmpeg`). |
| 26 | + - **Windows**: Download from [ffmpeg.org](https://ffmpeg.org/). |
| 27 | + |
| 28 | +## Installation |
| 29 | + |
| 30 | +1. Clone the repository or download the script: |
| 31 | + ```bash |
| 32 | + git clone https://github.com/yourusername/youtube-downloader.git |
| 33 | + cd youtube-downloader |
| 34 | +
|
| 35 | + 2. Ensure the script is executable: |
| 36 | +
|
| 37 | +chmod +x youtube_downloader.py |
| 38 | +
|
| 39 | +
|
| 40 | +
|
| 41 | +Usage |
| 42 | + 1. Run the script: |
| 43 | +
|
| 44 | +./youtube_downloader.py |
| 45 | +
|
| 46 | +
|
| 47 | + 2. Input YouTube URLs (one per line): |
| 48 | +
|
| 49 | +https://www.youtube.com/watch?v=example1 |
| 50 | +https://www.youtube.com/watch?v=example2 |
| 51 | +
|
| 52 | +Press Enter on an empty line to finish input. |
| 53 | +
|
| 54 | + 3. Choose the format: |
| 55 | + • Type mp4 for video. |
| 56 | + • Type mp3 for audio. |
| 57 | + 4. The script will download all files into the downloads folder. |
| 58 | +
|
| 59 | +Example Output |
| 60 | +
|
| 61 | +When the script runs, it will display the following: |
| 62 | +
|
| 63 | +==== YouTube Downloader (yt-dlp) ==== |
| 64 | +
|
| 65 | +Enter YouTube URLs, one per line. Then press Enter on an empty line to finish: |
| 66 | +https://www.youtube.com/watch?v=example1 |
| 67 | +https://www.youtube.com/watch?v=example2 |
| 68 | +
|
| 69 | +Choose format: 'mp4' for video or 'mp3' for audio: mp3 |
| 70 | +
|
| 71 | +Starting downloads in: /path/to/script/downloads |
| 72 | +
|
| 73 | +Downloading: https://www.youtube.com/watch?v=example1 |
| 74 | +Downloading: https://www.youtube.com/watch?v=example2 |
| 75 | +
|
| 76 | +All downloads completed! |
| 77 | +
|
| 78 | +Notes |
| 79 | + • The script automatically creates a downloads folder if it doesn’t already exist. |
| 80 | + • Invalid URLs will not be downloaded. |
| 81 | + • For issues with audio or video, ensure FFmpeg is correctly installed. |
| 82 | +
|
| 83 | +License |
| 84 | +
|
| 85 | +This project is licensed under the MIT License. See the LICENSE file for details. |
| 86 | +
|
| 87 | +Happy downloading! 🎥🎶 |
| 88 | +
|
| 89 | +You can customize the `git clone` URL or any other project-specific details as needed! |
0 commit comments