Git Product home page Git Product logo

spotify2py's Introduction

Spotify2py

Installation

pip install spotify2py

This library can be installed by the pip command, open your command prompt and type in the following command...

Overview of this library

First import the library using the import method from spotify2py import Spotify and then proceed to call the functions

get_token()

  • This function can be used to generate spotify api token.

  • Use the function with Spotify CLIENT_ID & CLIENT_SECRET to generate a token.

from spotify2py import Spotify

var = Spotify().get_token(CLIENT_ID="your_CLIENT_ID", CLIENT_SECRET="your_CLIENT_SECRET")

print(var)

recently_played()

  • This function can be used list the recently played track names & track url.

  • Use the function with Spotify API Token.

from spotify2py import Spotify

var = Spotify(token="token").recently_played(show=0)

print(var)
  • Use the show={} method to get previous track, limit = 10.

get_artist()

  • This function can be used to get meta data about artists.

  • Use the function with Spotify API Token & Artist Name.

from spotify2py import Spotify

var = Spotify(token="token").get_artist("alan walker")

print(var)

Output of this program:

{
    'artist_name': 'Alan Walker', 
    'artist_url': 'https://open.spotify.com/artist/7vk5e3vY1uw9plTHJAMwjN', 
    'artist_image': 'https://i.scdn.co/image/ab6761610000e5ebfc16b9995c5301d3f7e5fad4', 
    'artist_total_followers': 29131930, 
    'artist_genres': 'electro house'
}

get_album()

  • This function can be used to get meta data about album.

  • Use the function with Spotify API Token & Album Name.

from spotify2py import Spotify

var = Spotify(token="token").get_album("shockwave")

print(var)

Output of this program:

{
    'album_name': 'Marshmello', 
    'album_url': 'https://open.spotify.com/album/6yXPyhVxt3PHBwkinPFn6I', 
    'total_tracks': 12, 
    'album_image': 'https://i.scdn.co/image/ab67616d0000b273d82de295af2bbdc06fb14068', 
    'artist_name': 'Shockwave', 
    'album_release_date': '2021-06-11', 
    'artist_url': 'https://open.spotify.com/artist/64KEffDW9EtZ1y2vBYgq8T'
}

featured_playlist()

  • This function can be used to get meta data about featured playlist of your spotify account.

  • Use the function with Spotify API Token.

from spotify2py import Spotify

var = Spotify(token="token").featured_playlist(show=0)

print(var)

Output of this program:

{
    'playlist_name': 'Easy On Saturday', 
    'playlist_description': 'Lekker rustig aan doen op zaterdag met deze zachte pop liedjes.', 
    'playlist_url': 'https://open.spotify.com/playlist/37i9dQZF1DX79N7YUDFu8f', 
    'playlist_image': 'https://i.scdn.co/image/ab67706f00000003e62a57481e6aaeb533bea9b3'
}
  • Use the show={} method to get previous or next playlist, limit = 10.

user_profile()

  • This function can be used to get meta data about user's profile .

  • Use the function with Spotify API Token & **User ID.

from spotify2py import Spotify

var = Spotify(token="token", user_id="user-id").user_profile()

print(var)

user_playlists()

  • This function can be used to get meta data about user's playlists.

  • Use the function with Spotify API Token & **User ID.

from spotify2py import Spotify

var = Spotify(token="token", user_id="user-id").featured_playlist(show=0)

print(var)
  • Use the show={} method to get previous or next playlist, limit = based on user's playlists count.

new_releases()

  • This function can be used to get meta data about new releases albums.

  • Use the function with Spotify API Token.

from spotify2py import Spotify

var = Spotify(token="token").new_releases(show=0)

print(var)

Output of this program:

{
    'album_name': 'Wasting Time ( feat. Drake )', 
    'album_url': 'https://open.spotify.com/album/2brWccDLT5vREu0FxqH6Az', 
    'album_image': 'https://i.scdn.co/image/ab67616d0000b2739b10373df0740a95838b7dd9'
}
  • Use the show={} method to get previous or next playlist, limit = 10.

get_track()

  • This function can be used to get meta data about track's.

  • Use the function with Spotify API Token & Track Name.

from spotify2py import Spotify

var = Spotify(token="token").get_track("faded")

print(var)

Output of this program:

{
    'artist_name': 'Alan Walker', 
    'artist_url': 'https://open.spotify.com/artist/7vk5e3vY1uw9plTHJAMwjN', 
    'track_image': 'https://i.scdn.co/image/ab67616d0000b273c4d00cac55ae1b4598c9bc90', 
    'track_url': 'https://open.spotify.com/track/7gHs73wELdeycvS48JfIos', 
    'track_name': 'Faded', 
    'track_release_date': '2015-12-04'
}

play()

  • This function can be used to play tracks on spotify web .

  • Use the function with Spotify API Token & Track Name.

from spotify2py import Spotify

var = Spotify(token="token", user_id="user-id").play("alone marshmello")

print(var)

Authorization Scopes

Images : ugc-image-upload
Playlists : playlist-modify-private, playlist-read-private, playlist-modify-public, playlist-read-collaborative
Users : user-read-private, user-read-email 
Spotify Connect : user-read-playback-state, user-modify-playback-state, user-read-currently-playing
Library : user-library-modify, user-library-read
Listening History : user-read-playback-position, user-read-recently-played, user-top-read Playback, app-remote-control streaming
Follow : user-follow-modify, user-follow-read

External Links:

Spotify Web API documentation
Create a application
Spotify Web API Console

spotify2py's People

Contributors

cj-praveen avatar

Stargazers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.