-
-
Save brandongalbraith/4cc43619262466cb2296e79bf2bea544 to your computer and use it in GitHub Desktop.
PastePal transform Spotify URL to URI
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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