fix lasttweet id in twitter service

This commit is contained in:
Vincent Cloutier 2022-12-28 14:36:16 -05:00
parent 5fafb1f568
commit d72186a3bf
2 changed files with 6 additions and 6 deletions

View file

@ -76,11 +76,6 @@ namespace BirdsiteLive.Twitter
public async Task<ExtractedTweet[]> GetTimelineAsync(string username, int nberTweets, long fromTweetId = -1)
{
if (nberTweets < 5)
nberTweets = 5;
if (nberTweets > 100)
nberTweets = 100;
var client = await _twitterAuthenticationInitializer.MakeHttpClient();
@ -131,6 +126,9 @@ namespace BirdsiteLive.Twitter
{
var extractedTweet = await Extract(tweet);
extractedTweets.Add(extractedTweet);
if (extractedTweet.Id == fromTweetId)
break;
}
catch (Exception e)

View file

@ -27,9 +27,11 @@ namespace BirdsiteLive.ActivityPub.Tests
[TestMethod]
public async Task TimelineKobe()
{
var tweets = await _tweetService.GetTimelineAsync("kobebryant", 100, 100000);
var tweets = await _tweetService.GetTimelineAsync("kobebryant", 100, 1218020971346444288);
Assert.AreEqual(tweets[0].MessageContent, "Continuing to move the game forward @KingJames. Much respect my brother 💪🏾 #33644");
Assert.AreEqual(tweets.Length, 9);
}
}
}