fix for gifs
This commit is contained in:
parent
83842f5874
commit
7a840d83b2
2 changed files with 15 additions and 4 deletions
|
@ -241,9 +241,9 @@ namespace BirdsiteLive.Twitter
|
||||||
{
|
{
|
||||||
var type = media.GetProperty("type").GetString();
|
var type = media.GetProperty("type").GetString();
|
||||||
string url = "";
|
string url = "";
|
||||||
if (type == "video")
|
if (type == "video" || type == "animated_gif")
|
||||||
{
|
{
|
||||||
var bitrate = 0;
|
var bitrate = -1;
|
||||||
foreach (JsonElement v in media.GetProperty("video_info").GetProperty("variants").EnumerateArray())
|
foreach (JsonElement v in media.GetProperty("video_info").GetProperty("variants").EnumerateArray())
|
||||||
{
|
{
|
||||||
if (v.GetProperty("content_type").GetString() != "video/mp4")
|
if (v.GetProperty("content_type").GetString() != "video/mp4")
|
||||||
|
|
|
@ -42,7 +42,7 @@ 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
|
Assert.AreEqual(tweet.Media[0].MediaType, "image/jpeg");
|
||||||
Assert.AreEqual(tweet.Media.Length, 1);
|
Assert.AreEqual(tweet.Media.Length, 1);
|
||||||
// TODO test alt-text of images
|
// TODO test alt-text of images
|
||||||
}
|
}
|
||||||
|
@ -64,5 +64,16 @@ namespace BirdsiteLive.ActivityPub.Tests
|
||||||
Assert.AreEqual(tweet.Media[0].MediaType, "video/mp4");
|
Assert.AreEqual(tweet.Media[0].MediaType, "video/mp4");
|
||||||
Assert.IsTrue(tweet.Media[0].Url.StartsWith("https://video.twimg.com/"));
|
Assert.IsTrue(tweet.Media[0].Url.StartsWith("https://video.twimg.com/"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[TestMethod]
|
||||||
|
public async Task GifAndQT()
|
||||||
|
{
|
||||||
|
var tweet = await _tweetService.GetTweetAsync(1612901861874343936);
|
||||||
|
// TODO test QT
|
||||||
|
|
||||||
|
Assert.AreEqual(tweet.Media.Length, 1);
|
||||||
|
Assert.AreEqual(tweet.Media[0].MediaType, "image/gif");
|
||||||
|
Assert.IsTrue(tweet.Media[0].Url.StartsWith("https://video.twimg.com/"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue