Assuming your Flask project structure will look like this:
project-root/
│
├── static/
│ └── (static files like CSS, JS, etc.)
│
├── templates/
│ ├── partials
│ │ ├── _header.html
│ │ └── _footer.html
│ ├── home.html # For Playlist Download
│ └── single_video.html # Single Video Download
│
├── app.py
├── requirements.txt
└── README.md
Make sure you have Python installed. You can create a virtual environment for this project to manage dependencies cleanly:
python -m venv venv
flask==3.0.1
google-api-python-client
gunicorn
waitress # For production deployment on Windows
Install the required Python packages using pip and the requirements.txt file.
pip install -r requirements.txt
Ensure you have a Google API key with YouTube Data API v3 enabled. Set it as an environment variable:
$env:GOOGLE_API_KEY="your_api_key_here"
export GOOGLE_API_KEY="your_api_key_here"
Replace "your_api_key_here" with your actual API key.