This is a Python script that allows you to download audio from the tracks in a Spotify playlist and save them as MP3 files using YouTube as the audio source.
- requests: for making HTTP requests
- base64: for encoding and decoding base64 data
- googleapiclient: for interacting with the YouTube API
- pytube: for downloading YouTube videos
pip install requests base64 google-api-python-client pytube
2) Replace the values of 'CLIENT_ID' and 'CLIENT_SECRET' with your own Spotify API credentials. You can obtain these credentials by creating a Spotify Developer account and registering a new application.
3) Replace the value of 'playlist_id' with the ID of the Spotify playlist that you want to download from.
4) Replace the value of 'ytkey' with your own YouTube API key. You can obtain a YouTube API key by creating a project in the Google Developers Console and enabling the YouTube Data API.
6) The script will retrieve the tracks from the Spotify playlist and search for the corresponding audio on YouTube. It will download the audio as MP3 files and save them to the destination folder specified in the destination variable.
7) After the download is complete, you will see a success message with the title of the downloaded track.
Note: Please be aware of the terms of use of the Spotify and YouTube APIs, as well as the terms of use of the downloaded audio files. Make sure to comply with all applicable laws and regulations related to copyright and intellectual property rights.
The program relies on the use of YouTube's API, which restricts the number of requests sent in per day. Therefore, the program won't run too many times per day
This problem can be dodged if we use another API to access YouTube, however, it is illegal and highly advised against.