From fca3193074f2f68ef041fe3668013bd8eccf1bc9 Mon Sep 17 00:00:00 2001 From: Vincent Cloutier Date: Sat, 7 May 2022 18:35:35 -0400 Subject: [PATCH] more logging --- .../Processors/RetrieveTweetsProcessor.cs | 1 + src/BirdsiteLive.Twitter/TwitterTweetsService.cs | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/BirdsiteLive.Pipeline/Processors/RetrieveTweetsProcessor.cs b/src/BirdsiteLive.Pipeline/Processors/RetrieveTweetsProcessor.cs index 58d35d0..6fd2991 100644 --- a/src/BirdsiteLive.Pipeline/Processors/RetrieveTweetsProcessor.cs +++ b/src/BirdsiteLive.Pipeline/Processors/RetrieveTweetsProcessor.cs @@ -40,6 +40,7 @@ namespace BirdsiteLive.Pipeline.Processors { var user = userWtData.User; var tweets = RetrieveNewTweets(user); + _logger.LogInformation("Got " + tweets.Length + " tweets from user " + user.Acct); if (tweets.Length > 0 && user.LastTweetPostedId != -1) { userWtData.Tweets = tweets; diff --git a/src/BirdsiteLive.Twitter/TwitterTweetsService.cs b/src/BirdsiteLive.Twitter/TwitterTweetsService.cs index 43d759d..31d3965 100644 --- a/src/BirdsiteLive.Twitter/TwitterTweetsService.cs +++ b/src/BirdsiteLive.Twitter/TwitterTweetsService.cs @@ -83,10 +83,15 @@ namespace BirdsiteLive.Twitter var user = _twitterUserService.GetUser(username); if (user == null || user.Protected) return new ExtractedTweet[0]; + var reqURL = "https://api.twitter.com/2/users/" + + user.Id + + "/tweets?expansions=in_reply_to_user_id,attachments.media_keys,entities.mentions.username,referenced_tweets.id.author_id&tweet.fields=id" + + "&max_results=5" + + "" ; // ?since_id=2324234234 JsonDocument tweets; try { - using (var request = new HttpRequestMessage(new HttpMethod("GET"), "https://api.twitter.com/2/users/" + user.Id + "/tweets?expansions=in_reply_to_user_id,attachments.media_keys,entities.mentions.username,referenced_tweets.id.author_id&tweet.fields=id")) + using (var request = new HttpRequestMessage(new HttpMethod("GET"), reqURL)) { request.Headers.TryAddWithoutValidation("Authorization", "Bearer " + _twitterAuthenticationInitializer.Token);