Update README.md

This commit is contained in:
こうから 2021-03-28 16:18:26 +09:00 committed by GitHub
parent 0ae7ceda11
commit dc1c47032b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 17 additions and 1 deletions

View File

@ -21,7 +21,7 @@ Snapshot Version \***Recommended**
pip install git+https://github.com/kokarare1212/librespot-python
```
## Usage
Get Spotify's OAuth token
### Get Spotify's OAuth token
```python
from librespot.core import Session
@ -32,6 +32,22 @@ session = Session.Builder() \
aceess_token = session.tokens().get("playlist-read")
```
### 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
```
Please read [this document](https://librespot-python.rtfd.io) for detailed specifications.
## Roadmap
Please read [ROADMAP.md](https://github.com/kokarare1212/librespot-python/blob/main/ROADMAP.md).