One Paragraph of project description goes here
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.
pip install spotipy | |
pip install requests |
# Import the libraries | |
import os | |
import pandas as pd | |
import numpy as np | |
import json | |
import matplotlib.pyplot as plt | |
import seaborn as sns | |
import spotipy | |
import spotipy.util as util | |
from spotipy.oauth2 import SpotifyClientCredentials |
# Declare the credentials | |
cid = 'XXXX' | |
secret = 'XXXX' | |
redirect_uri='http://localhost:7777/callback' | |
username = 'XXXX' | |
# Authorization flow | |
scope = 'user-top-read' | |
token = util.prompt_for_user_token(username, scope, client_id=cid, client_secret=secret, redirect_uri=redirect_uri) |
export SPOTIPY_CLIENT_ID="XXXX" | |
export SPOTIPY_CLIENT_SECRET="XXXX" | |
export SPOTIPY_REDIRECT_URI="http://localhost:7777/callback" |
def create_playlist(sp, username, playlist_name, playlist_description): | |
playlists = sp.user_playlist_create(username, playlist_name, description = playlist_description) |
def enrich_playlist(sp, username, playlist_id, playlist_tracks): | |
index = 0 | |
results = [] | |
while index < len(playlist_tracks): | |
results += sp.user_playlist_add_tracks(username, playlist_id, tracks = playlist_tracks[index:index + 100]) | |
index += 100 |
df_party.boxplot(vert = False, figsize = (13,7), showfliers = False, showmeans = True, | |
patch_artist=True, boxprops=dict(linestyle='-', linewidth=1.5), | |
flierprops=dict(linestyle='-', linewidth=1.5), | |
medianprops=dict(linestyle='-', linewidth=1.5), | |
whiskerprops=dict(linestyle='-', linewidth=1.5), | |
capprops=dict(linestyle='-', linewidth=1.5)) | |
plt.title("Original Playlist's Box Plot", fontsize=16, fontweight='heavy') | |
plt.show() |
def fetch_playlist_tracks(sp, username, playlist_id): | |
""" | |
Returns the tracks for the given playlist. | |
""" | |
offset = 0 | |
tracks = [] | |
# Make the API request | |
while True: |
def fetch_playlists(sp, username): | |
""" | |
Returns the user's playlists. | |
""" | |
id = [] | |
name = [] | |
num_tracks = [] | |
# Make the API request |