From Newsbeuter to Instapaper with the Ruby RicePaper library

March 3, 2009

I love Instapaper, a truly elegant solution without any needless over-architecting. I use it every day, for queuing up articles to read during a lull in the workflow around here.

However, I’ve had an extra step in my article reading, see I read my RSS feeds in Newsbeuter, so I normally have to open the feed in Newsbeuter, open it in the browser, use the bookmarklet to add it to instapaper, then close the tab (until I want to read the article later). Well no more!

Enough introduction, I haven’t posted nearly enough on here lately, so I wanted to share a little library I’m working on called RicePaper. It’s a simple Ruby library/cli tool for submitting URLs to Instapaper. I’ve started a github project for it, go check it out or download the file directly. RicePaper requires the HTTParty gem (which you can install using “sudo gem install httparty” on a system with Ruby installed) Ricepaper works extremely easily from the command line, like so:

% ./ricepaper.rb -u -p mypassword -t "The IWishI site" ""

The -t “<title>” option is optional, Instapaper will attempt to find a title for the article without it. You can also use ricepaper from any Ruby code (if you’re a Ruby scripter) as a library by using this little code:

require 'ricepaper'
rp =, password)
rp.add("", "The ASDF site")

It’s extremely simple to use.

Anyway, back to what I was originally going to use it for, bookmarking a URL directly from Newsbeuter, for that, we’ll need a “glue” script, like this (I named mine


# Change these to be your instapaper credentials
# Where the ricepaper executable is located

# If the title is non-empty, set it
if [ ${#2} -gt 0  ]; then
$RICEPAPER -u $USERNAME -p $PASSWORD -t "$2" "$1" > /dev/null &
$RICEPAPER -u $USERNAME -p $PASSWORD "$1" > /dev/null &

# Exit correctly, either way
exit 0

Watch out for the quotes in the script above, sometimes wordpress makes them “special” quotes, which confuses the bash interpreter.

Replace the username and password to your Instapaper credentials and put the correct location to the ricepaper ruby executable, then save the script, chmod +x it and put it in your path somewhere.

Only one step left, which is to add this line to your ~/.newsbeuter/config file:


What happens now, is when you bookmark an article in Newsbeuter, it will call with the URL and Title of the article, so whatever you put the Title of the bookmark to be, that’s the title that will show up on Instapaper. Voila!


Feel free to email if you have any questions about using the script(s). Hope you enjoy!

8 Comments to "From Newsbeuter to Instapaper with the Ruby RicePaper library"

  1. bartman wrote:

    Wow! Thanks for the pointer to Instapaper!

  2. Hautmedoc wrote:

    Thanks very much, a very useful script.
    Works like a charm once the quotes were right.
    I just wonder if Instapaper does support UTF8 correctly.

  3. Hautmedoc wrote:

    By the way I have another question. There must be a way to also use ricepaper within mutt ?

  4. Lee wrote:

    @Hautmedoc: You should be able to use ricepaper from any application that can run an external program with command-line arguments. I’m not sure exactly how you’d use it from mutt, but I’m sure there’s a way :)

  5. chmeee wrote:

    Hey, Lee,
    thanks for the script. By the way, is there any ‘good’ way to use instapaper with vimperator.
    As I don’t show the address or bookmark address I see no way to use the button.

  6. chmeee wrote:

    Oops, I should have googled before asking…

  7. chmeee wrote:

    I changed the script from bart to use ricepaper instead of his bash script.
    I’m not sure how this will show in the comment so I also posted it in

    // Vimperator plugin: ‘Ricepaper’
    // place in ~/.vimperator/plugin/readlater.js
    // pushing ,rp will send the url to the ‘readlater’ script

    mappings.addUserMap([modes.NORMAL], [“,rp”],
    function () {
    // var u = escape(document.getElementById(“urlbar”).value);
    var u = document.getElementById(“urlbar”).value;
    var r = io.system(“ ‘” + u + “‘”);
    liberator.echo(“ricepaper returned ” + r);

    // vim: set fdm=marker sw=4 ts=4 et:

    By the way, should I escape the url or not with ricepaper?

  8. Lee wrote:

    @chmeee: You shouldn’t need escape the url, just make sure it’s quoted so the shell doesn’t do anything with weird urls.

Powered by Wordpress and MySQL. Theme by Shlomi Noach,