Harry R. Schwartz

Software engineer, nominal scientist, gentleman of the internet. Member, ←Hotline Webring→.

bearded cartoon drawing of the author · 1B41 8F2C 23DE DD9C 807E A74F 841B 3DAE 25AE 721B

Sending Newsbeuter/Newsboat Articles to Instapaper

Sending Newsbeuter/Newsboat Articles to Instapaper

Published . Tags: beards, web.

I read RSS feeds through newsboat (the regularly maintained successor to newsbeuter). I also often save articles to read later through Instapaper. I wanted to be able to save articles from newsboat directly to Instapaper by just hitting a key.

Neither newsbeuter nor newsboat seem to support binding arbitrary keys to arbitrary commands, so the idea here is to rebind the “bookmark” command to trigger a shell script that sends the article to Instapaper.

There’s a Ruby library/executable called ricepaper that you can use to interface with Instapaper. Assuming you’ve got Ruby installed, you can install the library with:

$ gem install ricepaper

Next, you’ll need to wrap it with an executable that takes a URL as a command line argument and handles your Instapaper credentials. Save this script as instapaper, set the username and password variables appropriately, drop it somewhere in your $PATH, and make it executable:

#!/bin/bash

# Add a URL to Instapaper.
#
# Usage:
#
# $ instapaper <url>

username="YOUR_INSTAPAPER_EMAIL_ADDRESS"
password="YOUR_INSTAPAPER_PASSWORD"

ricepaper -u $username -p $password "$1" > /dev/null &

You should now be able to run the instapaper script successfully, with the indicated article appearing in your Instapaper account:

$ instapaper <url_for_an_article>

Assuming that works, you can bind the key in your ~/.newsboat/config:

bookmark-cmd instapaper
bookmark-autopilot yes
bind-key i bookmark

Restart your feed reader, navigate to an article, hit i, and your article should appear in Instapaper.