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 );
}
This entry was posted in development and tagged , , . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>