Question

I am working with the Java API of lastfm.

I want to extract all users from a group, say Belgium. How do I create a new group and extract their members?

Group mygroup = new Group();
PaginatedResult<de.umass.lastfm.User> users = mygroup.getMembers("Belgium", key);)

It gives me an error on the first line:

group() has private access.

This is a bit strange. How should I call the constructor and don't I have to pass the group name during construction?

Thanks for any insights!

Was it helpful?

Solution

You are correct that the Group has a private constructor, and you cannot use it.

Looking at the source code the method called

 public static PaginatedResult<User> getMembers(String group, int page, String apiKey)

in de.umass.lastfm.Group lets you get all users, and it is static, so you can access it without creating a Group object first.

Do something like

PaginatedResult<de.umass.lastfm.User> users = Group.getMembers("Belgium", key);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top