DEV Community

Cover image for Hide Rick Rolls in a Spotify Link
Joe Snell
Joe Snell

Posted on

Hide Rick Rolls in a Spotify Link

Last night, my brother messaged me a spotify link, but when I tapped it, it took me somewhere else entirely.

Screenshot of my brother sending me a weird link

tldr; I made a thing to hide rick rolls in spotify links: https://spotify-rickroll.vercel.app/

After copying the link to a note to see the raw URL, I saw that there was a query string with URL encoded values.

https://open.spotify.com/track/66cuLvkHsW7dNkfNk6gQP9?context=spotify%3Aalbum%3A6DUyohk95eun9LArJtHyF7
Enter fullscreen mode Exit fullscreen mode

The API reference is light on details, but spotify mobile apps appear to resolve whatever spotify URI is passed in the context parameter (the web UI did not behave this way).

After inspecting the URL I realized that the first ID in the URL (66cuLvkHsW7dNkfNk6gQP9) matched A Wolf At the Door by Radiohead and the second ID in the query string (6DUyohk95eun9LArJtHyF7) indeed matched the album Country by Medium Build (a fantastic album you should check out).

After creating some more examples (linking to a search, a podcast, etc.), I discovered that using: spotify:track:<track id> will cause the track to automatically play. The value of this was quickly realized with a certain (infamous) spotify ID 4PTG3Z6ehGkBFwjybzWkR8 (copy paste into a message to try it out):

https://open.spotify.com/track/7pqmuOzAXmnuAXP68LSjD5?context=spotify%3Atrack%3A4PTG3Z6ehGkBFwjybzWkR8
Enter fullscreen mode Exit fullscreen mode

Screenshot of a conversation where my sister got got

After crafting a few more by hand, I threw together a simple website to handle parsing the track IDs and generating a rick roll (or optionally a different target track entirely).

After spending the morning rick rolling everyone I can think of, I have made it public (github):

You can generate your own links here:

https://spotify-rickroll.vercel.app/

Misc. observations:

  • This appears to only work on mobile apps (tested on ios and android)
  • iOS provides the most impact because it automatically renders the preview track whereas Android requires you to tap to display the preview
  • How the spotify app generated one of these links in the first place does appear to be a somewhat difficult to reproduce bug. If anyone from the spotify team would like to get any of the original links with the si values please reach out.

Rick Astley in all his glory

Enjoy ❤️

Top comments (1)

Collapse
 
fatted_calf profile image
jacob

Very fruitful