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

153
Vistas
Get JSON text from a online server

Ive been working on a site and it has a JS script that runs every 15 seconds which will go to a Github raw text site and get the data off that but I noticed it can be rate-limited.

function sleep(ms) {
    return new Promise(resolve => setTimeout(resolve, ms));
}

async function OnLaunch() {
    var i = 1
    while (i < 10) {
        const url = 'https://github.com/PS5Australia/stocktrackerau/blob/main/stock.json'
        var response = await fetch(url, {
            method: 'GET',
            headers: {
              Accept: 'application/json',
            }
          }
        )
        .then(response => response.text())
        .then(data => {
            var obj = JSON.parse(data);
            if (obj["AmazonDisc"] == "Out of Stock") {
                document.getElementById("amazondisc").innerHTML="Amazon | Out of Stock";
            }
            else if (obj["AmazonDisc"] == "In Stock") {
                document.getElementById("amazondisc").innerHTML="Amazon | In Stock";
            }
        });
        await sleep(15000);
    }
}

I have stock bots that will change the json, so is there another way of updating that json?

I am running on Azure but I can swap to AWS if need be.

Any help is appreciated, Thanks!

about 4 years ago · Juan Pablo Isaza
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