2013-08-30 96 views
0

我正在嘗試使用此處找到的Omegle Java API:https://github.com/nikkiii/omegle-api-java。但是,下面的代碼:Java API不起作用

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 //空

會議central1:znv479i7a5sh2u60z5sg6s2nzm6jpb創建。

我在做什麼錯?我需要通過驗證碼嗎?

+0

你可能會更好地提出一個關於github項目的問題:https://github.com/nikkiii/omegle-api-java/issues – Catchwa

+0

該項目在9個月內沒有被觸及,但我想我可以提交問題。 – nrubin29

回答

0

原來問題不是API,而是我的IP地址被標記,每次開始聊天時都需要輸入reCAPTCHA。有用。

0

不,它應該輸出這個。但是,當我跑的代碼我一直得到「不枚舉發現錯誤」於是我走進org.nikki.omegle.core.OmegleEvent,並添加了線

,statusInfo,identDigests 

的底部和它的工作就像一個魅力。你是否得到相同的枚舉未找到錯誤?

+0

我之前做過,但後來我添加了'statusInfo',我沒有再有任何錯誤。我剛剛添加了'identDigests',但沒有幫助。 – nrubin29

+0

@ pogostick29你得到一個異常? –