我正在尝试使用此处的JavaScript Java API:https://github.com/nikkiii/omegle-api-java。但是,以下代码:
package me.nrubin29.pollmegle;
import org.nikki.omegle.Omegle;
import org.nikki.omegle.core.OmegleMode;
import org.nikki.omegle.core.OmegleSession;
import org.nikki.omegle.core.OmegleSpyStranger;
import org.nikki.omegle.event.OmegleEventAdaptor;
import java.util.Map;
public class Pollmegle {
public static void main(String[] args) {
Omegle omegle = new Omegle();
final String question = "Yes or no?";
System.out.println(question);
try {
OmegleSession session = omegle.openSession(OmegleMode.SPY_QUESTION, question, new OmegleEventAdaptor() {
@Override
public void chatWaiting(OmegleSession session) {
System.out.println("Waiting for chat...");
}
@Override
public void chatConnected(OmegleSession session) {
System.out.println("You are now watching two strangers talk about \"" + question + "\"!");
}
@Override
public void spyMessage(OmegleSession session, OmegleSpyStranger stranger, String message) {
System.out.println(stranger + ": " + message);
}
@Override
public void spyDisconnected(OmegleSession session, OmegleSpyStranger stranger) {
System.out.println("Stranger "+stranger+" disconnected, goodbye!");
System.exit(0);
}
@Override
public void question(OmegleSession session, String question) {
System.out.println("Question: "+question);
}
@Override
public void omegleError(OmegleSession session, String string) {
System.out.println("ERROR! " + string);
System.exit(1);
}
@Override
public void recaptchaRequired(OmegleSession session, Map<String, Object> variables) {
System.out.print("Required // ");
for (String var : variables.keySet()) {
System.out.println(var + " // " + variables.get(var));
}
}
@Override
public void recaptchaRejected(OmegleSession session, Map<String, Object> variables) {
System.out.println("Rejected // ");
for (String var : variables.keySet()) {
System.out.println(var + " // " + variables.get(var));
}
}
});
System.out.println("Session " + session.getId() + " created.");
omegle.setEventParseDelay(1000);
omegle.run();
}
catch (Exception e) { e.printStackTrace(); }
}
}
产生这个结果:
是或否?
必需// 6Led7gkAAAAAAEAyh-Kt7HTb_oC0chDvQIZ8VtQb // null
会话中心1:znv479i7a5sh2u60z5sg6s2nzm6jpb已创建。
我做错了什么?我需要通过验证码吗?
答案 0 :(得分:0)
org.nikki.omegle.core.OmegleEvent
并添加了行
,statusInfo,identDigests
到底部,它就像一个魅力。您是否获得了相同的enum not found错误?
答案 1 :(得分:0)
原来问题不在于API,而是我的IP地址被标记了,我每次开始聊天时都需要输入一个reCAPTCHA。它有效。