Trying to Scrape an Array

node , cheerio , javascript United States
  • 4 months ago

    I'm trying to scrape the following:

            <td style="font-family:eurof;font-size:14px;padding-top:0px;padding-bottom:5px;"><a style="font-family:eurof;font-size:14px;" href="jewelry">JEWELRY</a>  >  <a style="font-family:eurof;font-size:14px;" href="jewelry/anklet">ANKLET</a>  >  <a style="font-family:eurof;font-size:14px;" href="jewelry/anklet/fashion">FASHION</a>  >  <a style="font-family:eurof;font-size:14px;" href="jewelry/anklet/fashion/"></a>

    I use:

    var categories = [];
    const cheerio = require("cheerio");
    const $ = await cheerio.load(content);

    The results of my console.log are:


    I want to get


  • 4 months ago

    The answer was posted here:

Post a reply

Enter your message below

Sign in or Join us (it's free).


Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Some people, when confronted with a problem, think "I know, I’ll use regular expressions." Now they have two problems.” - Jamie Zawinski