Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

_regex_spotify_url needs update because of region specific path #1071

Closed
Commandcracker opened this issue Jan 14, 2024 · 1 comment · Fixed by #1100
Closed

_regex_spotify_url needs update because of region specific path #1071

Commandcracker opened this issue Jan 14, 2024 · 1 comment · Fixed by #1100
Assignees

Comments

@Commandcracker
Copy link

https://github.com/spotipy-dev/spotipy/blob/a14a28e10c1889cce83eec7a7e1ad4b5944a452d/spotipy/client.py#L121C1-L121C173

The URL has some additions in some regions (for me Germany)
https://open.spotify.com/intl-de/track/2Y0iGXY6m6immVb2ktbseM?si=22cad793e8e248fe
https://open.spotify.com/intl-de/artist/0SwO7SWeDHJijQ3XNS7xEE?si=17xfyfNGROyr18by1fh9sw

The new intl-de will make the regx expression not match anything.

Im not a regx pro but this seames to work:

^(http[s]?:\/\/)?open.spotify.com\/(?P<type>track|artist|album|playlist|show|episode|user|audiobook)\/(?P<id>[0-9A-Za-z]+)(\?.*)?$

⬇️ (added .* after open.spotify.com\/)

^(http[s]?:\/\/)?open.spotify.com\/.*(?P<type>track|artist|album|playlist|show|episode|user|audiobook)\/(?P<id>[0-9A-Za-z]+)(\?.*)?$
@dieser-niko
Copy link
Member

dieser-niko commented May 3, 2024

I think it would be better to add something more distinctive:

Added (intl-\w\w\/)? instead of .*:

^(http[s]?:\/\/)?open.spotify.com\/(intl-\w\w\/)?(?P<type>track|artist|album|playlist|show|episode|user|audiobook)\/(?P<id>[0-9A-Za-z]+)(\?.*)?$

The intl-<countrycode> is still just optional, so this should work with the old format as well. I'll create a pull request sooner or later to implement this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants