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

134
Visualizações
Cheerio cant get info

I am trying to build an API for my homework. API is supposed to get info from HTML tag <a>. I need its href and text. It works for some parts of the website, for some it doesn't.

I gave the correct url, so that is not the problem. Also I can't get an error from terminal, or browser.

I inspected 2 element from 2 sites , first one works second doesn't.

This is the one I can read and get

<a href="/oto-bahce-yapi/goodyear-175-65-r14-82h-eagle-sport-2-yaz-lastigi-uretim-tarihi-7-hafta-2022/" class="name-price" title="Goodyear 175/65 R14 82H Eagle Sport 2 Yaz Lastiği  (Üretim Tarihi: 7.Hafta 2022)" tabindex="0">

and this is the one I cant read

<a href="/market/indo-mie-noodle-paket-jumbo-sebzeli-120-g/" class="name-price" title="Indo Mie Noodle Paket Jumbo Sebzeli 120 g" rel="bookmark">

In return of second one i get an empty array, first one works fine

Part of my code

const urunler = [];

marketler.forEach((market) => {
  axios.get(market.adress).then((response) => {
    const html = response.data;
    const $ = cheerio.load(html);

    $('a[class="name-price"]', html).each(function () {
      const urunadi = $(this).text();
      const url = $(this).attr("href");

      urunler.push({
        urunadi,
        url: market.base + url, //if need a base
        kaynak: market.name,
      });
    });
  });
});

What do you think is the problem or solution?

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