Hey everyone! I'm working on a project where I need to extract links from a website that hides its hyperlinks. When I look at the code, I see the links are defined using `ng-click="gotoExternalURL(usefulink.Website_URL)"`. I was wondering if there's a way to get these links directly from the code. I could manually click each button to open a new tab and copy the URL, but that would be time-consuming since there are hundreds of these hidden links. Any suggestions on a more efficient method? Thanks!
3 Answers
It sounds like you're looking at the rendered page rather than the source code. The `ng-click` isn't where the actual URLs are stored, as it's part of Angular's framework. If these links are genuinely hidden and not present in the source code, using Regex won't help much. Instead, focus on those JavaScript execution methods to expose them.
You should definitely run a small JavaScript code snippet in your browser's console to search for any URLs. Something straightforward to find and log all the URLs could be really helpful. Just keep in mind that since Angular loads them dynamically, make sure you do this after the page has fully loaded!
You might want to consider using browser automation tools like Selenium or Puppeteer. Since Angular handles the URL dynamically with JavaScript, these tools can simulate clicks on the elements and retrieve the actual links for you. Additionally, if you're feeling adventurous, you could run a JavaScript snippet directly in the console to call the `gotoExternalURL()` function and log the URLs it generates.
That sounds like a solid plan! I've used Selenium for similar tasks before, and it really speeds things up. Good luck!