Scrape Trailblazer.me badges and points

54 views Asked by At

Hi I'm looking for a way to scrape badge and point numbers from Trailblazer.

Here is the code I am currently using, based off another stackoverflow post I found.

`

const puppeteer = require("puppeteer");
const cheerio = require("cheerio");

const scrape = async () => {
  const url = "https://trailblazer.me/id/hverma99";

  async function getPage(url) {
    const browser = await puppeteer.launch({ headless: true });
    const page = await browser.newPage();
    await page.goto(url, { waitUntil: "networkidle0" });

    const html = await page.content(); // serialized HTML of page DOM.
    await browser.close();
    return html;
  }

  const html = await getPage(url);
  const $ = cheerio.load(html);
  const span = $(".tds-tally__count.tds-tally__count_success");
  console.log(span.text());
  console.log("hit");
};

scrape();

`

The "hit" console.log does appear in console, but the span.text console.log does not.

Am I missing a step? Did the website update since the post I saw? Any help would be appreciated.

0

There are 0 answers