Multiple pics in a tweet - not a bug after all

api

#1

For tweets with multiple images, like https://twitter.com/JConversocial/status/735452277138395136 , api returns only the first media item rather than all of them.


#2

Which API?

I just ran this Tweet via statuses/lookup and the returned Tweet object contains all of the image attachments.

There is a limitation that the Search API does not support multiple media objects, but you can still retrieve them via other endpoints.


#3

Sorry, wasn’t very specific.

When using REST API on the following endpoint:

https://api.twitter.com/1.1/statuses/show/735452277138395136.json

I get in return:

{
  "created_at": "Wed May 25 12:47:41 +0000 2016",
  "id": 735452277138395100,
  "id_str": "735452277138395136",
  "text": "@noredsheep here are pics https://t.co/Jc0cSAg5ft",
  "truncated": false,
  "entities":  {
    "hashtags":  [],
    "symbols":  [],
    "user_mentions":  [
       {
        "screen_name": "noredsheep",
        "name": "No Red Sheep",
        "id": 248737603,
        "id_str": "248737603",
        "indices":  [
          0,
          11
        ]
      }
    ],
    "urls":  [],
    "media":  [
       {
        "id": 735452255592321000,
        "id_str": "735452255592321026",
        "indices":  [
          26,
          49
        ],
        "media_url": "http://pbs.twimg.com/media/CjTZ7gvXEAIBD0j.jpg",
        "media_url_https": "https://pbs.twimg.com/media/CjTZ7gvXEAIBD0j.jpg",
        "url": "https://t.co/Jc0cSAg5ft",
        "display_url": "pic.twitter.com/Jc0cSAg5ft",
        "expanded_url": "http://twitter.com/JConversocial/status/735452277138395136/photo/1",
        "type": "photo",
        "sizes":  {
          "small":  {
            "w": 340,
            "h": 211,
            "resize": "fit"
          },
          "medium":  {
            "w": 600,
            "h": 372,
            "resize": "fit"
          },
          "large":  {
            "w": 606,
            "h": 376,
            "resize": "fit"
          },
          "thumb":  {
            "w": 150,
            "h": 150,
            "resize": "crop"
          }
        }
      }
    ]
  },
  "extended_entities":  {
    "media":  [
       {
        "id": 735452255592321000,
        "id_str": "735452255592321026",
        "indices":  [
          26,
          49
        ],
        "media_url": "http://pbs.twimg.com/media/CjTZ7gvXEAIBD0j.jpg",
        "media_url_https": "https://pbs.twimg.com/media/CjTZ7gvXEAIBD0j.jpg",
        "url": "https://t.co/Jc0cSAg5ft",
        "display_url": "pic.twitter.com/Jc0cSAg5ft",
        "expanded_url": "http://twitter.com/JConversocial/status/735452277138395136/photo/1",
        "type": "photo",
        "sizes":  {
          "small":  {
            "w": 340,
            "h": 211,
            "resize": "fit"
          },
          "medium":  {
            "w": 600,
            "h": 372,
            "resize": "fit"
          },
          "large":  {
            "w": 606,
            "h": 376,
            "resize": "fit"
          },
          "thumb":  {
            "w": 150,
            "h": 150,
            "resize": "crop"
          }
        }
      },
       {
        "id": 735452275955650600,
        "id_str": "735452275955650560",
        "indices":  [
          26,
          49
        ],
        "media_url": "http://pbs.twimg.com/media/CjTZ8smW0AATq6x.jpg",
        "media_url_https": "https://pbs.twimg.com/media/CjTZ8smW0AATq6x.jpg",
        "url": "https://t.co/Jc0cSAg5ft",
        "display_url": "pic.twitter.com/Jc0cSAg5ft",
        "expanded_url": "http://twitter.com/JConversocial/status/735452277138395136/photo/1",
        "type": "photo",
        "sizes":  {
          "large":  {
            "w": 1024,
            "h": 576,
            "resize": "fit"
          },
          "small":  {
            "w": 340,
            "h": 191,
            "resize": "fit"
          },
          "medium":  {
            "w": 600,
            "h": 338,
            "resize": "fit"
          },
          "thumb":  {
            "w": 150,
            "h": 150,
            "resize": "crop"
          }
        }
      }
    ]
  },
  "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": 248737603,
  "in_reply_to_user_id_str": "248737603",
  "in_reply_to_screen_name": "noredsheep",
  "user":  {
    "id": 2809963811,
    "id_str": "2809963811",
    "name": "Jamie Conversocial",
    "screen_name": "JConversocial",
    "location": "",
    "description": "",
    "url": null,
    "entities":  {
      "description":  {
        "urls":  []
      }
    },
    "protected": false,
    "followers_count": 10,
    "friends_count": 7,
    "listed_count": 0,
    "created_at": "Mon Oct 06 10:21:42 +0000 2014",
    "favourites_count": 1,
    "utc_offset": null,
    "time_zone": null,
    "geo_enabled": false,
    "verified": false,
    "statuses_count": 421,
    "lang": "en-gb",
    "contributors_enabled": false,
    "is_translator": false,
    "is_translation_enabled": false,
    "profile_background_color": "C0DEED",
    "profile_background_image_url": "http://abs.twimg.com/images/themes/theme1/bg.png",
    "profile_background_image_url_https": "https://abs.twimg.com/images/themes/theme1/bg.png",
    "profile_background_tile": false,
    "profile_image_url": "http://abs.twimg.com/sticky/default_profile_images/default_profile_4_normal.png",
    "profile_image_url_https": "https://abs.twimg.com/sticky/default_profile_images/default_profile_4_normal.png",
    "profile_link_color": "0084B4",
    "profile_sidebar_border_color": "C0DEED",
    "profile_sidebar_fill_color": "DDEEF6",
    "profile_text_color": "333333",
    "profile_use_background_image": true,
    "has_extended_profile": false,
    "default_profile": true,
    "default_profile_image": true,
    "following": false,
    "follow_request_sent": false,
    "notifications": false
  },
  "geo": null,
  "coordinates": null,
  "place": null,
  "contributors": null,
  "is_quote_status": false,
  "retweet_count": 0,
  "favorite_count": 0,
  "favorited": false,
  "retweeted": false,
  "possibly_sensitive": false,
  "possibly_sensitive_appealable": false,
  "lang": "en"
}

which only has one entry in media section.


#4

For multiple media image Tweets, you need to look at the extended_entities section of the Tweet object.


#5

Ah, ok, thanks.


#6