https://github.com/chekos/spotify-to-sqlite
Convert a Spotify export zip to a SQLite database
https://github.com/chekos/spotify-to-sqlite
Last synced: 22 days ago
JSON representation
Convert a Spotify export zip to a SQLite database
- Host: GitHub
- URL: https://github.com/chekos/spotify-to-sqlite
- Owner: chekos
- License: apache-2.0
- Created: 2022-02-24T17:31:08.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2022-11-05T15:56:29.000Z (over 3 years ago)
- Last Synced: 2025-12-11T04:29:46.758Z (6 months ago)
- Language: Python
- Homepage:
- Size: 32.2 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# spotify-to-sqlite
[](https://pypi.org/project/spotify-to-sqlite/)
[](https://github.com/chekos/spotify-to-sqlite/releases)
[](https://github.com/chekos/spotify-to-sqlite/blob/main/LICENSE)
Convert a Spotify export zip to a SQLite database
## Installation
Install this library using `pip`:
$ pip install spotify-to-sqlite
## Usage
Convert a Spotify export zip to a SQLite database
```shell
spotify-to-sqlite convert my_spotify_data.zip spotify.db
```
You can use Spotify's Web API to retrieve audio features tracks in your `streaming_history` and `your_library_tracks` tables.
You will need a `CLIENT_ID` and a `CLIENT_SECRET` which you can get when you register an application the [Spotify Developer's site](https://developer.spotify.com/documentation/general/guides/authorization/app-settings/). You can export those as `SPOTIPY_CLIENT_ID` and `SPOTIPY_CLIENT_SECRET` (**notice it's SPOTI*P*Y not SPOTI*F*Y**).
You can also save those on a `.env` file on your working directory as such:
```text
# .env example
SPOTIPY_CLIENT_ID=adfgahjklsdf73932bcdlavsd7892dgfasd
SPOTIPY_CLIENT_SECRET=dabjgsd77507davsd12344dhgvafsdl
```
```shell
# when your converting export
spotify-to-sqlite --audio-features my_spotify_data.zip spotify.db
# if you already had converted your export you can pass a "-"
spotify-to-sqlite --audio-features - spotify.db
```
## Development
To contribute to this library, first checkout the code. Then create a new virtual environment:
cd spotify-to-sqlite
python -m venv venv
source venv/bin/activate
Or if you are using `pipenv`:
pipenv shell
Now install the dependencies and test dependencies:
pip install -e '.[test]'
To run the tests:
pytest