Open Graph meta tags are inconsistently missing from instagram post's link response
Asked Answered
M

1

7

I am putting link previews in my web app. I'm using nodejs in backend to retrieve og properties (like site_name, description, image, title, etc). Links of YouTube and other stuffs works fine but with Instagram's link, the Open Graph meta tags are missing inconsistently in the response body of the link.

For Example, consider this link: https://www.instagram.com/p/B_hs0pUlRvR/

when I request body of this link in my script running in my local machine, it does consists of the og meta tags. The og: meta tags are present

But when I put the same script in cloud, and perform the same request those meta tags goes missing. Missing og: meta tags

I tried to view the source code of the link in my mobile phone, such kind of strange behavior continues there as well.

no og tags when source code is viewed in normal mode no og tags when source code is viewed in normal mode

og: meta tags are present when source code is viewed in Incognito mode og: meta tags are present when source code is viewed in Incognito mode

I have tried to change user-agent in the request but that didn't helped. What's the reason behind this and how can I get link preview of Instagram post's links succesfully.

Melchor answered 12/6, 2020 at 16:27 Comment(3)
Do you have something new for this issue?Epigram
@FranGarcía I was unable to find anything and as this was a personal project, I left as it is. I found that WhatsApp successfully retrieves these meta infos for all the insta links. I tried to sniff whatsapp traffic, but was unable to do it properly, if someone can do that and check the format of request sent by whatsapp, then we may get something for this.Melchor
Thanks for the reply Shaikh. I guess WhatsApp can access because it is also own by FB and they have a gateway to do it.Epigram
G
1

This set of headers seems solves the problem.

Sec-Fetch-Dest: document
Sec-Fetch-Mode: navigate
Sec-Fetch-Site: same-origin
Sec-Fetch-User: ?1
Guimpe answered 15/6, 2023 at 9:53 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.