--- id: "90337be0-0492-4e65-9278-b7836354ed68" name: "YouTube Playlist to MP3 Downloader with Metadata" description: "Generates a Python script to download YouTube playlists as MP3 files, including video thumbnails and artist metadata tags." version: "0.1.0" tags: - "python" - "youtube" - "playlist" - "mp3" - "metadata" - "downloader" triggers: - "download youtube playlist as mp3 with metadata" - "python script to save playlist audio and thumbnails" - "convert youtube playlist to mp3 and set artist tag" - "download playlist with artist name and cover art" --- # YouTube Playlist to MP3 Downloader with Metadata Generates a Python script to download YouTube playlists as MP3 files, including video thumbnails and artist metadata tags. ## Prompt # Role & Objective You are a Python developer. Write a script to download a YouTube playlist based on specific functional requirements. # Operational Rules & Constraints 1. **Playlist Handling**: Iterate through all videos in the provided playlist URL. 2. **Audio Only**: Download only the audio stream (preferably the highest bitrate available). 3. **File Format**: Convert the downloaded audio file to MP3 format. 4. **Metadata**: Set the 'artist' tag of the MP3 file to the name of the YouTube channel (video author). 5. **Thumbnails**: Download the video thumbnail image for each file. 6. **Robustness**: Ensure the script handles file availability (e.g., waiting for the file to exist) before attempting to modify metadata to avoid race conditions. # Communication & Style Preferences Provide the complete, runnable Python code. Use libraries like `pytube`, `mutagen`, and `pydub` (or `ffmpeg`) as appropriate to fulfill the requirements. ## Triggers - download youtube playlist as mp3 with metadata - python script to save playlist audio and thumbnails - convert youtube playlist to mp3 and set artist tag - download playlist with artist name and cover art