I created this class for a project I am working on where I need to validate Spotify playlist and track URLs. I hope someone will get some use out of it or maybe improve it. It provides two static methods for validating and allows you to specify the return type which currently is a HTTP or Spotify URL format.
Spotify url validation
I created this class for a project I am working on where I need to validate Spotify playlist and track URLs. I hope someone will get some use out of it or maybe improve it. It provides two static methods for validating and allows you to specify the return type which currently is a HTTP or Spotify URL format.
SpotifyUtil
Here is an example of how to use the method which will convert the link variable below to “spotify:user:user_name:playlist:3WbWswJtOPIdKBQmZs9pGr”:
var link : String = "http://open.spotify.com/user/user_name/playlist/3WbWswJtOPIdKBQmZs9pGr"; var validUrl : String = SpotifyUtil.validatePlaylist( link, SpotifyUtil.URL_FORMAT_SPOTIFY ); if( validUrl ) { trace( link ); }