Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TweetsV2.GetTweetAsync() does not include media variants #1181

Open
lukaszmn opened this issue Sep 15, 2022 · 1 comment
Open

TweetsV2.GetTweetAsync() does not include media variants #1181

lukaszmn opened this issue Sep 15, 2022 · 1 comment

Comments

@lukaszmn
Copy link

lukaszmn commented Sep 15, 2022

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?

@Unreal-System
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants