“Use Mercury Parser to Simplify Webpage” Macro

Keyboard Maestro “Use Mercury Parser to Simplify Webpage” Macro

Use Mercury Parser to Simplify Webpage.kmmacros (83.2 KB)

Hi there,

I'm a new user of Keyboard Maestro and this is the first macro I made.

The purpose of making this macro is to simplify a webpage using the Mercury Web Parser. There're quite a few read-it-later service that will simplify your webpage but they require 3rd-party storage of a webpage, which may not be reliable. Also the service I use is Instapaper and the result is not as good as Mercury Web Parser. Secondly, I store important webpage in Devonthink Pro which has a built-in import function which works terribly. So I decided to write my own macro to use mercury parser to simplify a webpage.

Mercury has a official chrome plugin which could simplify a webpage but you cannot export it. Instead, the macro I made uses Mercury's API.

To run the macro, you first need to go to their website and create an free account, which will gives you an API key. Then edit the macro and change the content of "execute shell script":

mkdir -p ~/Downloads/MacroTEMP && cd ~/Downloads/MacroTEMP && curl -H "x-api-key: ******" "$KMVAR_ParseURL" -o ParseResult.html

Replace "******" to "your key".

Then go to a webpage in chrome, click the Keyboard Macro icon in the menubar and select "use mercury parser to simplify webpage". The macro works very fast and is supposed to finish within seconds. It will create temporary file under ~/Downloads/MacroTEMP but this folder would be automatically deleted. (I suggest you to check the last shell command to make sure it's not rm -rf / :slight_smile:)

Note that the simplified webpage's html file will also be deleted, but your chrome should already loaded this webpage so that you can save it in any format (html/pdf) you like.

Update:

Feb. 7 Fixed the path in Section 6. Thanks @JimmyHartington
Feb. 8 Fixed more minor problems and substitute a shell script with built-in action. Thanks @JMichaelTX

Hi

In Section 6-store where you save and open til html. Here your username is hardcoded in the path.
As other places it should be replaced by ~

1 Like

Thanks, I’ve fixed the problem.

Is everything else working well for you?

Thanks for sharing. This looks potentially very useful. :+1:

:warning: Changes Needed
I found two more Actions that need to be changed from your hard-coded path:

###Suggestions

Rather than use a Shell Script to create and delete files/folders (which can be very dangerous), I'd recommend using the KM Action to create, and then to move these items to the Mac Trash.

####From the Actions Panel

1 Like

Thanks for your suggestions. I’ve replaced the last shell script, which deletes all temporary files, with a KM action.

I noticed the same as JMichaelTX but when fixed it is a nice macro I can use when I need a simpler reading experience.
Thanks for it.

1 Like