Ich habe den Code in Java geschrieben, der eine Instanz des Wrappers erstellt und die E-Mail und das Passwort des Benutzers für ihr Konto überprüft, aber mit der nicht fortgesetzten Unterstützung für die Java SoundCloud API kann ich keine Möglichkeit finden, einen Benutzer zu finden. Likes von diesem Punkt und ich habe die gesamte Dokumentation und Beispiele nachgeschlagen, aber keine scheint zu funktionieren, wenn sie umgesetzt werden.SoundCloud API Wrapper, wie Sie einen Favoriten in JAVA finden?
PS. Ich habe die Client-ID, das Client-Geheimnis und den Benutzernamen und das Passwort für die Sicherheit geändert, also ignoriere das im Code.
import com.soundcloud.api.ApiWrapper;
import com.soundcloud.api.Token;
import java.io.File;
/**
* Creates an API wrapper instance, obtains an access token and serializes the
* wrapper to disk. The serialized wrapper can then be used for subsequent
* access to resources without re-authenticating
*
* @see GetResource
*/
public final class CreateWrapper {
public static final File WRAPPER_SER = new File("wrapper.ser");
public static void main(String[] args) throws Exception {
final ApiWrapper soundCloud = new ApiWrapper(
"client_id", /*client id*/
"client_secret" /* client_secret */,
null /* redirect URI */,
null /* token */);
Token token;
token = soundCloud.login("[email protected]" /* login */, "password" /* password */);
System.out.println("got token from server: " + token);
// in this example the whole wrapper is serialised to disk -
// in a real application you would just save the tokens and usually have the client_id/client_secret
// hardcoded in the application, as they rarely change
soundCloud.toFile(WRAPPER_SER);
System.out.println("wrapper serialised to " + WRAPPER_SER);
}
}