Last.fm java API - how to get users from PaginatedResult -


i puzzled lastfm api, more paginatedresult

i read users group in paginatedresult:

paginatedresult<de.umass.lastfm.user> users = group.getmembers("classic rock", key); 

then tried 2 methods display users. there should 25000, 25. first page? how results?

//        (int = 0; < users.gettotalpages();i++){             (user thisuser: users.getpageresults()){                 //for each user                 system.out.print(thisuser.getname() + " - age: " + thisuser.getage() + " - country: " + thisuser.getcountry() + " - "+ thisuser.getgender() + " - is: " + thisuser.getid() + " - playcount: " + thisuser.getplaycount() + " - num playlists: " + thisuser.getnumplaylists() + "\n");             } //        }          (user thisuser: users){             //for each user             system.out.print(thisuser.getname() + " - age: " + thisuser.getage() + " - country: " + thisuser.getcountry() + " - "+ thisuser.getgender() + " - is: " + thisuser.getid() + " - playcount: " + thisuser.getplaycount() + " - num playlists: " + thisuser.getnumplaylists() + "\n");         } 

the getmembers(string group, string apikey) method you're using gets first page in paginated result. need use getmembers(string group, int page, string apikey) overload , call each page want retrieve beyond first page. each result contains information how many pages available.

and don't forget last.fm api usage rules how can make api calls - 1000 calls needed 25000 classic rockers take 1½ hours retrieve (5 seconds between requests).

from documentation;

a paginatedresult returned methods result set might large needs paginated. each paginatedresult contains total number of result pages, current page , collection of entries current page.


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -