A simple Flask application to download YouTube videos or audio with an option to select the resolution for videos.
- Download video in MP4 format with selectable resolution.
- Download audio in MP3 format.
- Caching mechanism to avoid redundant downloads.
- Python 3.x
pytube
librarypydub
libraryffmpeg
-
Install Python 3.x: Ensure Python is installed on your machine. You can download it from python.org.
-
Install required libraries:
pip install Flask pytube pydub
-
Install
ffmpeg
:- For Windows: Download from FFmpeg website and add the path to the
ffmpeg
bin directory to your system's PATH. - For macOS: Use Homebrew
brew install ffmpeg
- For Linux (Debian-based):
sudo apt update sudo apt install ffmpeg
- For Windows: Download from FFmpeg website and add the path to the
-
Clone the repository:
git clone https://github.com/afnantime/YouTubeDownloader.git cd YouTubeDownloader
-
Run the application:
python app.py
-
Open your web browser and go to
http://127.0.0.1:5000
. -
Follow the prompts:
- Enter the YouTube video URL.
- Enter 'mp3' to download audio or 'mp4' to download video.
- If downloading video, enter the desired resolution (e.g., '720p') or press Enter to download the highest resolution available.
This script is for educational purposes only. Please respect YouTube's Terms of Service and do not use this script to download copyrighted content without permission.