linvi/tweetinvi

TweetsV2.GetTweetAsync() does not include media variants

lukaszmn opened this issue · 1 comments

Hi, I noticed that Twitter's API v2 accepts media field variant in parameters (which is missing in https://github.com/linvi/tweetinvi/blob/master/src/Tweetinvi.Core/Public/Parameters/V2/TweetsClientV2/TweetResponseFields.cs#L32) and that after running the following code:

var fields = new HashSet<string>(TweetResponseFields.Media.ALL) {
	"variants"
};
var arg = new GetTweetV2Parameters(tweetId) {
	Expansions = {
		TweetResponseFields.Expansions.AttachmentsMediaKeys,
	},
	MediaFields = fields,
};
var res = twitter.Raw.TweetsV2.GetTweetAsync(arg);

res.Result.Content now includes this field:

{
	"includes": {
		"media": [
			{
				"preview_image_url": "https://pbs.twimg.com/tweet_video_thumb/FcqJBCjagAI27Pe.jpg",
				"variants": [
					{
						"bit_rate": 0,
						"content_type": "video/mp4",
						"url": "https://video.twimg.com/tweet_video/FcqJBCjagAI27Pe.mp4"
					}
				],
				"type": "animated_gif",
				"width": 480,
				"height": 304,
				"media_key": "16_1570218071050321922"
			}
		]
	}
}

It is however not available in the model: res.Result.Model.Includes.Media[0]._Variants_.

Link to API doc: https://developer.twitter.com/en/docs/twitter-api/tweets/lookup/api-reference/get-tweets, search for "variants".

Do you plan on adding this feature?

Hello, please take a look at these, I think you will find out where the problem is.

  1. ExtendedEntities
  2. Old StreamingAPI

The community has long fixed this problem, but the V2 API did not appear at that time, of course, it is not difficult to fix this problem.