Cursor Queries and API Limit

Mar 18, 2014 at 1:11 PM
Hi Linvi,

I see that tweetinvi automatically handles the cursor parameter. However, if I want to do something like this:
var users = User.GetFollowerIds("screenname", 100000);
Then it will only return the first 75000 ids as it hits the api limit with that number. I was wondering if there's any way to go past 75000?

I dont know if there's a way to already do that but I have an idea.

Maybe if you allow us to pass a cursorId parameter into functions that use cursor queries, we can extract the cursor id from last exception's URL and use it to continue the app after suitably waiting for the rate limit to reset.

Thank you for your time.
Mar 18, 2014 at 3:27 PM

I currently do not provide such feature because I want the api to be simple to use and not have 5 optional parameters.
This feature will be implemented in later versions but in the meantime I invite you to read the 2 responses of this post :

Mar 18, 2014 at 8:36 PM
Edited Mar 19, 2014 at 11:34 AM
Thanks for the link. :)

I came up with the following solution.
var screenName = "ladygaga";
int maxObjectsToRetrieve = 1000000;
var followerQuery = String.Format("{0}&count=5000", screenName);
List<long> scrapedIds = new List<long>();
long cursor = -1;
    var result = TwitterAccessor.ExecuteCursorGETQuery<IIdsCursorQueryResultDTO>(followerQuery, maxObjectsToRetrieve, cursor);
    if (result != null)
        var ids = result.SelectMany(x => x.Ids);
        cursor = result.Select(x => x.NextCursor).LastOrDefault();

    var timeToWait = RateLimit.GetCurrentCredentialsRateLimits().FollowersIdsLimit.ResetDateTime - DateTime.Now;
    Debug.WriteLine("waiting for {0}...", timeToWait);
} while (scrapedIds.Count < maxObjectsToRetrieve && cursor != 0);
Console.WriteLine("{0} ids found.", scrapeIds.Count);
Marked as answer by linvi on 3/18/2014 at 1:22 PM