I'm trying to scrape the following:
<tr>
<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>
</td>
</tr>
I use:
var categories = [];
const cheerio = require("cheerio");
const $ = await cheerio.load(content);
categories.push($('a[style="font-family:eurof;font-size:14px;"]').text());
console.log(categories);
The results of my console.log are:
[ 'JEWELRYANKLETFASHION' ]
I want to get
[ 'JEWELRY','ANKLET','FASHION' ]
!--removed tag-->
Enter your message below
Sign in or Join us (it's free).