When I am trying to pull in a twitter post that contains an image or a video via the API from an owned twitter account I do not get the media parameter.
Following is an example.
{
“created_at”: “Sun Jan 08 15:07:06 +0000 2017”,
“id”: 818111797169442800,
“id_str”: “818111797169442817”,
“text”: “Black never goes out of fashion! Channel your inner retro diva with our classic Ebony Black by Casting Créme Gloss… https://t.co/aEHgSUFLl8”,
“truncated”: true,
“entities”: {
“hashtags”: [],
“symbols”: [],
“user_mentions”: [],
“urls”: [
{
“url”: “https://t.co/aEHgSUFLl8”,
“expanded_url”: “https://twitter.com/i/web/status/818111797169442817”,
“display_url”: “twitter.com/i/web/status/8…”,
“indices”: [
116,
139
]
}
]
},
“source”: “Twitter Web Client”,
“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”: {…},
“geo”: null,
“coordinates”: null,
“place”: null,
“contributors”: null,
“is_quote_status”: false,
“retweet_count”: 0,
“favorite_count”: 10,
“favorited”: false,
“retweeted”: false,
“possibly_sensitive”: false,
“possibly_sensitive_appealable”: false,
“lang”: “en”
}
For some posts I do receive the image. Following is an example of a post that I received the media parameter.
{
“created_at”: “Fri Jan 20 14:33:07 +0000 2017”,
“id”: 822451897663524900,
“id_str”: “822451897663524865”,
“text”: “Which one will be the Holiday #ColourOfTheYear? Vote for your favourite now! https://t.co/CndgAlRQCT”,
“truncated”: false,
“entities”: {
“hashtags”: [
{
“text”: “ColourOfTheYear”,
“indices”: [
30,
46
]
}
],
“symbols”: [],
“user_mentions”: [],
“urls”: [],
“media”: [
{
“id”: 822451841241731100,
“id_str”: “822451841241731075”,
“indices”: [
77,
100
],
“media_url”: “http://pbs.twimg.com/media/C2nvl5IUUAM-Jul.jpg”,
“media_url_https”: “https://pbs.twimg.com/media/C2nvl5IUUAM-Jul.jpg”,
“url”: “https://t.co/CndgAlRQCT”,
“display_url”: “pic.twitter.com/CndgAlRQCT”,
“expanded_url”: “https://twitter.com/LOrealParisIn/status/822451897663524865/photo/1”,
“type”: “photo”,
“sizes”: {
“medium”: {
“w”: 660,
“h”: 330,
“resize”: “fit”
},
“small”: {
“w”: 660,
“h”: 330,
“resize”: “fit”
},
“large”: {
“w”: 660,
“h”: 330,
“resize”: “fit”
},
“thumb”: {
“w”: 150,
“h”: 150,
“resize”: “crop”
}
}
}
]
},
“extended_entities”: {
“media”: [
{
“id”: 822451841241731100,
“id_str”: “822451841241731075”,
“indices”: [
77,
100
],
“media_url”: “http://pbs.twimg.com/media/C2nvl5IUUAM-Jul.jpg”,
“media_url_https”: “https://pbs.twimg.com/media/C2nvl5IUUAM-Jul.jpg”,
“url”: “https://t.co/CndgAlRQCT”,
“display_url”: “pic.twitter.com/CndgAlRQCT”,
“expanded_url”: “https://twitter.com/LOrealParisIn/status/822451897663524865/photo/1”,
“type”: “photo”,
“sizes”: {
“medium”: {
“w”: 660,
“h”: 330,
“resize”: “fit”
},
“small”: {
“w”: 660,
“h”: 330,
“resize”: “fit”
},
“large”: {
“w”: 660,
“h”: 330,
“resize”: “fit”
},
“thumb”: {
“w”: 150,
“h”: 150,
“resize”: “crop”
}
}
}
]
},
“source”: “Twitter Web Client”,
“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”: {…},
“geo”: null,
“coordinates”: null,
“place”: null,
“contributors”: null,
“is_quote_status”: false,
“retweet_count”: 18,
“favorite_count”: 22,
“favorited”: false,
“retweeted”: false,
“possibly_sensitive”: false,
“possibly_sensitive_appealable”: false,
“lang”: “en”
}