How to fetch maximum 800 tweets from ListTweetOnHomeTimeline() method of TweetSharp?

╄→гoц情女王★ 提交于 2019-12-10 11:25:17

问题


I'm making a demo app and I want 800 tweets to show of a particular user. I know that twitter api allows only 200 tweets per call and we can get max 800 tweets.

IEnumerable<TwitterStatus> homeTweets = service.ListTweetsOnHomeTimeline(new ListTweetsOnHomeTimelineOptions { Count = 200 });

Through this i'm able to get the 200 tweets in a call but not able to get the max 800 tweets.

Basically I want to fetch max 800 tweets from ListTweetsOnHomeTimeline() method.

How to get it?

Any help will be appreciated


回答1:


After spending some time I'll find out how to get the maximum tweets. like this:

IEnumerable<TwitterStatus> homeTweets = service.ListTweetsOnHomeTimeline(new ListTweetsOnHomeTimelineOptions { Count = 200 });


var tweet2 = service.ListTweetsOnHomeTimeline(new ListTweetsOnHomeTimelineOptions { Count = 200, MaxId = homeTweets.Last().Id });

Get the ID of last tweet from homeTweets and set it to the MaxId when calling the ListTweetsonHomeTimeline() method again. By doing this you will get the next 200 tweets, continuing performing the same task will get you the maximum 800 Tweets.




回答2:


            Twitter_service.ListTweetsOnUserTimeline(new ListTweetsOnUserTimelineOptions { Count = count }, (stat, response) =>
            {

               var a = stat;
               var Tweet_id = stat.Min().Id;
              Twitter_service.ListTweetsOnUserTimeline(new ListTweetsOnUserTimelineOptions { Count = count, MaxId = Tweet_id }, (stat1, response1) =>
                    {
                        if (response.StatusCode == HttpStatusCode.OK)
                        {


来源:https://stackoverflow.com/questions/19031855/how-to-fetch-maximum-800-tweets-from-listtweetonhometimeline-method-of-tweetsh

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!