Find Federico on MastodonFind John on MastodonFind Alex on MastodonFind Club MacStories on Mastodon

Parsing Shortcuts as XML or JSON and Extracting Comments From Them

SHORTCUTS CORNER

Get help and suggestions for your iOS shortcuts and productivity apps.

Shortcuts Essentials

Parsing Shortcuts as XML or JSON and Extracting Comments From Them

Nearly three years ago in MacStories Weekly, I wrote about an advanced technique I was using to assemble the MacStories Shortcuts Archive. As I wrote at the time, the Shortcuts Archive is itself generated by a shortcut that collects information from hundreds of text files (one for each shortcut) that contain metadata such as title, link, icon URL, and description. Those bits of metadata aren’t filled in by me: they’re automatically extracted from each shortcut.

I don’t want to rehash the same story again because the specifics of my setup haven’t changed, but as a recap for those who may have missed it: three years ago, I discovered that it was possible to extract data from shortcuts two ways. Under the hood, shortcuts are actually .plist files that can be interpreted as XML inside Shortcuts itself. The visual actions you see in the editor are, in reality, an XML structure that contains various forms of identifiers and plain text. In 2019, before Apple’s revamped security model for Shortcuts, this conversion to .plist could be done pretty easily.

This story is for Club MacStories, Club MacStories+, and Club Premier members only.

Join the Club and get access now.

Already a member? Sign in