This script will delete the video from the playlist after download is finished. You can always remove the functionality by commenting out the following code snippet from the
your_script.py
.if remove_video_from_playlist(youtube_service, video_id): print(f"\nVideo with ID '{video_id}' removed from the playlist.") else: print(f"\nFailed to remove video with ID '{video_id}' from the playlist.")
Download Youtube videos from specific playlist using yt-dlp
- Clone the repository:
git clone https://github.com/yourusername/your-repo.git
- Change into the project directory:
cd your-repo
- Create a Google Cloud project and enable the YouTube Data API v3.
- Obtain the necessary credentials to access the API (API key or OAuth 2.0 credentials).
- Rename
.env.example
to.env
and fill in your API key, credentials and playlist id.
Install the required dependencies by running:
pip install -r requirements.txt
- Run the Python script:
python your_script.py
- Make sure you have proper authorization to access the private playlist.
- Protect your .env file and never share it, especially when containing sensitive data like API keys.