Created
January 21, 2012 19:15
-
-
Save neonichu/1653638 to your computer and use it in GitHub Desktop.
Backup your Google Reader data
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'mechanize' | |
agent = Mechanize.new | |
page = agent.get('https://accounts.google.com/ServiceLoginAuth') | |
form = page.forms.first | |
form.Email = '<<<Your Google Reader username>>>' | |
form.Passwd = '<<<Your Google Reader password>>>' | |
agent.submit form | |
time = Time.new | |
today = time.strftime("%Y%m%d") | |
notes_fname = 'notes-' + today + '.json' | |
starred_fname = 'starred-' + today + '.json' | |
subs_fname = 'rss-subscriptions-' + today + '.opml' | |
agent.get('http://www.google.com/reader/subscriptions/export?hl=en').save_as(subs_fname) | |
# Those URLs are specific to my account, get yours from Settings -> Import/Export in the web interface | |
agent.get('http://www.google.com/reader/export/json/user/04785471984543895866/state/com.google/starred?filename=starred-items.json&n=99999&comments=true&full=true&co=false&hl=en').save_as(starred_fname) | |
agent.get('http://www.google.com/reader/export/json/user/04785471984543895866/state/com.google/created?filename=notes.json&n=99999&comments=true&full=true&co=false&hl=en').save_as(notes_fname) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment