Hello I’m new to the API but I’ve been able to fetch a single status by ID with the REST API like this:
https://api.twitter.com/1.1/statuses/lookup.json?id=770306007222267904&include_entities=true
Which appropriately returns with a media object as I expect, because the tweet includes a gif which was converted to an mp4. extended_entities shows me variants where I can find the source mp4, in this case https://pbs.twimg.com/tweet_video/CrCtK2_VYAAPEEM.mp4
[
{
"created_at": "Mon Aug 29 17:03:58 +0000 2016",
"id": 770306007222267904,
"id_str": "770306007222267904",
"text": "Tell us what you think: https://t.co/F9sc2ZfqVw https://t.co/30DfqetEDl",
"truncated": false,
"entities": {
"hashtags": [],
"symbols": [],
"user_mentions": [],
"urls": [
{
"url": "https://t.co/F9sc2ZfqVw",
"expanded_url": "http://lpc.ca/aoku",
"display_url": "lpc.ca/aoku",
"indices": [
24,
47
]
}
],
"media": [
{
"id": 770305938351808512,
"id_str": "770305938351808512",
"indices": [
48,
71
],
"media_url": "http://pbs.twimg.com/tweet_video_thumb/CrCtK2_VYAAPEEM.jpg",
"media_url_https": "https://pbs.twimg.com/tweet_video_thumb/CrCtK2_VYAAPEEM.jpg",
"url": "https://t.co/30DfqetEDl",
"display_url": "pic.twitter.com/30DfqetEDl",
"expanded_url": "https://twitter.com/liberal_party/status/770306007222267904/photo/1",
"type": "photo",
"sizes": {
"small": {
"w": 340,
"h": 340,
"resize": "fit"
},
"thumb": {
"w": 150,
"h": 150,
"resize": "crop"
},
"medium": {
"w": 600,
"h": 600,
"resize": "fit"
},
"large": {
"w": 1024,
"h": 1024,
"resize": "fit"
}
}
}
]
},
"extended_entities": {
"media": [
{
"id": 770305938351808512,
"id_str": "770305938351808512",
"indices": [
48,
71
],
"media_url": "http://pbs.twimg.com/tweet_video_thumb/CrCtK2_VYAAPEEM.jpg",
"media_url_https": "https://pbs.twimg.com/tweet_video_thumb/CrCtK2_VYAAPEEM.jpg",
"url": "https://t.co/30DfqetEDl",
"display_url": "pic.twitter.com/30DfqetEDl",
"expanded_url": "https://twitter.com/liberal_party/status/770306007222267904/photo/1",
"type": "animated_gif",
"sizes": {
"small": {
"w": 340,
"h": 340,
"resize": "fit"
},
"thumb": {
"w": 150,
"h": 150,
"resize": "crop"
},
"medium": {
"w": 600,
"h": 600,
"resize": "fit"
},
"large": {
"w": 1024,
"h": 1024,
"resize": "fit"
}
},
"video_info": {
"aspect_ratio": [
1,
1
],
"variants": [
{
"bitrate": 0,
"content_type": "video/mp4",
"url": "https://pbs.twimg.com/tweet_video/CrCtK2_VYAAPEEM.mp4"
}
]
}
}
]
},
"source": "<a href=\"http://twitter.com\" rel=\"nofollow\">Twitter Web Client</a>",
"in_reply_to_status_id": null,
"in_reply_to_status_id_str": null,
"in_reply_to_user_id": null,
"in_reply_to_user_id_str": null,
"in_reply_to_screen_name": null,
"user": {
"id": 16397147,
"id_str": "16397147",
"name": "Liberal Party",
"screen_name": "liberal_party",
"location": "Canada",
"description": "Official Twitter account of the Liberal Party of Canada. En français à @parti_liberal",
"url": "http://t.co/tvVUtVDZ0p",
"entities": {
"url": {
"urls": [
{
"url": "http://t.co/tvVUtVDZ0p",
"expanded_url": "http://www.liberal.ca",
"display_url": "liberal.ca",
"indices": [
0,
22
]
}
]
},
"description": {
"urls": []
}
},
"protected": false,
"followers_count": 209193,
"friends_count": 5995,
"listed_count": 1831,
"created_at": "Mon Sep 22 00:29:05 +0000 2008",
"favourites_count": 5989,
"utc_offset": -14400,
"time_zone": "Eastern Time (US & Canada)",
"geo_enabled": false,
"verified": true,
"statuses_count": 18051,
"lang": "en",
"contributors_enabled": false,
"is_translator": false,
"is_translation_enabled": false,
"profile_background_color": "F7EEEE",
"profile_background_image_url": "http://pbs.twimg.com/profile_background_images/496749752042524672/X70BEvDS.png",
"profile_background_image_url_https": "https://pbs.twimg.com/profile_background_images/496749752042524672/X70BEvDS.png",
"profile_background_tile": false,
"profile_image_url": "http://pbs.twimg.com/profile_images/758287602776576000/YvGQfm-z_normal.jpg",
"profile_image_url_https": "https://pbs.twimg.com/profile_images/758287602776576000/YvGQfm-z_normal.jpg",
"profile_banner_url": "https://pbs.twimg.com/profile_banners/16397147/1467463889",
"profile_link_color": "0084B4",
"profile_sidebar_border_color": "FFFFFF",
"profile_sidebar_fill_color": "F1F8F9",
"profile_text_color": "333333",
"profile_use_background_image": false,
"has_extended_profile": false,
"default_profile": false,
"default_profile_image": false,
"following": false,
"follow_request_sent": false,
"notifications": false
},
"geo": null,
"coordinates": null,
"place": null,
"contributors": null,
"is_quote_status": false,
"retweet_count": 20,
"favorite_count": 17,
"favorited": false,
"retweeted": false,
"possibly_sensitive": false,
"lang": "en"
}
]
However, there are some cases where the media entity isn’t returned, such as this one:
https://api.twitter.com/1.1/statuses/lookup.json?id=770650638480879617&include_entities=true
[
{
"created_at": "Tue Aug 30 15:53:24 +0000 2016",
"id": 770650638480879617,
"id_str": "770650638480879617",
"text": "Good news – Canada Student Grants just got bigger. #PromiseKept\nhttps://t.co/CwUH7TaOLK",
"truncated": false,
"entities": {
"hashtags": [
{
"text": "PromiseKept",
"indices": [
51,
63
]
}
],
"symbols": [],
"user_mentions": [],
"urls": [
{
"url": "https://t.co/CwUH7TaOLK",
"expanded_url": "https://amp.twimg.com/v/deb7dff5-6fe8-4070-8674-8b21d14aa9b2",
"display_url": "amp.twimg.com/v/deb7dff5-6fe…",
"indices": [
64,
87
]
}
]
},
"source": "<a href=\"http://twitter.com\" rel=\"nofollow\">Twitter Web Client</a>",
"in_reply_to_status_id": null,
"in_reply_to_status_id_str": null,
"in_reply_to_user_id": null,
"in_reply_to_user_id_str": null,
"in_reply_to_screen_name": null,
"user": {
"id": 16397147,
"id_str": "16397147",
"name": "Liberal Party",
"screen_name": "liberal_party",
"location": "Canada",
"description": "Official Twitter account of the Liberal Party of Canada. En français à @parti_liberal",
"url": "http://t.co/tvVUtVDZ0p",
"entities": {
"url": {
"urls": [
{
"url": "http://t.co/tvVUtVDZ0p",
"expanded_url": "http://www.liberal.ca",
"display_url": "liberal.ca",
"indices": [
0,
22
]
}
]
},
"description": {
"urls": []
}
},
"protected": false,
"followers_count": 209193,
"friends_count": 5995,
"listed_count": 1831,
"created_at": "Mon Sep 22 00:29:05 +0000 2008",
"favourites_count": 5989,
"utc_offset": -14400,
"time_zone": "Eastern Time (US & Canada)",
"geo_enabled": false,
"verified": true,
"statuses_count": 18051,
"lang": "en",
"contributors_enabled": false,
"is_translator": false,
"is_translation_enabled": false,
"profile_background_color": "F7EEEE",
"profile_background_image_url": "http://pbs.twimg.com/profile_background_images/496749752042524672/X70BEvDS.png",
"profile_background_image_url_https": "https://pbs.twimg.com/profile_background_images/496749752042524672/X70BEvDS.png",
"profile_background_tile": false,
"profile_image_url": "http://pbs.twimg.com/profile_images/758287602776576000/YvGQfm-z_normal.jpg",
"profile_image_url_https": "https://pbs.twimg.com/profile_images/758287602776576000/YvGQfm-z_normal.jpg",
"profile_banner_url": "https://pbs.twimg.com/profile_banners/16397147/1467463889",
"profile_link_color": "0084B4",
"profile_sidebar_border_color": "FFFFFF",
"profile_sidebar_fill_color": "F1F8F9",
"profile_text_color": "333333",
"profile_use_background_image": false,
"has_extended_profile": false,
"default_profile": false,
"default_profile_image": false,
"following": false,
"follow_request_sent": false,
"notifications": false
},
"geo": null,
"coordinates": null,
"place": null,
"contributors": null,
"is_quote_status": false,
"retweet_count": 116,
"favorite_count": 226,
"favorited": false,
"retweeted": false,
"possibly_sensitive": false,
"lang": "en"
}
]
In both cases I’d like a direct link to the source content as mp4, but the latter doesn’t include the info or even a media object at all. What am I missing here?