Workflow to Collect All Links

October 08, 2017 by Gabe | [mmd] |

At the end of my last post I included a rather long list of URLs. It was the a-tag links from the body of the article, but collected together with their page title to make it a little easier to read the reference the articles in order.

Reference List

That list was compiled by the iOS app Workflow. I'm skeptical that Workflow will continue to get the developer love that got it onto my home screen, but I still think it's useful today.1

Here's the workflow.

It's using a couple of pretty neat steps, but basically a text input box pops open and I paste the entire text I want to extract the URLs from. The workflow then puts a new text block on the clipboard that contains a series of markdown links for each URL that includes the page title.

The first little trick is the "Get URLs" action. This produces a list of all URLs from the pasted text block. That's nice since I don't need to worry about the RegEx.

Workflow

Next, the "For Each" loop iterates that list of URLs and stuffs each one (in turn) into a variable to hold it so the workflow can then use the very powerful, but slow, "Get Article" action. This action allows me to grab various meta data from then URL destination. In this case I really just care about the page title. I set this to Title Case as a civilized person would do so that I can use it as the a-link anchor text.

At this point in the loop I have the original URL and the page title as different variables. This is perfect for creating a markdown link. This gets appended to a new variable that will contain all of the markdown links by the time the loop finishes running.

MD Links


  1. A BIG iOS 11 update hasn't happened yet. If any app deserved a Drag and Drop, or split screen update it's Workflow. Apple just isn't that good at updating their own apps. 

tags