social-app icon indicating copy to clipboard operation
social-app copied to clipboard

Non-English Spotify URLs will not result in an embedded Spotify player

Open tkusano opened this issue 1 year ago • 1 comments

Bluesky can now embed Spotify players, but non-English version links to Spotify albums and tracks will not work as embeded player.

To Reproduce

Samples URLs are attached.

track

  • https://open.spotify.com/track/4z9llHpqaTFqP4D9zbDUdk (English) -> https://bsky.app/profile/tkusano.jp/post/3khm4zd2gwr25 (embeded player)
  • https://open.spotify.com/intl-ja/track/4z9llHpqaTFqP4D9zbDUdk (Japanese) -> https://bsky.app/profile/tkusano.jp/post/3khm53aikyk25 (link card)

album

  • https://open.spotify.com/album/1kcdtsIVjAG4JNFn1REBCp (English) -> https://bsky.app/profile/tkusano.jp/post/3khm5bvbnlh27 (embeded player)
  • https://open.spotify.com/intl-de/album/1kcdtsIVjAG4JNFn1REBCp (Deutsche) -> https://bsky.app/profile/tkusano.jp/post/3khm5dvxhyk25 (link card)

(If you open a Spotify URL in a language you do not use in your browser, you will be redirected to the Spotify URL in the language you use.)

Cause

In src/lib/strings/embed-player.ts, spotify URL is split by '/' and the second element is treated as type, and expected to be one of 'playlist', 'album' or 'track'.

However, if the second element is in the form of 'intl-LANGCODE', then the third element must be treated as 'type'.

const [_, type, id] = urlp.pathname.split('/')

tkusano avatar Dec 28 '23 12:12 tkusano

Screenshot 2023-12-31 at 2 05 02 AM

Assuming this is correct? Spotify seems to redirect to the non-localized version whenever I try to access it, so I can't actually verify...(doesn't seem the embed takes in the locale either that I can tell)

haileyok avatar Dec 31 '23 10:12 haileyok