Using Apple Script to get link URLs from website

Is there a way to use Apple Script (or Automator) to search a webpage for hyperlinks containing a certain string, and then copy their respective URLs to a text file?


Help would be really appreciated, I've been attempting this for several hours but wasn't able to find a solution.

MacBook Pro with Retina display, OS X Mavericks (10.9.5)

Posted on Dec 26, 2017 3:41 PM

Reply
2 replies

Dec 27, 2017 10:33 AM in response to Fabian Apfel

Let's suppose that there is a hyperlink at a particular website. Looks like this in the HTML:


<a href="http://www.apple.com">Apple</a>


Is there a way to use Apple Script (or Automator) to search a webpage for hyperlinks containing a certain string?


In the above example, do you want to match the "apple" in the actual href URL, or the plain text Apple that is receiving the hyperlink? I can give you either with an AppleScript solution.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Using Apple Script to get link URLs from website

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.