0

I am trying to scrape website data and I can look for a tags that I want to explore.

However, this tags are like <a title="Annex" href="https://www.myite.com/d…-3.pdf?sfvrsn=b3a84558_2" sfref="[documents|librariesProv…-4ef8-8b90-ae20b6b7590d">

getting a.href just returns https://www.myite.com/d…-3.pdf?sfvrsn=b3a84558_2 and that results in 404 page.

However, when I click on the tag on web page it opens pdf - the url is slightly modified.

How to handle these types of links in javascript. I am using js fetch similar to this post.

Thanks in advance.

Mayank Kumar Chaudhari
  • 16,027
  • 10
  • 55
  • 122

1 Answers1

0

sfref is an attribute that is used to resolve dynamic links. For example, when the a tag is cliked, the sfref attribute value is used to build href on the fly.

I assume you do not have the access to the logic used for link resolution. The best thing you can do here is to tuse Chrome Dev Tools -> Event Listeners and find out the event where the link resolution happens.

Please keep in mind that different a tags might have a different resolution logic attached to them.

Faraaz Malak
  • 329
  • 1
  • 6