Skip to main content

spotify-webplayer-accesstoken

Utility script to get Spotify’s web player access token which has more permissions than the normal one that can be obtained through the Spotify API.

This was inspired by kopiro’s work on the same thing on Node (link).

Installing

pip install spotify_token

Usage

To obtain the cookies (valid for 1 year):

  1. Open a new Incognito window in Chrome (or another browser) at https://accounts.spotify.com/en/login?continue=https:%2F%2Fopen.spotify.com%2F

  2. Open Developer Tools in your browser (might require developer menu to be enabled in some browsers)

  3. Login to Spotify.

  4. Search/Filter for get_access_token in Developer tools under Network.

  5. Under cookies for the request save the values for sp_dc and sp_key.

  6. Close the window without logging out (Otherwise the cookies are made invalid).

An access token can be obtained by running the following:

import spotify_token as st

data = st.start_session("sp_dc","sp_key")
access_token = data[0]
expiration_date = data[1]

License

This project is licensed under the MIT License - see the LICENSE file for details

Metadata

Release files for spotify-token 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for spotify-token 1.0.0
File Size Uploaded
spotify_token-1.0.0.tar.gz 2.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for spotify-token 1.0.0
File Interpreter ABI Platform
spotify_token-1.0.0-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 5.8 kB

Release files / spotify_token-1.0.0.tar.gz

Download URL spotify_token-1.0.0.tar.gz
Size 2.4 kB
Tags Source
SHA-256 checksum
How to use checksums
9628509cdeac4ddccbb13401f3bb23818c8cb20315fd3061c4b610cdb9f26cb2
BLAKE2b-256 checksum
How to use checksums
34775c6e7df64edc56286ebbd036e405aa6ff21d6864f96cbd5e428408e09b92
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.15.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.0.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.5.9

Release files / spotify_token-1.0.0-py2.py3-none-any.whl

Download URL spotify_token-1.0.0-py2.py3-none-any.whl
Size 3.5 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
4b9aed57d51a7308ce44cf3950bddd854ca39f045d3502105e5ef048fb183aae
BLAKE2b-256 checksum
How to use checksums
d6f59bf0e6664d6afa27e7329c949707d9c3ce143b1154895d0f49b836952bf4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.15.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.0.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.5.9

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page