A simple Spotify API wrapper. The wrapper's use is as simple as accessing the Spotify class and using methods from it.
public static void main(String[] args) throws Exception
{
// Assuming you have already defined CLIENT_ID and CLIENT_SECRET
// Create a new Spotify instance
Spotify spotify = new Spotify(CLIENT_ID, CLIENT_SECRET);
// Search by artist with a specified query, result count, and result starting point and store the results in a List.
List<SpotifyArtist> artists = spotify.searchByArtist("pop smoke", 10, 0);
// Pull the first artist found out of the List.
SpotifyArtist first = artists.get(0); // Assuming Pop Smoke is the first result.
// Here is where you would do stuff with the artist.
// For the example, we are just printing the name of the artist.
System.out.println(first.getName());
}Pop Smoke
public static void main(String[] args) throws Exception
{
// Assuming you have already defined CLIENT_ID and CLIENT_SECRET
// Create a new Spotify instance
Spotify spotify = new Spotify(CLIENT_ID, CLIENT_SECRET);
// Get a track using its ID (Spotify URI without the prefixes and such)
SpotifyTrack track = spotify.getTrack("79s5XnCN4TJKTVMSmOx8Ep");
System.out.println(track.getName());
}Dior
Instancing the Spotify class gives you access to all the methods you need to access the rest of the API. If you don't know how to get a client ID and client secret, please go to the Spotify dashboard in order to create an application.
Returns a List with tracks from the search.
Returns a List with albums from the search.
Returns a List with artists from the search.
Returns a List with playlists from the search.
Returns a List with shows from the search.
Returns a List with episodes from the search.
Returns a SpotifyTrack object containing all of the track's information.
Returns a SpotifyAlbum object containing all of the album's information.
Returns a SpotifyArtist object containing all of the artist's information.
Returns a SpotifyPlaylist object containing all of the playlist's information.
Returns a SpotifyUser object containing all of the user's information.
Returns a SpotifyShow object containing all of the show's information.
Returns a SpotifyEpisode object containing all of the episode's information.
Returns the first track given when the query is the name provided.
Returns the first album given when the query is the name provided.
Returns the first artist given when the query is the name provided.
Returns the first playlist given when the query is the name provided.
Returns the first show given when the query is the name provided.
Returns the first episode given when the query is the name provided.
This Spotify wrapper can be implemented two ways:
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories><dependency>
<groupId>com.github.superischroma</groupId>
<artifactId>SpotifyWrapper</artifactId>
<version>-SNAPSHOT</version>
</dependency>Simply add the latest release from the release page to your project's classpath.