The Shortcuts app has a number of actions that come under the Web category, and I thought I would include a few simple examples. There are two basic actions that can be used to get the URL of a web page–one is to specify the URL, and the other is to get the URL of the current web page from Safari. I’ve used the former in my examples.
The first shortcut gets the URLs of all links from the specified web page. It sorts the URLs alphabetically and removes duplicates. This shortcut returns text, which is easily converted to a list with the Split Text action.
It should be noted that if the last two URLs are duplicates, both are returned. This can be fixed by adding a linefeed to the end of the text after the Combine Text action or possibly by revising the regex.
Get Links.shortcut (22.6 KB)
The next shortcut is similar to the above, except that it returns the URLs of links to PDF documents only. The Filter action can be revised to return links to whatever is desired.
Get PDF Documents.shortcut (22.8 KB)
The third shortcut returns the component parts of URLs, which are structured as follows:
scheme://user:password@host:port/path?query#fragment
URL Components.shortcut (22.6 KB)
Other Web actions are relatively simple to implement and follow the patterns shown above. Examples are:
- add URL to reading list;
- show web view of URL;
- get headers of URL;
- get items from RSS feed;
- and so on…