Why instagram link onebox like this?

I’m getting this issue as well. Upgrading my installation now to see if it fixes.

@techAPJ can you fix this please? Basically we have to ignore canonical metadata for Instagram now…

6 Likes

Done via:

https://github.com/discourse/onebox/commit/0d88354b4b85c572a7f2431bd01d849392625b5c

Example link:

10 Likes

Looks like we’ve regressed here, or Instagram changed something again. We’re back to just showing “Login • Instagram”. cc @techAPJ

12 Likes

Weird, that image on Instagram doesn’t have any og: meta tags anymore. :grimacing: Couldn’t find any other that would have them missing…

5 Likes

The weird thing is Instagram onebox is working okay for me locally (on latest Discourse version). And I do see OpenGraph (og) tags in incognito mode.

Reproducing this issue locally will be tricky… investigating more.

7 Likes

Is it specific to that one image? :thinking:

3 Likes

No, I tried multiple images from multiple accounts and all were oneboxing fine locally.

Here’s an image from an hour ago on NatGeo oneboxing fine locally.

Might be geographical issue?

FWIW, Instagram oneboxing is failing on discourse.codinghorror.com as well, so this issue is not specific to meta.

5 Likes

Maybe the user agent changes the response?

9 Likes

this is broken on our forum as well

1 Like

I don’t think so. We use same user agent for all the requests made from Discourse codebase as per:

https://github.com/discourse/discourse/blob/edbc3565933819a9ebe4e80d567c35f5dca061a2/lib/final_destination.rb#L70

2 Likes

Same issue on ours now here in the UK too.

I am updating Instagram onebox to use official oEmbed endpoints. I have this change working locally and expect to push a fix later today. Hopefully the Instagram oEmbed endpoints will not have geographical restrictions.

6 Likes

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

Nothing showing on - 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:

1 Like

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

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

3 Likes

Okay, so I updated our custom Instagram onebox engine to use official oEmbed endpoint instead of scraping Instagram page for OpenGraph tags, and it works quite well:

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.

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

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

7 Likes

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 :+1:t2:

3 Likes