2021-04-10 01:22:02 +02:00
![License ](https://img.shields.io/github/license/kokarare1212/librespot-python.svg )
![Stars ](https://img.shields.io/github/stars/kokarare1212/librespot-python.svg )
![Forks ](https://img.shields.io/github/forks/kokarare1212/librespot-python.svg )
[![DeepSource ](https://deepsource.io/gh/kokarare1212/librespot-python.svg/?label=active+issues&show_trend=true )](https://deepsource.io/gh/kokarare1212/librespot-python/?ref=repository-badge)
2021-02-24 00:46:59 +01:00
# Librespot-Python
2021-02-24 00:44:57 +01:00
Open Source Spotify Client
2021-02-24 00:46:59 +01:00
## About The Project
This project was developed to make the music streaming service Spotify available on any device.
## Note
2021-02-28 03:45:21 +01:00
It is still in the idea stage, so there is a possibility of unintended behavior or major specification changes.
2021-04-06 00:13:13 +02:00
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 ](https://github.com/kokarare1212/librespot-python/blob/main/CODE_OF_CONDUCT.md ).
2021-02-24 00:46:59 +01:00
## Getting Started
### Prerequisites
* [Python ](https://python.org/ )
2021-02-25 22:51:44 +01:00
### Installation
2021-03-28 09:05:22 +02:00
Stable Version ** \*still not working.**
2021-02-25 22:51:44 +01:00
```commandline
pip install librespot
```
2021-03-28 09:05:22 +02:00
Snapshot Version \***Recommended**
2021-02-25 22:51:44 +01:00
```commandline
pip install git+https://github.com/kokarare1212/librespot-python
```
2021-02-24 00:46:59 +01:00
## Usage
2021-03-28 09:18:26 +02:00
### Get Spotify's OAuth token
2021-02-25 22:59:13 +01:00
```python
from librespot.core import Session
session = Session.Builder() \
.user_pass("< Username > ", "< Password > ") \
.create()
aceess_token = session.tokens().get("playlist-read")
```
2021-03-28 09:18:26 +02:00
### Get Music Stream
\*Currently, music streaming is supported, but it may cause unintended behavior.
```python
from librespot.core import Session
session = Session.Builder() \
.user_pass("< Username > ", "< Password > ") \
.create()
track_id = TrackId.from_uri("< TrackID ( ex , spotify:track:xxxxxxxxxxxxxxxxxxxxxx ) > ")
stream = session.content_feeder().load(track_id, VorbisOnlyAudioQuality(AudioQuality.AudioQuality.VERY_HIGH), False, None)
# stream.input_stream.stream().read() to get one byte of the music stream
```
2021-02-25 22:59:13 +01:00
Please read [this document ](https://librespot-python.rtfd.io ) for detailed specifications.
2021-02-24 00:46:59 +01:00
## Roadmap
2021-03-28 08:58:08 +02:00
Please read [ROADMAP.md ](https://github.com/kokarare1212/librespot-python/blob/main/ROADMAP.md ).
2021-04-06 00:08:31 +02:00
## Contributing
Pull requests are welcome.
2021-02-24 00:46:59 +01:00
## License
Distributed under the Apache-2.0 License. See `LICENSE.txt` for more information.
## Related Projects
* [Librespot ](https://github.com/librespot-org/librespot ) (Concept)
* [Librespot-Java ](https://github.com/librespot-org/librespot-java ) (Core)
## Special thanks
2021-03-28 08:58:08 +02:00
Coming soon