To offer a uniform experience across Streaming and REST APIs we will be adding information about attached animated GIFs to the payloads of both. The change is scheduled to be deployed in early February on February 2nd.
Below are some examples of the differences in old and new payloads in JSON format, and what it will look like. Key things to notice in the change are:
-
Instead of url entity in “entities”, now the transcoded GIF (MP4) appears in entities and extended_entities as a media entity
-
For backwards-compatibility, the media type is still photo in “entities”, but gets a new type “animated_gif” in extended_entities
-
There is a new video_info object in extended_entities for GIF (MP4) payloads that contains the aspect ratio and the variants available
OLD:
"entities": {
...
"urls": [
{
"url": "gif1Url",
"expanded_url": "http://twitter.com/username/status/tweetid/photo/1",
"display_url": "testDisplayUrl",
"indices": [
1,
10
]
}
],
(media field isn't present)
}
NEW:
"entities": {
"hashtags": [],
"trends": [],
"urls": [], // <-- note this is empty
"user_mentions": [],
"symbols": [],
"media": [
{
"id": 100,
"id_str": "100",
"indices": [
1,
10
],
"media_url": "http://media.url.here",
"media_url_https": "https://media.url.here",
"url": "gif1Url",
"display_url": "testDisplayUrl",
"expanded_url": "http://twitter.com/username/status/tweetid/photo/1",
"type": "photo",
"sizes": {}
}
]
},
"extended_entities": {
"media": [
{
"id": 100,
"id_str": "100",
"indices": [
11,
10
],
"media_url": "http://media.url.here",
"media_url_https": "media.url.here",
"url": "gif1Url",
"display_url": "testDisplayUrl",
"expanded_url": "http://twitter.com/username/status/tweetid/photo/1",
"type": "animated_gif",
"sizes": {},
"video_info": {
"aspect_ratio": [
114,
131
],
"variants": [
{
"bitrate": 123,
"content_type": "video/mp4",
"url": "variantUrl1"
},
{
"bitrate": 456,
"content_type": "video/mp4",
"url": "variantUrl2"
}
]
}
}
]
}