Last active
February 6, 2025 09:53
-
-
Save TheBlapse/494e229bfc92c571f8909c4cd3790f66 to your computer and use it in GitHub Desktop.
CopyQ script to Convert Spotify Links to Song.link, Album.link
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
| copyq: | |
| var clipboardContent = str(clipboard()) | |
| var spotifyTrackPattern = /^https:\/\/open\.spotify\.com\/track\/([a-zA-Z0-9]+)(\?.*)?$/ | |
| var spotifyAlbumPattern = /^https:\/\/open\.spotify\.com\/album\/([a-zA-Z0-9]+)(\?.*)?$/ | |
| if (spotifyTrackPattern.test(clipboardContent)) { | |
| var trackId = clipboardContent.match(spotifyTrackPattern)[1] | |
| var newUrl = 'https://song.link/s/' + trackId | |
| copy(newUrl) | |
| } else if (spotifyAlbumPattern.test(clipboardContent)) { | |
| var albumId = clipboardContent.match(spotifyAlbumPattern)[1] | |
| var newUrl = 'https://album.link/s/' + albumId | |
| copy(newUrl) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment