Skip to content

Automatically add newly saved songs to a monthly playlist using Spotify's API.

Notifications You must be signed in to change notification settings

trevinbrooks/SpotifyMonthlyPlaylists

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SpotifyMonthlyPlaylists

Automatically add newly saved songs to a monthly playlist using Spotify's Web API.

Usage

To get started, first create an app on https://developers.spotify.com/. Be sure to set a Redirect URI in app's settings.

Install spotipy using pip.

pip install spotipy

or using

pip install -r requirements.txt

Basic Example

from monthlyplaylists import MonthlyPlaylists

spotify = MonthlyPlaylists(
    client_id='YOUR_CLIENT_ID',
    client_secret='YOUR_CLIENT_SECRET',
    redirect_uri='http://localhost:8888/callback'
)
spotify.update_monthly_playlists()

Calling update_monthly_playlists() checks for liked songs after a certain date and adds them to a playlist corresponding to the date the song was liked.

By default, only songs liked after the first of the month are added, and playlists are named using the current month's abbreviation and last 2 digits of the current year (ex: Jan 22).

Another Example

from monthlyplaylists import MonthlyPlaylists
from datetime import datetime, timedelta

one_yr_ago = datetime.now() - timedelta(days=365)
spotify = MonthlyPlaylists(
    client_id='YOUR_CLIENT_ID',
    client_secret='YOUR_CLIENT_SECRET',
    redirect_uri='http://localhost:8888/callback',
    date=one_yr_ago,
    name_format="%B '%y"
)
spotify.update_monthly_playlists()

This example will add every liked song from the last year into a monthly playlist using a different naming format (ex: January '22).

About

Automatically add newly saved songs to a monthly playlist using Spotify's API.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages