Answer the question
In order to leave comments, you need to log in
How to parse the first element of a block?
I use cheerio. For example, in the block there is a -> a. I need the first a tag from this block. But for some blocks that are parsed (the same), the structure inside has a slightly different markup, but I still need them ONLY the first tag a.
let $ = cheerio.load(html)
const playersNBA = [];
$('.nba-player-index__row > .nba-player-index__trending-item > a').each((i, link) => {
const playerHref = link.attribs.href
playersNBA.push(playerHref)
})
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question