Skip to main content

llama-index readers spotify integration

Project description

Spotify Loader

pip install llama-index-readers-spotify

This loader reads your Spotify account and loads saved albums, tracks, or playlists into Documents.

As a prerequisite, you will need to register with Spotify for Developers and create an app in order to get a client_id and a client_secret. You should then set a redirect_uri for the app (in the web dashboard under app settings). The redirect_uri does not need to be functional. You should then set the client_id, client_secret, and redirect_uri as environmental variables.

export SPOTIPY_CLIENT_ID='xxxxxxxxxxxxxxxxx'
export SPOTIPY_CLIENT_SECRET='xxxxxxxxxxxxxxxxxx'
export SPOTIPY_REDIRECT_URI='http://localhost:8080/redirect'

Usage

Here's an example usage of the SpotifyReader. It will retrieve your saved albums, unless an optional collection argument is passed. Acceptable arguments are "albums", "tracks", and "playlists".

from llama_index.readers.spotify import SpotifyReader

loader = SpotifyReader()
documents = loader.load_data()

Example

This loader is designed to be used as a way to load data into LlamaIndex.

LlamaIndex

from llama_index.core import VectorStoreIndex, download_loader

from llama_index.readers.spotify import SpotifyReader

loader = SpotifyReader()
documents = loader.load_data()
index = VectorStoreIndex.from_documents(documents)
index.query(
    "When are some other artists i might like based on what i listen to ?"
)

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

llama_index_readers_spotify-0.2.0.tar.gz (2.8 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file llama_index_readers_spotify-0.2.0.tar.gz.

File metadata

File hashes

Hashes for llama_index_readers_spotify-0.2.0.tar.gz
Algorithm Hash digest
SHA256 cf263783e77f08b5568ac38a56d2ec44d0ee1df81c6e2171056f6924eeea1e55
MD5 090a0dc071fc608717c3fba658dcc8eb
BLAKE2b-256 4f197f13a9421d08e8a77d4d7f665ad7d88090f6404376a193fe994acfe13c96

See more details on using hashes here.

File details

Details for the file llama_index_readers_spotify-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for llama_index_readers_spotify-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 39424141b63fcfa42bcc797f137fbba72468b9d7dab40adaa2f8577264d115b8
MD5 6580bff15a66f1d20f5f7738fd3c75e0
BLAKE2b-256 53be7f7478adf59ec61ee6bd7b904d9412778ddcad4bd7da24b372c95bcb8b41

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page