Skip to content

SpotiScrape - Unofficial Spotify API - Access Account Information, User Details, Search Content, Manipulate Playlists, Control Player, Get Track and Playlist Information all with SpotiScrape

License

Notifications You must be signed in to change notification settings

aditya76-git/spotiscrape-spotify-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Logo


SpotiScrape - SPOTIFY API

Unlock Spotify Music Database and seamlessly access and extract music data from Spotify’s vast catalog with SpotiScrape, the ultimate API for developers and music enthusiasts.

Access Account Information, User Details, Search Content, Manipulate Playlists, Control Player, Get Track and Playlist Information all with SpotiScrape

📋Details

⚠️ Disclaimer

Please note that the spotiscrape package is provided as-is and is not officially endorsed or supported by Spotify. While we have taken care to ensure that the package interacts with the Spotify API in a secure and compliant manner, we cannot guarantee the safety of your Spotify account.

By using the spotiscrape package, you acknowledge and agree that you are responsible for any actions taken with your Spotify account, and you use the package at your own risk. We recommend using the package responsibly

We are not liable for any potential consequences that may arise from using the spotiscrape package, including but not limited to account suspension, data loss, or any other issues related to your Spotify account.

It's important to exercise caution and ensure that you keep your sensitive information, such as the sp_dc cookie, private and secure. If you have any concerns or questions, please refer to the documentation or seek assistance from the community.

⚙️Installation

Open your terminal or command prompt and enter the following command:

pip install git+https://github.com/aditya76-git/spotiscrape-spotify-api@main

Note: To use spotiscrape you need to have a Active Spotify Account

🚀Initialization

To get started, you need to initialize an instance of the SpotiScrape class by passing your Spotify DC Cookie as an argument. Make sure to replace "YOUR_SPOTIFY_DC_COOKIE" with your actual Spotify DC Cookie.

from spotiscrape import SpotiScrape
spotify = SpotiScrape("YOUR_SPOTIFY_DC_COOKIE")

🔍 How to Find sp_dc cookie?

  • sp_dc cookie is required to authenticate against Spotify in order to have access to the required services.
  • Using any extensions like Cookie-Editor can easily help you find it
  • Extension Link - Chrome WEB Store

Finding the sp_dc Cookie Value

Note: While cookies can contain sensitive information, the sp_dc cookie value is required for authentication and direct communication with the Spotify API within the scope of this open-source project. Rest assured that your sp_dc cookie will not be sent to any external server; it is solely used for interacting with Spotify's services through the project's codebase. However, caution is advised when sharing this cookie value outside the context of this project, as it could potentially lead to unauthorized access to your Spotify account.

👤ACCOUNT INFORMATION

➡️ Get Account Data

spotify.get_account_info()

Get Account Information of the authenticated User

🏠USER LIBRARY

➡️ Get Home Page Data

spotify.get_home_page_info()

Retrieves information about the user's home page.

➡️ Get Library Data

spotify.get_library(offset=0, limit=20)
Parameter Type Description Example
offset int Optional. The offset for pagination. Default is 0. 0
limit int Optional. The number of tracks to retrieve. Default is 50. 20

Get Libraray Data of the autheticated user's account.

🧑USER

➡️ Get User Profile Details

spotify.get_user_profile_details(userURL="https://open.spotify.com/user/31m4en72cpcracygwoxaiitbr2ba", limit=10)
Parameter Type Description Example
userURL string Optional. URL of the user's profile. Default is None (authenticated user). https://open.spotify.com/user/31m4en72cpcracygwoxaiitbr2ba or None
limit int Optional. The maximum number of playlists, artists, and episodes to retrieve. Default is 10. 5

Retrieves profile details for the given user URL or authenticated user.

➡️ Get Top Artists

spotify.get_top_artists(offset=0, limit=10)
Parameter Type Description Example
offset int Optional. The offset for pagination. Default is 0. 0
limit int Optional. The number of tracks to retrieve. Default is 10. 5

Retrieves the authenticated user's top Artists.

➡️ Get Top Tracks

spotify.get_top_tracks(offset=0, limit=10)
Parameter Type Description Example
offset int Optional. The offset for pagination. Default is 0. 0
limit int Optional. The number of tracks to retrieve. Default is 10. 5

Retrieves the authenticated user's top Tracks.

➡️ Get Connections (Followings or Followers)

spotify.get_connections(userURL="https://open.spotify.com/user/31m4en72cpcracygwoxaiitbr2ba" , type="following")
Parameter Type Description Example
userURL str Optional. URL of the user's profile. If not provided, uses the authenticated user's profile. https://open.spotify.com/user/31m4en72cpcracygwoxaiitbr2ba
type str Optional. Type of connections to retrieve. Can be 'following' or 'followers'. Default is 'following'. followers

Retrieves user's connections (followings or followers).

➡️ Check if artist(s) are in the user's library.

Check if you are following the artists or not

spotify.are_artists_in_library(artistURLs)
Parameter Type Description Example
artistURLs str Required. The URLs of the artists to check. If str provided then split by a + for the urls or else provide a list of artistURLs https://link1.com/1+https://link1.com/2

Check if artists are in the user's library.

➡️ Check if track(s) are in the user's library.

Check if you liked the songs or not

spotify.are_tracks_in_library(trackURLs)
Parameter Type Description Example
trackURLs str Required. The URLs of the tracks to check. If str provided then split by a + for the urls or else provide a list of artistURLs https://link1.com/1+https://link1.com/2

Check if tracks are in the user's library.

🎵TRACK

➡️ Get Track Info

spotify.get_track_info(trackURL)
Parameter Type Description Example
trackURL str Required. Spotify Track URL https://open.spotify.com/track/3taCbWWTilb7eNMsAzOBq4

Retrieves information about a track from its URL.

➡️ Get Poster URL

spotify.get_poster_url(trackURL)
Parameter Type Description Example
trackURL str Required. trackURL of a spotify song https://open.spotify.com/track/3taCbWWTilb7eNMsAzOBq4

Retrieves the poster URL for a track.

➡️ Get Recommended Tracks

spotify.get_recommended_tracks(trackURL)
Parameter Type Description Example
trackURL str Required. trackURL of a spotify song. https://open.spotify.com/track/3taCbWWTilb7eNMsAzOBq4

Retrieves recommended tracks based on the given track URL.

➡️ Get Track Metadata

spotify.get_track_metadata(trackURL)
Parameter Type Description Example
trackURL str Required. trackURL of a spotify song. https://open.spotify.com/track/3taCbWWTilb7eNMsAzOBq4

Retrieve metadata for a specific track.

➡️ Get Streaming URL, PSSH, fileID of Track

spotify.get_streams(trackURL, format="MP4_128").fileID
spotify.get_streams(trackURL, format="MP4_128").cdnURL
spotify.get_streams(trackURL, format="MP4_128").fileID
Parameter Type Description Example
trackURL str Required. trackURL of a spotify song. https://open.spotify.com/track/3taCbWWTilb7eNMsAzOBq4
format str Optional. Default is MP4_128 (128Kbps Audio) MP4_128

Retrieve Streaming URL, PSSH, fileID of Track

➡️ Get Track Credits

spotify.get_track_credits(trackURL)
Parameter Type Description Example
trackURL str Required. trackURL of a spotify song. https://open.spotify.com/track/3taCbWWTilb7eNMsAzOBq4

Retrieves credits information for a track.

🔍SEARCH

➡️ Search

spotify.search(query, filter="artists")
Parameter Type Description Example
query str Required. Query to search for Ed Sheeran
filter str Optional. The type of filter to apply to the search results. Default is None. Can be topResults, albums, artists, episodes, genres, playlists, podcasts, audiobooks, users artists

Searches for content on Spotify based on the provided query.

🎶LYRICS

➡️ Get Lyrics

spotify.get_lyrics(trackURL, format="lrc")
Parameter Type Description Example
trackURL str Required. trackURL of a spotify song https://open.spotify.com/track/3taCbWWTilb7eNMsAzOBq4
format str or None Optional. format to get lyrics timestamp in None or lrc

Retrieves lyrics for a track.

🎤ARTIST

➡️ Get Artist Info

spotify.get_artist_info(artistURL, filter="profile")
spotify.get_artist_info(artistURL, topTracks=True)
Parameter Type Description Example
artistURL str Required. artistURL of a Spotify Artist https://open.spotify.com/artist/00FQb4jTyendYWaN8pK0wa
filter str Optional. Filter to narrow down the artist information. discography, goods, profile, relatedContent, sharingInfo, stats, visuals
topTracks bool Optional. Whether to retrieve the artist's top tracks. Default is None. True

Note: filter and topTracks can't be applied at the same time Retrieves artist information for the given artist URL.

➡️ Get Artist Discography

spotify.get_artist_discography_all(artistURL, limit=0, offset=50)
Parameter Type Description Example
artistURL str Required. artistURL of a Spotify Artist https://open.spotify.com/artist/00FQb4jTyendYWaN8pK0wa
offset int Optional. The offset for pagination. Default is 0. 0
limit int Optional. The number of tracks to retrieve. Default is 50. 20

Retrieves the complete discography of an artist.

➡️ Follow Artist

spotify.follow_artist(artistURL)
Parameter Type Description Example
artistURL str Required. artistURL of a spotify Artist https://open.spotify.com/artist/00FQb4jTyendYWaN8pK0wa

Follow an artist.

➡️ UnFollow Artist

spotify.unfollow_artist(artistURL)
Parameter Type Description Example
artistURL str Required. artistURL of a spotify Artist https://open.spotify.com/artist/00FQb4jTyendYWaN8pK0wa

UnFollow an artist.

🎧PLAYER

➡️ Get Recently Played

spotify.get_recently_played(offset=0, limit=50)
Parameter Type Description Example
offset int Optional. The offset for pagination. Default is 0. 0
limit int Optional. The number of tracks to retrieve. Default is 50. 20

Retrieves recently played tracks for the authenticated user.

➡️ Get Liked Songs

spotify.get_liked_songs(offset=0, limit=50)
Parameter Type Description Example
offset int Optional. The offset for pagination. Default is 0. 0
limit int Optional. The number of tracks to retrieve. Default is 50. 20

Retrieves liked songs for the authenticated user.

➡️ Add to Queue

spotify.add_to_queue(trackURL)
Parameter Type Description Example
artistURL str Required. trackURL of a spotify Track https://open.spotify.com/track/3taCbWWTilb7eNMsAzOBq4

Add a track to the queue.

➡️ Like Song

spotify.like_song(trackURL)
Parameter Type Description Example
trackURL str Required. trackURL of a spotify Track https://open.spotify.com/track/6MlIIJwO4FxnOlrpOrS4hU

Like a Song

➡️ UnLike Song

spotify.unlike_song(trackURL)
Parameter Type Description Example
trackURL str Required. trackURL of a spotify Track https://open.spotify.com/track/6MlIIJwO4FxnOlrpOrS4hU

UnLike a Song

➡️ Play Song

spotify.play_song()

Play/Resume currently playing song on the player.

➡️ Pause Song

spotify.pause_song()

Pause currently playing song on the player.

➡️ Enable Repeat On Player

spotify.enable_repeat()

Enable repeating of the current context

➡️ Enable Repeat of Current Track On Player

spotify.enable_repeat_one()

Enable repeating of the current track.

➡️ Disable Repeat On Player

spotify.disable_repeat()

Disable repeating.

➡️ Enable Shuffle on Player

spotify.enable_shuffle()

Enable shuffling of the current context.

➡️ Disable Shuffle on Player

spotify.disable_shuffle()

Disable shuffling of the current context.

➡️ Devices

spotify.devices().prev_tracks
spotify.devices().next_tracks
spotify.devices().playback_speed
spotify.devices().playback_quality

Get Devices Connected with the Authenticated Account and other Information like list, prev_tracks, next_tracks, playback_speed, playback_quality, SMARTPHONE_DEVICE_ID, COMPUTER_DEVICE_ID, ALL_DATA, PRIMARY_DEVICE_ID, ACTIVE_DEVICE_ID

📃PLAYLIST

➡️ Get Playlist Info

spotify.get_playlist_info(playlistURL, offset=0, limit=20)
Parameter Type Description Help
playlistURL string Required. playlistURL of a spotify Playlist https://open.spotify.com/playlist/33P0GdndkqEel2IgwNwb9F
offset int Optional. The offset for pagination. Default is 0. 0
limit int Optional. The number of tracks to retrieve. Default is 25. 20

Retrieves playlist information for the given playlist URL.

➡️ Move Items in Playlist

spotify.move_items_in_playlist(playlistURL, trackURL, 5)
Parameter Type Description Example
playlistURL str Required. playlistURL of a spotify Playlist https://open.spotify.com/playlist/33P0GdndkqEel2IgwNwb9F
trackURL str Required. trackURL of a spotify track to be moved https://open.spotify.com/track/6MlIIJwO4FxnOlrpOrS4hU
newPosition int Required. The new position for the track https://open.spotify.com/track/6MlIIJwO4FxnOlrpOrS4hU

Move a track within a playlist to a new position.

➡️ Re-Order Items in Playlist

spotify.reorder_items_in_playlist(playlistURL, 1, 5)
Parameter Type Description Example
playlistURL str Required. playlistURL of a spotify Playlist https://open.spotify.com/playlist/33P0GdndkqEel2IgwNwb9F
oldPosition int Required. The current position of the track 1
newPosition int Required. The new position for the track 5

Reorder tracks within a playlist.

➡️ Add Track to Playlist

spotify.add_track_to_playlist(trackURL, playlistURL, position="TOP")
spotify.add_track_to_playlist(trackURL, playlistURL, position="BOTTOM")
Parameter Type Description Example
trackURL str Required. trackURL of a spotify Track to be added https://open.spotify.com/track/6MlIIJwO4FxnOlrpOrS4hU
playlistURL str Required. playlistURL of a spotify Track https://open.spotify.com/playlist/33P0GdndkqEel2IgwNwb9F
position str Required. The position to add the track (TOP, BOTTOM, or None) Defaults to TOP BOTTOM

Add a track to a playlist. (TOP or BOTTOM - Defaults to TOP)

➡️ Remove Track from Playlist

spotify.remove_track_from_playlist(trackURL, playlistURL)
Parameter Type Description Example
trackURL str Required. trackURL of a spotify Track to be removed https://open.spotify.com/track/6MlIIJwO4FxnOlrpOrS4hU
playlistURL str Required. playlistURL of a spotify Track https://open.spotify.com/playlist/33P0GdndkqEel2IgwNwb9F

Remove a track from a playlist.

➡️ Pin Playlist

spotify.pin_playlist(playlistURL)
Parameter Type Description Example
playlistURL str Required. playlistURL of a spotify Track https://open.spotify.com/playlist/33P0GdndkqEel2IgwNwb9F

Pin a playlist to your library.

➡️ UnPin Playlist

spotify.unpin_playlist(playlistURL)
Parameter Type Description Example
playlistURL str Required. playlistURL of a spotify Track https://open.spotify.com/playlist/33P0GdndkqEel2IgwNwb9F

Unpin a playlist from your library.

➡️ List Public Playlists of a User

spotify.get_public_playlists(userURL="https://open.spotify.com/user/31m4en72cpcracygwoxaiitbr2ba" , offset=0, limit=10)
Parameter Type Description Example
userURL str Required. The URL of the user's profile. If None, gets authenticated User Public Playlists https://open.spotify.com/user/31m4en72cpcracygwoxaiitbr2ba or None
offset int Optional. The offset for pagination. Default is 0. 0
limit int Optional. The maximum number of playlists to retrieve. Default is 200 20

Get public playlists of a user.

➡️ Edit Playlist Details

spotify.edit_playlist_details(playlistURL, newTitle, newDescription="New Description Edited Using Spotiscrape")
spotify.edit_playlist_details(playlistURL, newTitle)
Parameter Type Description Example
playlistURL str Required. playlistURL of a spotify Track https://open.spotify.com/playlist/33P0GdndkqEel2IgwNwb9F
newTitle str Required. The new title for the playlist. PHONK
newDescription str or None Optional. The new description for the playlist. New Description Edited Using Spotiscrape Default to Blank

Edit playlist details.

🌟 Show Your Support

  • If you find this project useful or interesting, please consider giving it a star on GitHub. It's a simple way to show your support and help others discover the project.

Github Stars

👨‍💻Developement

Thank you for your interest in contributing to this project! There are several ways you can get involved:

  • Opening Issues: If you encounter a bug, have a feature request, or want to suggest an improvement, please open an issue. We appreciate your feedback!
  • Cloning the Project: To work on the project locally, you can clone the repository by running:
git clone https://github.com/aditya76-git/spotiscrape-spotify-api.git
  • Sending Pull Requests: If you'd like to contribute directly to the codebase, you can fork the repository, make your changes, and then send a pull request. We welcome your contributions!

💻Authors

About

SpotiScrape - Unofficial Spotify API - Access Account Information, User Details, Search Content, Manipulate Playlists, Control Player, Get Track and Playlist Information all with SpotiScrape

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages