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
- 👤 ACCOUNT INFORMATION
- 🏠 USER LIBRARY
- 🧑 USER
- 🎵 TRACK
- 🔍 SEARCH
- 🎶 LYRICS
- 🎤 ARTIST
- 🎧 PLAYER
- 📃 PLAYLIST
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.
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
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")
sp_dc
cookie is required to authenticate againstSpotify
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
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.
spotify.get_account_info()
Get Account Information of the authenticated User
spotify.get_home_page_info()
Retrieves information about the user's home page.
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.
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.
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.
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.
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 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 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.
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.
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.
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.
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.
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
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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
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
spotify.play_song()
Play/Resume currently playing song on the player.
spotify.pause_song()
Pause currently playing song on the player.
spotify.enable_repeat()
Enable repeating of the current context
spotify.enable_repeat_one()
Enable repeating of the current track.
spotify.disable_repeat()
Disable repeating.
spotify.enable_shuffle()
Enable shuffling of the current context.
spotify.disable_shuffle()
Disable shuffling of the current context.
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
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.
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.
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.
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)
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.
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.
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.
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.
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.
- 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.
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!
- Copyright © 2023 - aditya76-git / spotiscrape-spotify-api