Last active
January 3, 2026 15:58
-
-
Save dnnsmnstrr/cab9bbeca50da62f2ac7580ed61f7c0f 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; | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Codelime formatter: