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 / )
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