Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

175
Visualizações
How to get Open Graph meta data from Instagram url using nodejs?

Problem:

Similar to other social media sites, I want to show preview of Instagram links in my website. But when I cannot cannot get the meta tags from the webpage as the html shown when the page accessed from the browser is different from that when accessed through axios. I cannot get the Open Graph tags in Instagram pages.

What I have tried

packages used: axios and jssoup
post url used in example below: https://www.instagram.com/p/Cg39m-KjfC8/

const axios = require('axios').default;
var JSSoup = require('jssoup').default

const fetchOgDatafromInsta = async (postid) => {
  // let's consider this url for example
  page = await axios.get(`https://www.instagram.com/p/Cg39m-KjfC8/`, {
    headers: {
      "sec-ch-ua-platform": "Windows",
      "User-Agent":
        "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.5112.81 Safari/537.36",
      "accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8",
      "accept-encoding": "gzip, deflate, br",
      "accept-language": "en-US;q=0.7",
      "sec-fetch-dest": "document",
      "sec-fetch-mode": "navigate",
      "sec-fetch-site": "none",
      "sec-fetch-user": "?1",
      "sec-gpc": 1,
      "upgrade-insecure-requests": 1
    },
  })
  var soup = new JSSoup(page.data, false)
  const allMeta = soup.findAll(('meta'))
  allMeta.forEach(element => {
    console.log(element.attrs);
  });
}

With or without the header the result is same. Tags like <meta property="og:image"/> are absent. enter image description here

Is there any other way to get the meta tag data? Most Social media paltforms can do this!!!

Please help!!!

Any suggestion accepted gratefully. Thanks in advance.

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda