0

タグを使って過去1週間のツイートを検索したい。

たとえば、テキスト ボックスに「Google」と入力すると、誰がツイートしたかに関係なく、過去 7 日以内に投稿された「Google」という単語を含むすべてのツイートが返されます。

過去 1 時間のデータは取得できますが、過去 1 週間のデータを読み取りたいです。ここに私のコードがあります

public static void GetTweet(文字列クエリ)

    {

         DateTime Pre = DateTime.Now.AddDays(-7);

         SearchOptions options = new SearchOptions(){      
                        SinceDate = Pre,
                PageNumber=pageNumber,

           NumberPerPage =100
        };
        TwitterResponse<TwitterSearchResultCollection> searchResult = TwitterSearch.Search(query,options);
        while (searchResult.Result == RequestResult.Success && pageNumber < 10)
        {
            foreach (var tweet in searchResult.ResponseObject)
            {
                Console.WriteLine(tweet.Text, tweet.CreatedDate);

                pageNumber++;
                searchResult = TwitterSearch.Search(query, options);

            }
        }
    }
4

2 に答える 2

0

あなたはこのようなことをすることができます

Dim s As New UserTimelineOptions
s.Count = 3000
s.UseSSL = True
s.APIBaseAddress = "http://api.twitter.com/1/"
s.IncludeRetweets = False
s.UserId = 24769625 'Just a sample account
Dim T As TwitterResponse(Of TwitterStatusCollection) = TwitterTimeline.UserTimeline(tokens, s)
For Each Tweet As TwitterStatus In T.ResponseObject
    Console.WriteLine(Tweet.User.ScreenName & ": " & Tweet.Text)
    'In here just check the created date on the tweet.createddate and look for the time frame
Next
于 2012-07-13T19:35:28.523 に答える
0

Twitter API は、特にそのような大規模なデータセットを照会する場合に、このようなデータを提供するようには設計されていません。各エンドポイントには独自の制限があります。通常、過去 2 週間で 2000 ツイートです。

検索 API を使用すると、最大 1500 のツイートを取得できます (15 ページ @ 1 ページあたり 100)。

于 2012-05-15T21:41:07.727 に答える