Skip to content

Instantly share code, notes, and snippets.

@brandongalbraith
Forked from dnnsmnstrr/spotifyUri.js
Created January 2, 2026 19:12
Show Gist options
  • Select an option

  • Save brandongalbraith/4cc43619262466cb2296e79bf2bea544 to your computer and use it in GitHub Desktop.

Select an option

Save brandongalbraith/4cc43619262466cb2296e79bf2bea544 to your computer and use it in GitHub Desktop.
PastePal transform Spotify URL to URI
function transform(clip) {
const pathRegex = /^[a-z]+:\/\/[^:\/]+(:[0-9]+)?\/(.*?)(\/[0-9]+)?(\?.*)?$/
const uriPath = clip.text.replace(pathRegex, '$2');
const spotifyUri = "spotify:" + uriPath.replaceAll('/', ':')
return spotifyUri;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment