This repository has been archived by the owner on Apr 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
cursorsandpaging
Nick Hodge edited this page Sep 20, 2013
·
3 revisions
Twitter API References:
long nextcursor = -1;
var listCount = 0;
do
{
var lists3 = await session.GetMyListsUserIsMemberOf(screen_name: "shiftkey", cursor: nextcursor);
if (lists3.twitterFaulted)
{
// .. report error
break;
}
nextcursor = lists3.next_cursor;
foreach (var lst in lists3.lists)
{
// ... do something with lst
}
} while (nextcursor != 0);
private async void GetSearchTimeLine_Backfill()
{
long smallestid = 0;
long largestid = 0;
int backfillQuota = 200;
int pagingSize = 50;
do
{
var searchtl = await Session.SearchFor(searchtext:_currentSearchText, searchResponseType:SearchResultType.Mixed, count: pagingSize, max_id: smallestid);
if (searchtl.OK)
{
smallestid = long.MaxValue;
if (searchtl.Tweets.Count() < backfillQuota) backfillQuota = searchtl.Tweets.Count();
foreach (var tweet in searchtl.Tweets)
{
_searchtimeline.OnNext(tweet);
if (tweet.Id < smallestid) smallestid = tweet.Id;
if (tweet.Id > largestid) largestid = tweet.Id;
backfillQuota--;
}
}
else
{
break;
}
} while (backfillQuota > 0);
}
This is sample code from TwitterConnectionSearch.cs
In this sample, we are gathering tweets that match a search query.