Home > Blockchain >  Getting scraped href linked with our website
Getting scraped href linked with our website

Time:04-20

I am trying to scrap thorough this anchor tag <a href="/user/all?tag=114"> </a> But I am getting the result as mywebsite.com/user/all?tag=114 any way to avoid it and only get what's on anchor tag no need of linking the href link with my website, Any help would be appreciated thanks in advance.

CodePudding user response:

Here are two ways to get the href attribute value:

const anchor = document.querySelector('a');
const {href} = anchor;
const hrefRaw = anchor.getAttribute('href');

console.log({href, hrefRaw});
<a href="/user/all?tag=114">link</a>

  • Related