Get an URL to a random saved Spotify album.
Project description
🍃 Spotify – get the URL of a random saved album
Usage
spotify-random-saved-album --h
usage: spotify-random-saved-album [-h] [--no-cache] [--update-cache] [--output-name] [--output-artist] [--uri]
options:
-h, --help show this help message and exit
--no-cache .cache.json won't be created
--update-cache force update cache file
--output-name append album's name to output
--output-artist append artist's name to output
--uri return URI instead of URL. You can pass URI to spotify.start_playback(context_uri=URI) to play the album instantly
(premium required)
Install - 7 steps:
-
Install dependencies and install the script:
sudo apt update sudo apt install git python3 python3-pip
pip install spotify-random-saved-album
-
login and create a new Spotify Developer app at https://developer.spotify.com/dashboard/applications
-
Open the created app on the Dashboard and click
Edit settings
-
Go to
Redirect URIs
-> add redirect URLhttp://127.0.0.1:9090
-
Copy
Client ID
andClient Secret
from the app's main page -
Create a new file
/path/to/.env
which will contain the Client ID and Client Secret:The
/path/to/.env
file should look like this:export SPOTIFY_ID=YOUR_CLIENT_ID export SPOTIFY_SECRET=YOUR_CLIENT_SEC
(optional): create and populate
/path/to/.env
with the following commands:touch .env # creates .env file echo "export SPOTIFY_ID=<YOUR_CLIENT_ID>" >> .env echo "export SPOTIFY_SECRET=<YOUR_CLIENT_SEC>" >> .env cat .env
-
Get the URL of a random saved album:
(Option A) source the
/path/to/.env
(sets $SPOTIFY_ID and $SPOTIFY_SECRET) and run thespotify-random-saved-album
commandsource /path/to/.env && spotify-random-saved-album
(Option B) the variables explicitly and run the script:
SPOTIFY_ID=<YOUR_CLIENT_ID> SPOTIFY_SECRET=<YOUR_CLIENT_SEC> spotify-random-saved-album
Notes
You have to pass the OAuth via browser once on last step.
Personal usecase of this script is to pipe the ouput (external link) to a browser command which will open a random album.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for spotify-random-saved-album-0.0.7.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2eed0d2394742c6e8a1526180b92956d1652daad05e738b45bd1c0e8a00f31ad |
|
MD5 | 86349e6c460001e523282f54b2117183 |
|
BLAKE2b-256 | da7bee314c2c6e1bfb92a5b80963347de2b3fd9a2c97f8949568627a5e6d03c6 |
Hashes for spotify_random_saved_album-0.0.7-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d908054f0e4e15ecd35163b976e40e8af6acbd4164f56a7c5c12f2fa255253ce |
|
MD5 | d7a74a53cf3864759ec324b9fdb5a7a7 |
|
BLAKE2b-256 | a12a4938060d62ebc7c9f3ac230a3618494d3139447d192d56ea68a2ca4713a1 |