A CLI tool using puppeteer to intercept your own validated spotify OAuth token alongside of the session cookies, then reinject them to mimic an authorized, user-like traffic.
- Establish a session by authenticating to Spotify within a headless browser. (Puppeteer)
- Export the session cookies and store them locally, specifically the refresh token that will refresh the JWT every time it expires. (valid for one year)
- The access token allows you to perform special actions on behalf of a user.
git clone https://github.com/BelkaDev/Spotify-Headless ~/Spotify-Headless
cd ~/Spotify-Headless && npm install
To provide your credentials you need to set them as environement variables within your bashrc (or your default shell rc)
export SPOTIFY_USER=""
export SPOTIFY_PWD=""
Manually grab your access token: node token.js
Other commands are found under /lib
folder, they are examples of commands from the API with extra features (search, play/resume etc..)
The sole purpose is to combine aliases into automated and complex tasks, this can offer a lot of flexibility as shown below:
example 2 (Advanced) : Store to a local playlist, shuffle songs, set a timer, transfer ongoing stream to your mobile device.
play.js
reads input from stdin only, it works in pair with the search command.transfer.js
takesphone/mobile
,computer/pc
,browser
as parameters, if the suggested device isn't opened, it sends the signal to the actual active device.search.js
will lookup for tracks by default, unlike other items (albums,playlists etc..), tracks can be stacked and enqueued at once, more details here. It takesalbum
,artist
,playlist
as arguments.- snippets used in the examples can be found here
- Allow creating online playlists.
- Refactor/clean code
Catch random/annoying error messages.