Skip to content

Instantly share code, notes, and snippets.

@drdaxxy
Created November 12, 2011 15:50
Show Gist options
  • Save drdaxxy/1360714 to your computer and use it in GitHub Desktop.
Save drdaxxy/1360714 to your computer and use it in GitHub Desktop.
Export Google Reader notes to Instapaper (from better source than gist.github.com/1331457 )
# Ruby script for exporting your Google Reader notes to Instapaper
# Uses the more reliable personal note Atom feed (other script I've seen uses a JSON file from Reader's export page, which often doesn't include links)
# Almost no failsafes, rate limit might be hit, so use at your own risk
# Outputs URLs and titles of notes that couldn't be submitted (shamelessly copied from gist.github.com/1331457 )
require 'rss'
require 'net/http'
## Config
notes_atom_feed = '' # log into Reader and save the feed from www.google.com/reader/atom/user/-/state/com.google/created?n=INSERT_NUMBER_OF_NOTES somewhere (n is item limit, I used something like 10000, just to be sure :P)
instapaper_username = ''
instapaper_password = ''
##
open notes_atom_feed do |f|
feed = RSS::Parser.parse f
feed.items.each do |item|
begin
Net::HTTP.post_form(URI('http://www.instapaper.com/api/add'),
'username' => instapaper_username,
'password' => instapaper_password,
'url' => item.link.href,
'title' => item.title.content
).value
rescue
puts item.title.content + ' - ' + item.link.href
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment