linvi/tweetinvi

MaxResults / PageSize not working?

DangerfieldUK opened this issue · 0 comments

CLOSED: I was reading totalComments from the original tweet rather than the amount of tweets gathered through the second request. Entirely my idiocy.

I have two near idential SearchV2 requests - however the PageSize param is working for the first, but not the second.

I tried setting the param to 'PageSize = 1' however it errors that 'MaxResults must be between 10 and...'

I'm stumped as to why it's only working for one and not the other where the only difference is the query.

var tweets = await appClient.SearchV2.SearchTweetsAsync(new SearchTweetsV2Parameters($"from:{handle}")
            {
                PageSize = 10,
                Expansions =
                {
                TweetResponseFields.Expansions.AuthorId,
                TweetResponseFields.Expansions.ReferencedTweetsId,
                }
            });

           var postData = new List<Postdata> { };

            foreach (var tweet in tweets.Tweets)
            {
                var replies = await appClient.SearchV2.SearchTweetsAsync(new SearchTweetsV2Parameters($"conversation_id:{tweet.ConversationId}")
                {
                    PageSize = 10,
                    Expansions =
                    {
                        TweetResponseFields.Expansions.AuthorId,
                        TweetResponseFields.Expansions.ReferencedTweetsId,
                    }
                });

I thought that this would get a maximum of 10 tweets, and for each tweet, get a maxium of 10 tweets from the conversation id .. max 110 tweets in total. However I just discovered this doesn't work when KamalaHarris returned 10 tweets with 15000+ replies to the conversation id.