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
Built Distribution
File details
Details for the file llama_index_readers_spotify-0.3.0.tar.gz
.
File metadata
- Download URL: llama_index_readers_spotify-0.3.0.tar.gz
- Upload date:
- Size: 2.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.11.10 Darwin/22.3.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5c547a0c7b7ef373f1bd458024717bde9612cba6ef02ab2afd9c0524ba9cb277 |
|
MD5 | 10cb26838e8f6e7d242ea1a509af5c0c |
|
BLAKE2b-256 | 736bd0953590b16463fb3e4e074f4e6ef0db682fced1e440e8f6ca2ae617ef08 |
File details
Details for the file llama_index_readers_spotify-0.3.0-py3-none-any.whl
.
File metadata
- Download URL: llama_index_readers_spotify-0.3.0-py3-none-any.whl
- Upload date:
- Size: 3.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.11.10 Darwin/22.3.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c02716f5c1a19e3afb6af4f79359bf9a71c9820e3dc731b7355e32becbd98a54 |
|
MD5 | 14e5f29bc53f0ed282c4616b5312995e |
|
BLAKE2b-256 | 9bbed0c1fac4133f27b7b2478a0128b782f4357de2a7b49e6d3f864f103ed74c |