If you're browsing the Tumblr or Instagram apps on your iOS device and want to get the share URL, they are formatted as follows:



Unfortunately, these are web links. What if you want a link that will bring you right to that post ID in the app? I have written a couple of Launch Center Pro actions to automate these processes.


The URL scheme for a Tumblr post (as per GitHub) is as follows:


All the information you need is in the web link, but you need to rearrange it all to make it work.

Import the Tumblr action or enter the following into LCP:


To make this action work, you will also need TextTool and Drafts. And you will need to import this URL action into Drafts.

Let's work with a random Tumblr post to see how this works:


Copy this URL to your iOS clipboard, and then tap on the Tumblr action in LCP. LCP sends this string to TextTool, which splits the string at the /:






It then takes that output and sends it back to TextTool to split at the .:








It then sends that output to Drafts and triggers the tumblr-id URL action:


This action inputs lines 3 and 7 of the draft into the relevant points of the url scheme, and creates a new draft with the final result:


And just to make the action icon look nice, I added lc-icon=tumblr.


The Instagram action is more complicated. It requires TextTool, Drafts, and Textastic. Import the LCP action or enter this into a new action:


Instagram's url scheme for a post is as follows (as per its iPhone Hooks page):


The media ID is not part of the web URL. But we can get that info from Instagrams's Embed API. Let's use an example post (http://instagram.com/p/qJu0a-OHMC) and add it after the url=:


This API returns JSON:

 {"provider_url":"http:\/\/instagram.com\/","media_id":"759343924702114562_1483611","title":"Another beautiful day in the city! \ud83d\ude0d","url":"http:\/\/photos-d.ak.instagram.com\/hphotos-ak-xfp1\/10537269_595401073912091_331298792_n.jpg","author_name":"newyorkcity","height":640,"width":640,"version":"1.0","author_url":"http:\/\/instagram.com\/newyorkcity","author_id":1483611,"type":"photo","provider_name":"Instagram"} 

We can see that the media_id is 759343924702114562_1483611. instagram://media?id=759343924702114562_1483611 would bring us right to that post in the app, but we need the LCP action to automate the process.

We first need an easy way to grab the HTML of the API results. Textastic has an url scheme that lets you download a file and open the HTML in the editor by replacing http:// with textastic://. The first part of the LCP action does just that. However, even though Textastic supports x-callback-url, it doesn't for this particular action. So we need to tap on the share button at top right of the screen after the HTML has downloaded, and choose "Copy All." Then we take advantage of a new feature introduced in LCP: lc-callback. For apps that do not support x-callback-url, this is the next best thing. We define the callback action, but instead of it triggering automatically after the first action, we double-tap on the home button (to get the app launcher) and choose LCP. Once we tap on LCP, the next action gets triggered.

Because the embed API also provides the raw image URL for the Instagram post, the lc-callback starts with a list. We can get the iOS url scheme ("url") or the raw image URL ("image"). Let's see what happens when you choose "url":

The entire HTML is sent to TextTool, which splits the string at ":












Another beautiful day in the city! \ud83d\ude0d
































This entire string is then sent to Drafts, and the insta-api action is triggered. Import it into Drafts or enter the following as an URL action:


It simply takes line 8 -- which contains the media_ID -- and inserts into into the URL scheme.

Now, if we would rather get the raw image URL, we choose "image" after the lc-callback. It also performs a " split and sends that output to Drafts, but it instead triggers the insta-api-url action. Import it into Drafts or enter the following URL action:


Line 16 -- the raw image URL -- is sent to TextTool. Why? All the forward slashes in the URL are "escaped"


so we have to unescape them:


This action stops at TextTool. It has sharing features, so you can do what you like with URL: e.g., download the image.

To make the action icon look nice, I added lc-icon=instagram.

Granted, this LCP action is not fluid. I think it would possible to perform the conversion without the "Copy All" and lc-callback using the JSON parser in Pythonista, but I'm not proficient enough to accomplish that as of this writing. If you write an action that accomplishes the conversion with fewer steps, I would love to hear from you in the comments section or on Twitter.

Thanks to @epramono and @youens on Twitter for helping me to understand LCP 2.3.x at a deeper level.

07/07/14; 01:38:49 PM

I use Paperless for the majority of my list-making on my iOS devices. I've already written how to mark an item as complete without using the app and how to view your lists on the web. Today, I am going to share a unix command line bash script to "print" incomplete items from a list.

I created a text file called "prl" and put it in /usr/local/bin/:

#! /bin/bash


grep -A 1 \<dateCompleted\>\<\/dateCompleted\> ~/Dropbox/Paperless/$list.xml | sed -n 's:.*<itemName>\(.*\)</itemName>.*:\1:p'

I made it executable while in that directory: chmod +x prl

Now, to view the incomplete items in any list, I just type prl followed by the list name. If I have a list named Bills, I just type prl Bills and the script will output all bills that are due. (This script does not output the notes field.)

How It Works

All your Paperless lists are stored as XML files. I use grep to look for all items for which there is no completion date: <dateCompleted></dateCompleted> with -A 1 to also print out the lines immediately after each match (which are the list items themselves). Those results are piped into a sed which extracts any string sandwiched between <itemName> and </itemName>.

If I need to see a note, I can do a quick grep: grep -A 1 verizon ~/Dropbox/Paperless/Bills.xml. This will output all lines matching verizon plus the lines immediately following, including the XML tags. It's not pretty but it will get me the info I need (e.g., the due date).

<itemName>Verizon $100.00</itemName>

07/07/14; 11:30:32 AM

Last built: Tue, Mar 31, 2015 at 2:05 PM

By Jeffrey Kishner, Monday, July 7, 2014 at 11:30 AM.