1

I'm trying to parse through an awful website and I need some help with using cheerio.

I know that if I for example want to get html of a body of a html I do

 $('body','html').html();

How do I descend through multiple elements?

(What if I want to get html > body > font > table > tbody > tr ?)

!! Have to be careful with all these elements being immediate children, I do not want to catch some other nonimmediate children (for example if table > table existed)

4

1 回答 1

0

你可以这样做:

$('html > body > font > table > tbody > tr').html()

您可以像使用 jQuery 选择器一样选择

于 2017-01-31T09:49:16.830 回答