mirror of
https://github.com/spotipy-dev/spotipy.git
synced 2026-06-19 09:13:53 +00:00
Updated _regex_spotify_url to ignore /intl-<countrycode> in Spotify links (#1100)
* Updated _regex_spotify_url to ignore /intl-<countrycode> in Spotify links * Updated documentation link and added some additional information
This commit is contained in:
parent
b109ca722c
commit
939b7557a5
@ -26,6 +26,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
- Fixed error obfuscation when Spotify class is being inherited and an error is raised in the Child's `__init__`
|
||||
- Replaced `artist_albums(album_type=...)` with `artist_albums(include_groups=...)` due to an API change.
|
||||
- Restructured the tutorial in `index.rst` to improve logical flow and made some minor edits.
|
||||
- Updated _regex_spotify_url to ignore `/intl-<countrycode>` in Spotify links
|
||||
|
||||
### Fixed
|
||||
- Fixed unused description parameter in playlist creation example
|
||||
|
||||
@ -107,15 +107,19 @@ class Spotify:
|
||||
# numbers and even older ones seemed to have been allowed to freely pick this name.
|
||||
#
|
||||
# [1] https://www.iana.org/assignments/uri-schemes/prov/spotify
|
||||
# [2] https://developer.spotify.com/documentation/web-api/#spotify-uris-and-ids
|
||||
# [2] https://developer.spotify.com/documentation/web-api/concepts/spotify-uris-ids
|
||||
_regex_spotify_uri = r'^spotify:(?:(?P<type>track|artist|album|playlist|show|episode|audiobook):(?P<id>[0-9A-Za-z]+)|user:(?P<username>[0-9A-Za-z]+):playlist:(?P<playlistid>[0-9A-Za-z]+))$' # noqa: E501
|
||||
|
||||
# Spotify URLs are defined at [1]. The assumption is made that they are all
|
||||
# pointing to open.spotify.com, so a regex is used to parse them as well,
|
||||
# instead of a more complex URL parsing function.
|
||||
# Spotify recently added "/intl-<countrycode>" to their links. This change is undocumented.
|
||||
# There is an assumption that the country code uses the ISO 3166-1 alpha-2 standard [2],
|
||||
# but this has not been confirmed yet. Spotipy has no use for this, so it gets ignored.
|
||||
#
|
||||
# [1] https://developer.spotify.com/documentation/web-api/#spotify-uris-and-ids
|
||||
_regex_spotify_url = r'^(http[s]?:\/\/)?open.spotify.com\/(?P<type>track|artist|album|playlist|show|episode|user|audiobook)\/(?P<id>[0-9A-Za-z]+)(\?.*)?$' # noqa: E501
|
||||
# [1] https://developer.spotify.com/documentation/web-api/concepts/spotify-uris-ids
|
||||
# [2] https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2
|
||||
_regex_spotify_url = r'^(http[s]?:\/\/)?open.spotify.com\/(intl-\w\w\/)?(?P<type>track|artist|album|playlist|show|episode|user|audiobook)\/(?P<id>[0-9A-Za-z]+)(\?.*)?$' # noqa: E501
|
||||
|
||||
_regex_base62 = r'^[0-9A-Za-z]+$'
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user