initial QT support

This commit is contained in:
Vincent Cloutier 2023-01-13 10:36:38 -05:00
parent 7a840d83b2
commit b5777d656e
2 changed files with 21 additions and 0 deletions

View file

@ -270,6 +270,19 @@ namespace BirdsiteLive.Twitter
MessageContent = MessageContent.Replace(media.GetProperty("url").GetString(), "");
}
}
bool isQuoteTweet = tweet.GetProperty("content").GetProperty("itemContent")
.GetProperty("tweet_results").GetProperty("result").GetProperty("legacy")
.GetProperty("is_quote_status").GetBoolean();
if (isQuoteTweet)
{
string quoteTweetLink = tweet.GetProperty("content").GetProperty("itemContent")
.GetProperty("tweet_results").GetProperty("result").GetProperty("legacy")
.GetProperty("quoted_status_permalink").GetProperty("expanded").GetString();
MessageContent = MessageContent + "\n" + quoteTweetLink;
}
var extractedTweet = new ExtractedTweet
{
Id = Int64.Parse(tweet.GetProperty("sortIndex").GetString()),

View file

@ -75,5 +75,13 @@ namespace BirdsiteLive.ActivityPub.Tests
Assert.AreEqual(tweet.Media[0].MediaType, "image/gif");
Assert.IsTrue(tweet.Media[0].Url.StartsWith("https://video.twimg.com/"));
}
[TestMethod]
public async Task SimpleQT()
{
var tweet = await _tweetService.GetTweetAsync(1610807139089383427);
Assert.AreEqual(tweet.MessageContent, "When you gave them your keys you gave them your coins.\nhttps://twitter.com/kadhim/status/1610706613207285773");
}
}
}