Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

118
Vistas
Node js HTTPS get request for Instagram post information (?__a=1) request returning 301 status code in Vercel

I'm trying to get public post information from Instagram using this - https://instagram.com/p/{id}?__a=1 link in Node.js using https get request.
The problem is that it works in my local server but as soon as I deploy my code in Vercel server-less function the data event inside https get response never gets fired which leaves my data to be empty string.

const getPostInfo = (url) => {
    return new Promise((resolve, reject) => {
        let data = "";
        https
            .get(url, (res) => {
                console.log(res.statusCode); // 301
                res.on("data", (chunk) => {
                    data += chunk.toString();
                });
                res.on("end", () => {
                    console.log(data); // Empty string
                    data = JSON.parse(data); // Parse error
                    resolve(data);
                });
            })
            .on("error", (err) => {
                console.log(err);
                reject(err);
            });
    });
};

I've think the problem is with the instagram link it returns status code 301. I have tried some other get requests from other API's and it seems to be working fine.
I've also tried using Array buffer and also used different libraries like request and node-fetch but no luck.
Please tell me what am I doing wrong.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

I think it's because in my country (INDIA) the '?__a=1' API works but in other country like USA its requires you to login to Instagram and the default Vercel server is located in USA so the data event never gets fired.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda