2012-07-31 80 views

回答

0

在這裏,你在做驗證的請求,這是錯誤的方式來驗證它。

做你想做的,你可以做這樣的事情(在這裏計算有多少人在搜索中使用您的應用程序)是什麼:

unsigned int nbTweets = 0; 

Timeline tl = twitter.search("foo"); // http://search.twitter.com/search.json?q=foo 

foreach (Tweet t in tl) { 
    // Retrieving the application used to write the tweet in the "source" field of the tweet 
    String tweetHTMLSource = t.source; // tweetHTMLSource == '<a href="clientName.callbackURL" rel="nofollow">clientName</a>' 

    String clientName = tweetHTMLSource.plainText; // clientName == "clientName" 

    if (clientName == "MYAPPLICATION_NAME") { 
     nbTweets++; 
    } 
} 
+0

這是不同的,因爲你正在使用的通用搜索不要求auth和我使用的用戶搜索需要授權 – tipu 2012-07-31 22:49:41

+0

Twitter API中沒有任何端點用於檢索哪些應用程序是由給定用戶授權的。所以在你的情況下,照常執行請求(使用經典的Twitter請求認證)。一旦你獲得了用戶,你可以在他們的時間表中搜索他們是否使用你的應用程序,通過分析每條推文的來源,就像我的小算法一樣。 – 2012-08-01 16:43:39

相關問題