HTML scrapping with pure Javascript

Asked

Viewed 98 times

2

Hi, I have an html that has the following example sequence:

<links class="canais-teste"> CANAL 1 <links/>

There are some 80 excerpts of these, I wanted to only take the contents from within these tags, in this case the "CANAL1", how can I do this with pure javascript?

1 answer

1

var links = document.getElementsByTagName('links');
for (let i = 0 ; i < links.length ; i++){
  console.log(links[i].innerHTML);
}
<links class="canais-teste"> CANAL 1 </links>
<links class="canais-teste"> CANAL 2 </links>
<links class="canais-teste"> CANAL 3 </links>

  • Lucas, in the case of HTML there are several links tags, but with different classes, how do I get the data of the links tag of this specific class and that is within a span tag? <span class="display-name "> <span> Zero Bugs </span> </span>

Browser other questions tagged

You are not signed in. Login or sign up in order to post.