I am making a currency converting script that will scrape all the text from any webpage and will find any foreign currency, convert it using an API and then replace the foreign currency with the new one. My question was, is there any way I can get the text of an element and it's lowest form eg.
<body>
<div>
<div>
<h1>
"Hello, world"
</h1>
</div>
<p>
"How are you today?"
</p>
</div>
<body>
How could I get the h1
and the p
element but not the div
? So my array would be [h1, p]
(keep in mind I'm trying to do this on a much larger scale with hundreds of elements)