|
1 |
| -# What is it? |
2 |
| -This is project is a spotify playlist create that use to |
| 1 | +# Billboard Hot 100 Playlist Creator On Spotify |
| 2 | +This Python script fetches Billboard Hot 100 songs from [Billboard Hot 100](https://www.billboard.com/charts/hot-100/), for a given date and creates a Spotify playlist with those songs. |
| 3 | + |
| 4 | +## Prerequisites |
| 5 | +Before running the script, make sure you have the following installed: |
| 6 | + |
| 7 | +*Python 3 |
| 8 | +*Python libraries: spotipy, requests, beautifulsoup4, dotenv |
| 9 | + |
| 10 | +Additionally, you need to have a [Spotify Developer](https://developer.spotify.com/) account and create an application to obtain client ID and client secret. Also, create a .env file with these credentials and a redirect URL. |
| 11 | +``` |
| 12 | +CLIENTID=your_client_id |
| 13 | +CLIENTSECRET=your_client_secret |
| 14 | +REDIRECT_URL=your_redirect_url |
| 15 | +``` |
| 16 | +## Usage |
| 17 | +Run the script main.py. |
| 18 | +Enter the date you would like to create a playlist for in YYYY-MM-DD format when prompted. |
| 19 | +The script will fetch Billboard Hot 100 songs for the given date, search for them on Spotify, and create a new private playlist with the retrieved songs. |
| 20 | + |
| 21 | +## Additional Notes |
| 22 | +### To Track Your Liked Songs |
| 23 | +To track your currently liked songs, you need to change the scope to 'user-library-read'. Uncomment the following section in the code: |
| 24 | +``` |
| 25 | +# TO TRACK YOUR CURRENT LIKED SONGS. # NOTE: YOU HAVE TO CHANGE THE 'SCOPE' TO 'user-library-read' |
| 26 | +
|
| 27 | +results = sp.current_user_saved_tracks() |
| 28 | +for idx, item in enumerate(results['items'], 1): |
| 29 | + track = item['track'] |
| 30 | + print(idx, track['artists'][0]['name'], " – ", track['name']) |
| 31 | +``` |
| 32 | +### Searching for Songs |
| 33 | +If you want to search for specific songs, uncomment the following section in the code: |
| 34 | +``` |
| 35 | +# SEARCH FOR THE SONGS. |
| 36 | +
|
| 37 | +sp = spotipy.Spotify(auth_manager=SpotifyClientCredentials(client_id=os.getenv('CLIENTID'), |
| 38 | + client_secret=os.getenv('CLIENTSECRET'))) |
| 39 | +
|
| 40 | +results = sp.search(q='tum hi ho', limit=50) |
| 41 | +for idx, track in enumerate(results['tracks']['items'], 1): |
| 42 | + print(idx, track['name']) |
| 43 | +``` |
| 44 | +This will search for the song 'tum hi ho', but you can replace it with any other song you want to search for. |
| 45 | + |
| 46 | +### Here's the video that demonstrate the program: |
| 47 | +https://github.com/AdityaPatadiya/spotify-playlist-create-using-python/assets/161931434/0c176071-bbe8-47d5-8255-8b3a1d0bba22 |
| 48 | + |
| 49 | + |
| 50 | + |
| 51 | + |
0 commit comments