Mike MJ Harris

Instagram Twitter Preview


Edit: Since this post instagram have updated security and the ability for remote servers to scrape data (perfectly reasonably!) so this post is now outdated and doesn't work. It was fun to build but probably needs redoing using the proper API)

I've occasionally wanted to share an Instagram link on twitter and it looks all sad and dull being just a link and no image or description. I built this website which takes a standard Instagram link and provides a link you can share in twitter with a full preview. No logging in or authentication, just a copy, paste, copy, paste.

Sad Instagram share with no preview
Instagram link shared to twitter

Twitter Cards

In a previous post I wrote about how I added the relevant meta data to this blog so that you can see a nice preview image when you share a post on twitter. Check that our for more info on twitter preview data.

Open Graph Tags

Instagram posts have open tag data - this is very similar to twitter cards and means that when you share the post to Facebook or anything that uses the open graph protocol you can see a preview image and description.

Proxy server

To make the open graph data available in the same format as twitter cards I setup a proxy server. When the twitter bot requests the page from my server it gets the meta data including the links to the image on Instagram and the description. When a user clicks on the link on twitter it takes them direct to the Instagram page.

This pic is the same link I've shared in the first pic but via the proxy server. What a lovely preview!
Instagram Share link shared to twitter

How to use it

Go to the Instagram twitter preview site to check it out.

You copy a post from Instagram: click the three dots to the top right of a post and select copy link or if you are on the web open an image and copy the URL. Paste that link in the box, click the button and it converts it to shareable URL. What it does is convert a URL that looks like https://www.instagram.com/p/B_XtJ0cnOM0/ to https://instagram.mikemjharris.com/p/B_XtJ0cnOM0/ (which if you click on the link takes you back to Instagram).


You can take a look at the code here. It's a bit of fun so imagine will break some situations but it works well enough that I can share any public post from Instagram on twitter. I know you can post to both accounts at once but sometimes I want to share a pic from a previous post of from someone else.