12

I have a twitter feed and I can find the instagram url in a tweet.

{
    indices: [
        90,
        110
    ],
    url: "http://t.co/kF9EXifn",
    expanded_url: "http://instagr.am/p/QC8hWKL_4K/",
    display_url: "instagr.am/p/QC8hWKL_4K/"
}

What I need is to take the expanded url from that object "http://instagr.am/p/QC8hWKL_4K/" and get the link to just the image itself, not the image on the Instagram site. Anyone know how to do that? Can I even derive the that link from the url?

earl3s
  • 2,393
  • 1
  • 23
  • 24
  • 1
    You could probably get it by using the Instagram API: http://instagram.com/developer/ – aurbano Oct 01 '12 at 22:33
  • Checkout this part of the API, http://instagram.com/developer/endpoints/media/ Expand the sample response and look for the `image` property – sissonb Oct 01 '12 at 22:39
  • Using the Instagram api would require another (unspecified) amount of service calls. I'm hoping to derive the url to the image from the url I'm provided. – earl3s Oct 01 '12 at 22:40
  • Also I only need the image itself, no meta data. – earl3s Oct 01 '12 at 22:41

1 Answers1

39

You can get just the image by appending /media/ to the URL. Using your example: http://instagr.am/p/QC8hWKL_4K/media/.

You can even specify a size,

One of t (thumbnail), m (medium), l (large). Defaults to m.

So for a thumbnail: http://instagr.am/p/QC8hWKL_4K/media/?size=t

Documentation here.

John C
  • 8,223
  • 2
  • 36
  • 47