Open Source Spotify Client
Project description
Librespot-Python
Open Source Spotify Client
About The Project
This project was developed to make the music streaming service Spotify available on any device.
Attention!
This repository has been completely rewritten from the transplant.
There may be some functions that are not implemented yet.
If so, please feel free to open an issue.
Note
It is still in the idea stage, so there is a possibility of unintended behavior
or major specification changes.
We DO NOT encourage piracy and DO NOT support any form of downloader/recorder designed with the help of this repository and in general anything that goes against the Spotify ToS.
For other guidelines, please see CODE_OF_CONDUCT.md.
Getting Started
Prerequisites
Installation
Stable Version
pip install librespot
Snapshot Version *Recommended
pip install git+https://github.com/kokarare1212/librespot-python
Usage
Use Zeroconf for Login
from librespot.zeroconf import ZeroconfServer
zeroconf = ZeroconfServer.Builder().create()
Get Spotify's OAuth token
from librespot.core import Session
session = Session.Builder() \
.user_pass("Username", "Password") \
.create()
access_token = session.tokens().get("playlist-read")
Get Music Stream
*Currently, music streaming is supported, but it may cause unintended behavior.
from librespot.core import Session
from librespot.metadata import TrackId
from librespot.audio.decoders import AudioQuality, VorbisOnlyAudioQuality
session = Session.Builder() \
.user_pass("Username", "Password") \
.create()
track_id = TrackId.from_uri("spotify:track:xxxxxxxxxxxxxxxxxxxxxx")
stream = session.content_feeder().load(track_id, VorbisOnlyAudioQuality(AudioQuality.VERY_HIGH), False, None)
# stream.input_stream.stream().read() to get one byte of the music stream.
Other uses are examples or read this document for detailed specifications.
Debug
To display the debug information, you need to inject the following code at the top of the code.
import logging
logging.basicConfig(level=logging.DEBUG)
Contributing
Pull requests are welcome.
License
Distributed under the Apache-2.0 License. See LICENSE.txt for more information.
Related Projects
- Librespot (Concept)
- Librespot-Java (Core)
Special thanks
Project details
Release history Release notifications | RSS feed
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 librespot-0.0.9.tar.gz
.
File metadata
- Download URL: librespot-0.0.9.tar.gz
- Upload date:
- Size: 103.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b997ae7cf5fc1b5a430acb4ef0e80cd820ebaa60818d326fccd724c184e42a44 |
|
MD5 | 76b9e36d574c076a39140d32f6abf11b |
|
BLAKE2b-256 | 37bce40c51aa80a566c83ea8cfc90f920269e8d26c617a3eedf9f6d29f3b6555 |
File details
Details for the file librespot-0.0.9-py3-none-any.whl
.
File metadata
- Download URL: librespot-0.0.9-py3-none-any.whl
- Upload date:
- Size: 134.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 901b42d24d56112c52b0550b22115c4666de9a54c2fb57507beb63392f4c3c32 |
|
MD5 | 47ea72031856393115d7d2786a8bd22c |
|
BLAKE2b-256 | 2e2a3b2242182bae7a35e8cf71bc3a5d94857c63f990cf0678f40d08785bf8bb |