Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/Aveek-Saha/spotify-box
🎧 Update a pinned gist to show your top Spotify tracks/artists.
https://github.com/Aveek-Saha/spotify-box
gist gistbox pinned-gist secrets spotify spotify-box spotify-plugin
Last synced: about 1 month ago
JSON representation
🎧 Update a pinned gist to show your top Spotify tracks/artists.
- Host: GitHub
- URL: https://github.com/Aveek-Saha/spotify-box
- Owner: Aveek-Saha
- License: mit
- Created: 2020-10-12T19:02:20.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2022-03-10T08:55:55.000Z (almost 3 years ago)
- Last Synced: 2024-04-23T17:06:48.201Z (8 months ago)
- Topics: gist, gistbox, pinned-gist, secrets, spotify, spotify-box, spotify-plugin
- Language: JavaScript
- Homepage:
- Size: 36.1 KB
- Stars: 10
- Watchers: 2
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-pinned-gists - spotify-box - Update a pinned gist to show your weekly/monthly/all-time top Spotify tracks/artists. (External Services)
README
spotify-box
🎧 Update a pinned gist to show your top Spotify tracks/artists
---
> 📌✨ For more pinned-gist projects like this one, check out: https://github.com/matchai/awesome-pinned-gists
# Setup
## Prep work
### GitHub
1. Create a new public GitHub Gist. (https://gist.github.com/)
1. Create an access token with the `gist` scope and copy it. (https://github.com/settings/tokens/new)### Spotify
1. Go to the Spotify Developer Dashboard and log in. (https://developer.spotify.com/dashboard/)
1. Create an app with a name and description.
1. Copy the `Client ID` and `Client secret`.
1. Click on edit settings and add `http://localhost:5000/` as a redirect URI.
1. In your browser enter this URL and replace in this url:
```
https://accounts.spotify.com/authorize?client_id=
&response_type=code&redirect_uri=http://localhost:5000/
&scope=user-top-read%20user-read-recently-played
```
1. After this you should see an url like this in your address bar: `http://localhost:5000/?code=`. Copy this code query parameter.
1. Use this website to generate a base 64 string of the form `client_id:client_secret`. (https://www.base64encode.org/)
1. In a terminal, run the following command and use the base 64 encoded string and code from the previous steps.```command
curl -H "Authorization: Basic " -d grant_type=authorization_code -d code=
-d redirect_uri=http://localhost:5000/ https://accounts.spotify.com/api/token
```
1. A JSON response containing a `refresh_token` will be returned. Copy this value.## Project setup
1. Fork this repo
1. Go to the repo **Settings > Secrets**
1. Add the following environment variables:
- **GH_TOKEN:** The GitHub access token generated above.
- **GIST_ID:** The ID portion from your gist url: `https://gist.github.com/Aveek-Saha/`**`8335e85451541072dd25fda601129f7d`**.
- **CLIENT_ID:** Your Spotify `client_id`.
- **CLIENT_SECRET:** Your Spotify `client_secret`.
- **REFRESH_TOKEN:** The `refresh_token` generated.
- **TYPE:** The type of data generated on the gist. Can be one of `top_tracks`, `top_artists` or `recently_played`.
- **TIME_RANGE:** The time frame for computing `top_tracks` or `top_artists`. Can be one of `long_term`, `medium_term` or `short_term`.## Credits
This code was inspired by [@matchai's bird-box](https://github.com/matchai/bird-box).