more logging

This commit is contained in:
Vincent Cloutier 2022-05-07 18:35:35 -04:00
parent f4f28025de
commit fca3193074
2 changed files with 7 additions and 1 deletions

View file

@ -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;

View file

@ -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);