raspando da Amazon usando marionetistas

const puppeteer = require("puppeteer");

const scrape = async (url) => {
  let browser, page;

  try {
    console.log('opening browser');
    browser = await puppeteer.launch();
    page = await browser.newPage();
    await page.goto(url, { waitUntil: 'domcontentloaded', timeout: 60000 });

    await page.waitForSelector('#priceblock_ourprice', { visible: true });

    const data = await page.evaluate(() => {
      return [
        JSON.stringify(document.getElementById('priceblock_ourprice').innerText)
      ];
    });

    const [price] = [ JSON.parse(data[0]) ];

    console.log({ price });
    return { price };

  } catch (error) {
    console.log('scrape error', error.message);
  } finally {
    if (browser) {
      await browser.close();
      console.log('closing browser');
    }
  }
}

scrape('https://www.amazon.com/Razer-DeathAdder-Chroma-Multi-Color-Comfortable/dp/B00MYTSDU4/ref=sr_1_2?dchild=1&keywords=Deathadder%2BChroma&qid=1625425444&sr=8-2&th=1');
Rizz