I am stuck with node-html-parser (https://www.npmjs.com/package/node-html-parser). I read HTML into local variable and I am trying to get to the following node (JS path that is copied from Chrome):
#container > section > div > div.profile__main > div.item.item__profile > div.item__profile__info.cf > div.item__profile__info__data > p
Unfortuantely I get stuck at div.profile__main .
(profile__main is a class within div and the tag looks like <div class="profile__main" ...></div>
How do I query for this stuff. So far I got only here:
var root = this.HTMLParser.parse(this.data)
root.querySelectorAll("#container")
.querySelectorAll("section")
.querySelectorAll("div")
.querySelector("div.profile__main") // Cant get this one. returns null
Thanks
const root = this.HTMLParser.parse(this.data)
const itemProfileInfoData = root.getElementsByTagName("div").find(div => div.attributes.class === "item__profile__info__data")
itemProfileInfoData.childNodes.filter(child => child.tagName === "p")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With