Skip to content
Cross-platform library to get the currently playing song and artist from Spotify without using the API. Very fast.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


Build Status Build status codecov PyPI Downloads

SwSpotify is a Python library to get the song and artist of the currently playing song from the Spotify application faster and without using the API. It works on Windows, Linux and macOS.

The original repository was spotilib which worked just for Windows and hasn't been updated since a long while when it broke on account of Spotify updating their application.

Originally made for use in SwagLyrics for Spotify.


Requires Python3. Use pip or pip3 depending on your installation. You might want to use the --user flag on Linux to avoid using pip as root.

pip install SwSpotify

For linux you need dbus which is usually pre-installed.


Use it in your project by importing it as:

from SwSpotify import spotify

Then you can access the song and artist as:

>>> spotify.artist()

Since mostly song and artist are used in conjunction, there is a current() method as well.

>>> spotify.current()
('Hello', 'Adele')

This allows you to access song and artist by tuple unpacking as:

>>> song, artist = spotify.current()

A SpotifyNotRunning Exception is raised if Spotify is closed or paused. SpotifyClosed and SpotifyPaused inherit from SpotifyNotRunning, meaning that you can catch both at the same time:

    title, artist = spotify.current()
except SpotifyNotRunning as e:
    print(f"{title} - {artist}")

In case Spotify is closed or paused, that will automatically be reflected in the value of e.

For finer control you can catch SpotifyClosed and SpotifyPaused separately.

Compiling SwSpotify for Development

  • Clone the repo by git clone or use ssh.
  • cd into the cloned repo.
  • pip install -e . the -e flag installs it locally in editable mode.


Sure, improvements/fixes/issues everything is welcome :)

You can’t perform that action at this time.