now expends t.co links
This commit is contained in:
parent
f72f025fef
commit
0f46e5ddf7
2 changed files with 19 additions and 0 deletions
|
@ -209,6 +209,16 @@ namespace BirdsiteLive.Twitter
|
||||||
.GetProperty("tweet_results").GetProperty("result").GetProperty("legacy")
|
.GetProperty("tweet_results").GetProperty("result").GetProperty("legacy")
|
||||||
.TryGetProperty("extended_entities", out extendedEntities);
|
.TryGetProperty("extended_entities", out extendedEntities);
|
||||||
|
|
||||||
|
JsonElement.ArrayEnumerator urls = tweet.GetProperty("content").GetProperty("itemContent")
|
||||||
|
.GetProperty("tweet_results").GetProperty("result").GetProperty("legacy")
|
||||||
|
.GetProperty("entities").GetProperty("urls").EnumerateArray();
|
||||||
|
foreach (JsonElement url in urls)
|
||||||
|
{
|
||||||
|
string tco = url.GetProperty("url").GetString();
|
||||||
|
string goodUrl = url.GetProperty("expanded_url").GetString();
|
||||||
|
MessageContent = MessageContent.Replace(tco, goodUrl);
|
||||||
|
}
|
||||||
|
|
||||||
List<ExtractedMedia> Media = new List<ExtractedMedia>();
|
List<ExtractedMedia> Media = new List<ExtractedMedia>();
|
||||||
if (hasMedia)
|
if (hasMedia)
|
||||||
{
|
{
|
||||||
|
|
|
@ -36,7 +36,16 @@ namespace BirdsiteLive.ActivityPub.Tests
|
||||||
{
|
{
|
||||||
var tweet = await _tweetService.GetTweetAsync(1593344577385160704);
|
var tweet = await _tweetService.GetTweetAsync(1593344577385160704);
|
||||||
Assert.AreEqual(tweet.MessageContent, "Speaker Nancy Pelosi will go down as one of most accomplished legislators in American history—breaking barriers, opening doors for others, and working every day to serve the American people. I couldn’t be more grateful for her friendship and leadership.");
|
Assert.AreEqual(tweet.MessageContent, "Speaker Nancy Pelosi will go down as one of most accomplished legislators in American history—breaking barriers, opening doors for others, and working every day to serve the American people. I couldn’t be more grateful for her friendship and leadership.");
|
||||||
|
|
||||||
|
// TODO validate media type and length
|
||||||
|
// TODO test alt-text of images
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[TestMethod]
|
||||||
|
public async Task SimpleTextAndSingleLinkTweet()
|
||||||
|
{
|
||||||
|
var tweet = await _tweetService.GetTweetAsync(1602618920996945922);
|
||||||
|
Assert.AreEqual(tweet.MessageContent, "#Linux 6.2 Expands Support For More #Qualcomm #Snapdragon SoCs, #Apple M1 Pro/Ultra/Max\n\nhttps://www.phoronix.com/news/Linux-6.2-Arm-SoC-Updates");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Add table
Reference in a new issue