expansions - the name of the expansion is dia_keys.tweet.fields - I need to ask for any attachments (the concept here is that videos are attached to Tweets, and so are images, polls, etc).In oder to do this, we need the following combination of fields and expansions: In this case, we want to get the video URLs that are attached. If we request that Tweet via the API, by default only the the basic fields will be returned (for a Tweet, these are text and id). The Tweet ID here is 1557438090897137665 (I got this by taking it from the URL of the Tweet on Twitter, but I could have picked it out from an API query). I'll pick a recent Tweet with an attached video from my own timeline at random: To get the video information, the data we want to return is part of the media object, contained in variants, which is an array of available display formats. These are query parameters that control which elements of data are returned on an API call. Twitter API v2 has many improvements over the legacy version, one of them being the concepts of fields and expansions. If you're into the details, you can always check what functionality is available in the API by grabbing the latest OpenAPI specification document, which lives at - you can look at the Changelog for a more high-level list of updates ![]() This information was added to the data expansions earlier this year, so if you are making a request to the API today, you can now add query parameters to have multiple video variant URLs returned as part of an attached expansion. One data field that was not initially available at launch was the URL for videos attached to Tweets. Twitter API v2 has been available for quite a while now, but it's an evolving process as we bring more endpoints and features to the new environment.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |