This project port "@TooTallNate/spotify-uri" to Python.
Project description
pyspotify-uri
This project port "@TooTallNate/spotify-uri" to Python.
Parse and format the various Spotify URI formats
Spotify URIs get passed around in a variety of flavors.
You can also convert them back into Spotify URIs or HTTP URLs.
Installation
pip install spotify-uri
Example
import spotify_uri
# parse Spotify URIs or HTTP URLs:
parsed = spotify_uri.parse("spotify:track:3GU4cxkfdc3lIp9pFEMMmw")
print(parsed.__dict__)
# {
# 'type': 'track',
# 'id': '3GU4cxkfdc3lIp9pFEMMmw',
# 'uri': 'spotify:track:3GU4cxkfdc3lIp9pFEMMmw'
# }
parsed = spotify_uri.parse("http://open.spotify.com/track/1pKYYY0dkg23sQQXi0Q5zN")
print(parsed.__dict__)
# {
# 'type': 'track',
# 'id': '1pKYYY0dkg23sQQXi0Q5zN',
# 'uri': 'http://open.spotify.com/track/1pKYYY0dkg23sQQXi0Q5zN'
# }
# you can also format the parsed objects back into a URI or HTTP URL:
uri = spotify_uri.formatURI("http://open.spotify.com/track/1pKYYY0dkg23sQQXi0Q5zN")
print(uri)
# spotify:track:1pKYYY0dkg23sQQXi0Q5zN
uri = spotify_uri.formatOpenURL("spotify:track:3GU4cxkfdc3lIp9pFEMMmw")
print(uri)
# http://open.spotify.com/track/3GU4cxkfdc3lIp9pFEMMmw
uri = spotify_uri.formatPlayURL("spotify:track:3GU4cxkfdc3lIp9pFEMMmw")
print(uri)
# https://play.spotify.com/track/3GU4cxkfdc3lIp9pFEMMmw
uri = spotify_uri.formatEmbedURL("spotify:track:3GU4cxkfdc3lIp9pFEMMmw")
print(uri)
# https://embed.spotify.com/?uri=spotify:track:3GU4cxkfdc3lIp9pFEMMmw
License
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
spotify_uri-1.0.2.tar.gz
(5.9 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file spotify_uri-1.0.2.tar.gz.
File metadata
- Download URL: spotify_uri-1.0.2.tar.gz
- Upload date:
- Size: 5.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8f50aa3c8d0381d9806c482b6daeac3bdcee2ed9fdeac2a9bbec98dd026a7e89
|
|
| MD5 |
27e5963d0949e441d2f30c94522dc177
|
|
| BLAKE2b-256 |
6250ec895c318e0a545695b4219e1342d82086ee8aa34eba573f6bdc87b46559
|
File details
Details for the file spotify_uri-1.0.2-py3-none-any.whl.
File metadata
- Download URL: spotify_uri-1.0.2-py3-none-any.whl
- Upload date:
- Size: 8.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c6c080a45b91c332cae857257d6293aac5ce786e12e91298bd6e71ea1e0d178d
|
|
| MD5 |
4eb0fb7dbae1aa94fbd542611c3d0675
|
|
| BLAKE2b-256 |
915cf17356901f111e79ad504877233a4e08b32576276e75eddacbb49243cea6
|