问题描述
我正在制作一个演示应用程序,我希望显示800条针对特定用户的推文.我知道twitter api每次调用只允许200条推文,而我们最多可以获取800条推文.
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 });
通过这种方式,我可以在通话中获得200条推文,但无法获得最大800条推文.
Through this i'm able to get the 200 tweets in a call but not able to get the max 800 tweets.
基本上我想从ListTweetsOnHomeTimeline()方法中获取最多800条推文.
Basically I want to fetch max 800 tweets from ListTweetsOnHomeTimeline() method.
如何获取?
任何帮助将不胜感激
推荐答案
花了一些时间后,我将了解如何获得最大的tweet.像这样:
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 });
从homeTweets获取最后一条推文的ID,并在再次调用ListTweetsonHomeTimeline()方法时将其设置为MaxId.这样,您将获得接下来的200条推文,继续执行同一任务将使您获得最多800条推文.
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.
这篇关于如何从TweetSharp的ListTweetOnHomeTimeline()方法获取最多800条推文?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!