Reddit Programming
206 subscribers
1.22K photos
123K links
I will send you newest post from subreddit /r/programming
Download Telegram
Difficulties with Last.fm API: No albums found for artist
https://www.reddit.com/r/programming/comments/1gmb2si/difficulties_with_lastfm_api_no_albums_found_for/

<!-- SC_OFF -->I'm working on a music app that uses the Last.fm API to search for information about artists, albums, and songs. I'm having trouble trying to get albums from a specific artist. Logs: I have reviewed the logs and here are the relevant messages: 2024-11-03 18:02:16.531 15537-15537 ArtistAlbumsViewModel com.example.barratrasparente1 E No albums found: ArtistInfoResponse(artist=ArtistInfo(name=Ariana Grande, url=https://www.last.fm/music/Ariana+Grande, albums=null)) 2024-11-03 18:02:16.544 15537-15537 ArtistAlbumsScreen com.example.barratrasparente1 E Error loading albums: No albums found for the artist. Here is a summary of some parts of my code: API interface: kotlin interface LastFmApi { @GET("2.0/") suspend fun getArtistAlbums( @Query("method") method: String = "artist.getinfo", @Query("artist") artist: String, @Query("api_key") apiKey: String = "YOUR_API_KEY", @Query("format") format: String = "json" ): ArtistInfoResponse } ViewModel: kotlin class ArtistAlbumsViewModel : ViewModel() { fun fetchArtistAlbums(artistName: String) { viewModelScope.launch { val response = RetrofitInstance.api.getArtistAlbums(artist = artistName) if (response.artist.albums != null) { // Procesar álbumes } else { // Manejo de error } } } } Function call: Kotlin LaunchedEffect(artistName) { Log.d("ArtistAlbumsScreen", "Llamando a fetchArtistAlbums para el artista: $artistName") viewModel.fetchArtistAlbums(artistName) } <!-- SC_ON --> submitted by /u/Winter_Ice_9209 (https://www.reddit.com/user/Winter_Ice_9209)
[link] (https://github.com/camachomorales/music-player-android.git) [comments] (https://www.reddit.com/r/programming/comments/1gmb2si/difficulties_with_lastfm_api_no_albums_found_for/)