问题
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