From dc1c47032bf8f6d0c477ef0d6a765171312b88b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=93=E3=81=86=E3=81=8B=E3=82=89?= Date: Sun, 28 Mar 2021 16:18:26 +0900 Subject: [PATCH] Update README.md --- README.md | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 562bf6c..5e393d2 100644 --- a/README.md +++ b/README.md @@ -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("", "") \ + .create() + +track_id = TrackId.from_uri("") + +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).