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

327
Visualizações
javascript - grab title, price and color of product from webpage

What I want: From the below URL, I would like to grab: Title, Was Price, Now Price, all colors aviable

https://www.michaelkors.com/mercer-gallery-medium-logo-tote-bag/_/R-US_30F1GZ5T6B?color=2170

  • Title = Mercer Gallery Medium Logo Tote Bag
  • Was Price = $398.00
  • Now Price = $149.00
  • Color = BRN/SFTPINK, BRN/ACORN

After inspecting URL code, I need to grab data from the following classes product-name, listPrice and salePrice

Error: Access to XMLHttpRequest at 'https://www.michaelkors.com/greenwich-extra-small-studded-patent-leather-crossbody-bag/_/R-US_32F1GGRC5L?color=2711' from origin 'https://localhost:44329' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

What I Tried:

var url = 'https://www.michaelkors.com/mercer-gallery-medium-logo-tote-bag/_/R-US_30F1GZ5T6B?color=2170';

        var TitleClass = 'product-name';



        fetch(url)
            .then(res => res.text())
            .then(text => {
                document.getElementById('DisplayWebCode').innerHTML = text;
                console.log(text);
            })
            .catch(err => console.log(err));
<div id="DisplayWebCode">

    </div>

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

What you're trying to achieve is possible. Just not on browser javascript. You'll need NodeJS.
You can use web scraping technologies to render out web pages and extract the title, price etc. in the backend and serve that in an API and then make a fetch request to that from your frontend. You can use Puppeteer to do the scraping bit. Please check out Puppeteer for more info.

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