A simple and open source spotify scraper.
 
 
 
Go to file
Michael Kuperfish Steinberg 36ead220fa Implement artist 'this is' playlist scraping 2023-01-23 22:59:25 +02:00
static/css Fix overlapping css 2023-01-20 16:14:34 +02:00
templates Remove unused settings 2023-01-21 12:00:40 +02:00
utils Implement artist 'this is' playlist scraping 2023-01-23 22:59:25 +02:00
.gitignore Implement singular track scraping 2023-01-05 15:00:57 +02:00
README.md Update README.md 2023-01-21 15:23:44 +02:00
auto_compressor.py Fix typos 2023-01-20 14:27:21 +02:00
config.py Add default Spotify creds 2023-01-21 15:36:47 +02:00
exceptions.py Refactor util classes & functions 2023-01-20 14:11:45 +02:00
keys.py Add default Spotify creds 2023-01-21 15:36:47 +02:00
main.py Fix startup to new name & tab openning 2023-01-05 14:53:09 +02:00
requirements.txt Add modules to requirements file 2023-01-05 14:37:46 +02:00
settings.py Remove unused settings from settings as well 2023-01-21 12:01:03 +02:00
spotify_client.py Add more verbose and accurate exceptions 2023-01-20 13:29:08 +02:00
spotify_mass_download.py Remove unused settings 2023-01-21 12:00:40 +02:00
spotify_scraper.py Implement artist 'this is' playlist scraping 2023-01-23 22:59:25 +02:00
webgui.py Remove unused settings 2023-01-21 12:00:40 +02:00

README.md

SpotiFile

A simple and open source spotify scraper.

Python 3.8+


Quick Start

Make sure you have python 3.8 or above.
$ git clone https://github.com/Michael-K-Stein/SpotiFile.git
$ cd SpotiFile
Now open config.py and setup your SP_KEY (Spotify has renamed this to sp_adid) and SP_DC tokens (see below)
$ python main.py


What?

SpotiFile is a script which allows users to simply and easily, using a web-gui, scrape on Spotify playlists, albums, artists, etc. More advanced usages can be done by importing the relevant classes (e.g. from "spotify_scraper import SpotifyScraper") and then using IPython to access specific Spotify API features.

Advantages

The main advantage of using SpotiFile is that it completely circumvents all of Spotify's api call limmits and restrictions. Spotifile offers an API to communicate with Spotify's API as if it were a real user. This allows SpotiFile to download information en-masse quickly.


Why?

Downloading massive amounts of songs and meta data can help if you prefer listening to music offline, or if you are desgining a music server which runs on an airgapped network. We do not encourage music piracy nor condone any illegal activity. SpotiFile is a usefull research tool. Usage of SpotiFile for other purposes is at the user's own risk.

Proper and legitimate uses of SpotiFile:


How?

SpotiFile starts its life by authenticating as a normal Spotify user, and then performs a wide range of conventional and unconventional API calls to Spotify in order to retrieve relevant information. SpotiFile does not actually download audio from Spotify, since they use proper DRM encryption to protect against piracy. Rather, SpotiFile finds the relevant audio file on Deezer, using the copyright id (ironically). Then SpotiFile downloads the "encrypted" audio file from Deezer, which failed to implement DRM properly. Credit for reversing Deezer's encryption goes to https://git.fuwafuwa.moe/toad/ayeBot/src/branch/master/bot.py & https://notabug.org/deezpy-dev/Deezpy/src/master/deezpy.py & https://www.reddit.com/r/deemix/ (Original reversing algorithm has been taken down).


Features

  • Authenticating as a legitimate Spotify user.
  • Scraping tracks from a playlist.
  • Scraping tracks from an album.
  • Scraping tracks from an artist.
  • Scraping playlists from a user.
  • Scraping playlists from a catergory.
  • Scraping a track from a track url.
  • Scraping artist images.
  • Scraping popular playlists' metadata and tracks.
  • Premium user token snatching (experimental).
  • Scraping song lyrics (time synced when possible).
  • Scraping track metadata.
  • Scraping category metadata.

SP_KEY & SP_DC tokens

Obtaining sp_dc and sp_key cookies (sp_key is now called sp_adid) SpotiFile uses two cookies to authenticate against Spotify in order to have access to the required services. Shoutout to @fondberg for the explanation https://github.com/fondberg/spotcast

To obtain the cookies, these different methods can be used:

Chrome based browser

Open a new Incognito window at https://open.spotify.com and login to Spotify. Press Command+Option+I (Mac) or Control+Shift+I or F12. This should open the developer tools menu of your browser. Go into the application section. In the menu on the left go int Storage/Cookies/open.spotify.com. Find the sp_dc and sp_key and copy the values. Close the window without logging out (Otherwise the cookies are made invalid).

Firefox based browser

Open a new Incognito window at https://open.spotify.com and login to Spotify. Press Command+Option+I (Mac) or Control+Shift+I or F12. This should open the developer tools menu of your browser. Go into the Storage section. (You might have to click on the right arrows to reveal the section). Select the Cookies sub-menu and then https://open.spotify.com. Find the sp_dc and sp_key and copy the values. Close the window without logging out (Otherwise the cookies are made invalid).