# Why instagram link onebox like this?

**URL:** https://meta.discourse.org/t/why-instagram-link-onebox-like-this/138047
**Category:** Bug
**Created:** [January 8, 2020, 11:42am UTC](https://meta.discourse.org/t/why-instagram-link-onebox-like-this/138047 "2020-01-08T11:42:12Z")
**Posts on this page:** 5
**Page:** 2

<div class="post-metadata">

### Author: ![Richie](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/richie/32/115110_2.png) [@Richie](https://meta.discourse.org/u/Richie)
#### Post date: [May 26, 2020, 10:34am UTC](https://meta.discourse.org/t/why-instagram-link-onebox-like-this/138047/24 "2020-05-26T10:34:51Z")

</div>

This example: `https://www.instagram.com/p/CAoumaVgDXn/`

[https://www.instagram.com/p/CAoumaVgDXn/](https://www.instagram.com/p/CAoumaVgDXn/)

Nothing showing on - [https://opengraphcheck.com/result.php?url=https%3A%2F%2Fwww.instagram.com%2Fp%2FCAoumaVgDXn%2F](https://opengraphcheck.com/result.php?url=https%3A%2F%2Fwww.instagram.com%2Fp%2FCAoumaVgDXn%2F)

Yet viewing the source code of the instagram page in question does actually reveal OG tags:

 ![image](https://global.discourse-cdn.com/meta/original/3X/0/9/099a305b7b43aff1b2c7ba90600cec9d7f883371.png)

---

<div class="post-metadata">

### Author: ![Richie](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/richie/32/115110_2.png) [@Richie](https://meta.discourse.org/u/Richie)
#### Post date: [May 26, 2020, 7:46pm UTC](https://meta.discourse.org/t/why-instagram-link-onebox-like-this/138047/25 "2020-05-26T19:46:21Z")

</div>

> [@techAPJ](#):
>
> Hopefully the Instagram oEmbed endpoints will not have geographical restrictions.

Unrelated, but FYI, we’re still having to rebuild all our posts containing Instagram content every few days as Instagram seem to still be expiring ‘something’. Re [Instagram oneboxing - #58 by Richie](https://meta.discourse.org/t/instagram-oneboxing/69099/58)

I’m guessing this oEmbed change won’t solve this 18 month old issue too will it?

---

<div class="post-metadata">

### Author: ![techAPJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/techapj/32/342990_2.png) [@techAPJ](https://meta.discourse.org/u/techAPJ)
#### Post date: [May 27, 2020, 5:18am UTC](https://meta.discourse.org/t/why-instagram-link-onebox-like-this/138047/26 "2020-05-27T05:18:13Z")

</div>

Okay, so I updated our [custom Instagram onebox engine](https://github.com/discourse/onebox/blob/2347d63d402856c81d5fab48a7a06a4b3fc5c52a/lib/onebox/engine/instagram_onebox.rb) to use official [oEmbed](https://developers.facebook.com/docs/instagram/embedding/) endpoint instead of scraping Instagram page for OpenGraph tags, and it works quite well:

[https://www.instagram.com/p/CAlLWw-lU3S/](https://www.instagram.com/p/CAlLWw-lU3S/)

However, Instagram’s oEmbed data does not indicate what type of media it is, so we regress in two areas:

- we can’t indicate if a link is a video
- we can’t indicate if a link is an album

But the advantage of using official oEmbed endpoint is that it will not break randomly and will be stable longer term.

> [@Richie](#):
>
> we’re still having to rebuild all our posts containing Instagram content every few days as Instagram seem to still be expiring ‘something’.

Yeah, Instagram provides expiring image links (with timestamps) that are supposed to work for a limited time. To mitigate this I am now using these type of link for image url: [https://www.instagram.com/p/CAlLWw-lU3S/media/?size=l](https://www.instagram.com/p/CAlLWw-lU3S/media/?size=l)

The above link redirects to actual image and does not expire so it should theoretically fix the image expiring issue.

---

<div class="post-metadata">

### Author: ![Richie](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/richie/32/115110_2.png) [@Richie](https://meta.discourse.org/u/Richie)
#### Post date: [May 27, 2020, 7:10am UTC](https://meta.discourse.org/t/why-instagram-link-onebox-like-this/138047/27 "2020-05-27T07:10:26Z")

</div>

Considering this is technically an Instagram issue @techAPJ I appreciate the lengths you’ve gone to here to find a resolution.

Great stuff!

Very grateful, thank you 👍🏻

---

<div class="post-metadata">

### Author: ![techAPJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/techapj/32/342990_2.png) [@techAPJ](https://meta.discourse.org/u/techAPJ)
#### Post date: [May 29, 2020, 1:15am UTC](https://meta.discourse.org/t/why-instagram-link-onebox-like-this/138047/28 "2020-05-29T01:15:04Z")

</div>



[Previous page](https://meta.discourse.org/t/why-instagram-link-onebox-like-this/138047.md?page=1)
