I do not know if the title got clarified but I would like to know how to go through the body of an html page and identify links by exceptions ... Let's say I want only links that have link in your url.
I do not know if the title got clarified but I would like to know how to go through the body of an html page and identify links by exceptions ... Let's say I want only links that have link in your url.
See if this example using jQuery answers you. Gets all links that have (href) the string " link ". With the links object you can do what you need. In the example below, I put it to display in a div.
function ObterLinks()
{
var links = $('a[href*="https://site.com/imagens/"]'); //obtém todos os links que contenham o endereço.
var divResultado = $('#divResultado');
for(var i = 0; i < links.length; i++)
{
divResultado.append('<p>' + links[i].href + '</p>');
}
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script><divid="links">
<a href="https://site.com/imagens/1.jpg"> Link 1 </a>
<br>
<a href="https://site.com/imagens/2.jpg"> Link 2 </a>
<br>
<a href="https://site.com/imagens/3.jpg"> Link 3 </a>
<br>
<a href="https://site.com/imagens/4.jpg"> Link 4 </a>
</div>
<br>
<button onclick="ObterLinks()">Obter Links </button>
<div id="divResultado">
</div>