/** * Gets a list of a user's playlists on Last.fm. Note that this method only fetches metadata * regarding the user's playlists. If you want to retrieve the list of tracks in a playlist use * {@link Playlist#fetch(String, String) Playlist.fetch()}. * * @param user The last.fm username to fetch the playlists of. * @param apiKey A Last.fm API key. * @return a list of Playlists */ public static Collection<Playlist> getPlaylists(String user, String apiKey) { Result result = Caller.getInstance().call("user.getPlaylists", apiKey, "user", user); if (!result.isSuccessful()) return Collections.emptyList(); Collection<Playlist> playlists = new ArrayList<Playlist>(); for (DomElement element : result.getContentElement().getChildren("playlist")) { playlists.add(Playlist.playlistFromElement(element)); } return playlists; }