Skip to content

This repository contains a Python script that creates a private Spotify playlist with the Top 100 songs from the Billboard website on a specified date. It uses the spotipy library to authenticate the user with Spotify, search for the songs on Spotify, and add the songs to the playlist.

Izemaj/spotify-playlist-creator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

Billboard Top 100 Playlist Creator

This Python script creates a Spotify playlist of the Billboard Top 100 songs for a specified date. The user is prompted to enter a date in the format YYYY-MM-DD, and the script scrapes the Billboard website for the top 100 songs on that date. The script then searches Spotify for each song and adds the songs that are found to a new playlist, which is named after the specified date.

Usage Instructions

  1. Replace "REPLACE WITH YOUR CLIENT ID" and "REPLACE WITH YOUR CLIENT SECRET" with your actual Spotify client ID and secret in the Python script.
  2. Run the Python script and enter a date when prompted.
  3. The script will create a new private Spotify playlist with the name "{date} Billboard 100" and add the found songs to it.

How the Script Works

  1. The script starts by importing the necessary libraries: datetime, requests, BeautifulSoup, and spotipy.
  2. The script prompts the user to enter a date in the format YYYY-MM-DD.
  3. The script validates the user input and ensures that the entered date is not in the future.
  4. The script constructs a URL to scrape the Billboard website for the Top 100 songs on the entered date.
  5. The script sends a GET request to the URL using the requests library and parses the HTML content of the page using BeautifulSoup.
  6. The script extracts the names of the top 100 songs from the parsed HTML using BeautifulSoup selectors.
  7. The script logs into Spotify using the SpotifyOAuth class from the spotipy library, which authenticates the user and generates an access token for the Spotify Web API.
  8. The script retrieves the user ID of the logged-in user from the Spotify Web API.
  9. The script searches Spotify for each song extracted from the Billboard website using the Spotify Web API and adds the found songs to a list of song URIs.
  10. The script creates a new private Spotify playlist with the name "{date} Billboard 100" using the Spotify Web API and adds the found songs to it using the playlist_add_items() method from the spotipy library.
  11. The script completes execution, and the user can access the new Spotify playlist with the name "{date} Billboard 100".

Requirements

  • Python 3.7 or higher
  • requests library
  • BeautifulSoup4 library
  • spotipy library

Disclaimer

This project is for educational purposes only. The authors do not endorse or condone any copyright infringement or illegal use of Spotify or Billboard data.

About

This repository contains a Python script that creates a private Spotify playlist with the Top 100 songs from the Billboard website on a specified date. It uses the spotipy library to authenticate the user with Spotify, search for the songs on Spotify, and add the songs to the playlist.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages