6

特別なページにいくつかのつぶやきのリストを表示したいので、私は Twitter API を試してきました。

これらのリストの中には、特定のハッシュタグ (例: #test )を含むすべてのツイートのリストがあります。

ただし、そのリストを XML または JSON (できれば後者) で取得する方法が見つかりません。方法を知っている人はいますか? それもTweetSharpで出来れば良い

4

5 に答える 5

9

URL エンコードされた JSON にhttp://search.twitter.com/search.json?q=%23test含まれるツイートのリストを取得するためにフェッチするだけです。#test%23test#test

私は TweetSharp に詳しくありませんが、を検索し、結果のツイートを自分で JSON に変換するためにsearch使用できるコマンドがあるに違いないと思います。#test

于 2011-03-13T17:01:46.927 に答える
0

私は同じ問題に苦労しました。これが私の漠然とした解決策です。プログラミングを楽しみましょう。必要な数のつぶやきを取得/フェッチするたびに、関数から抜け出します。

        string maxid = "1000000000000"; // dummy value
        int tweetcount = 0;


        if (maxid != null)
        {
            var tweets_search = twitterService.Search(new SearchOptions { Q = keyword, Count = Convert.ToInt32(count) });
            List<TwitterStatus> resultList = new List<TwitterStatus>(tweets_search.Statuses);
            maxid = resultList.Last().IdStr;
            foreach (var tweet in tweets_search.Statuses)
            {
                try
                {
                    ResultSearch.Add(new KeyValuePair<String, String>(tweet.Id.ToString(), tweet.Text));
                    tweetcount++;
                }
                catch { }
            }

            while (maxid != null && tweetcount < Convert.ToInt32(count))
            {
                maxid = resultList.Last().IdStr;
                tweets_search = twitterService.Search(new SearchOptions { Q = keyword, Count = Convert.ToInt32(count), MaxId = Convert.ToInt64(maxid) });
                resultList = new List<TwitterStatus>(tweets_search.Statuses);
                foreach (var tweet in tweets_search.Statuses)
                {
                    try
                    {
                        ResultSearch.Add(new KeyValuePair<String, String>(tweet.Id.ToString(), tweet.Text));
                        tweetcount++;
                    }
                    catch { }
                }

}

于 2015-07-11T10:50:45.210 に答える
0

ツイート検索用のこのURLでアクセスしてください。ただし、OAuth プロトコルを使用する必要があります。

https://api.twitter.com/1.1/search/tweets.json?q=%40twitterapi

于 2015-05-25T12:07:13.673 に答える