# Automated Google Reader Backups

DevFeed: [Automated Google Reader Backups](<https://devfeed.tech/articles/automated-google-reader-backups-25384.md>)

Original publisher: [Read original article](<https://smileykeith.com/2013/02/01/automated-google-reader-backups/>)

Author: Keith Smiley

Published: 2013-02-01T20:30:00Z

Content type: article

Language: en

Sources: [Keith Smiley](<https://devfeed.tech/sources/keith-smiley.md>)

Topics: [Google](<https://devfeed.tech/topics/google.md>), [Ruby](<https://devfeed.tech/topics/ruby.md>), [RSS](<https://devfeed.tech/topics/rss.md>), [Script](<https://devfeed.tech/topics/script.md>), [RSS Feed](<https://devfeed.tech/topics/rss-feed.md>), [Server](<https://devfeed.tech/topics/server.md>), [Authentication](<https://devfeed.tech/topics/authentication.md>)

Tags: [automated](<https://devfeed.tech/tags/automated.md>), [download](<https://devfeed.tech/tags/download.md>), [google](<https://devfeed.tech/tags/google.md>), [networking](<https://devfeed.tech/tags/networking.md>), [python](<https://devfeed.tech/tags/python.md>), [rss](<https://devfeed.tech/tags/rss.md>), [ruby](<https://devfeed.tech/tags/ruby.md>), [run](<https://devfeed.tech/tags/run.md>), [script](<https://devfeed.tech/tags/script.md>), [server](<https://devfeed.tech/tags/server.md>)

## AI overview

This article describes automating Google Reader subscription backups. The author rewrites a Python script in Ruby and schedules it as a cron job on a server to authenticate with Google and download a current OPML subscription export.

## Source excerpt

I spend a lot of time in my RSS Reeder (see what I did there?). I still find Google Reader to be the best and easiest way to manage my subscriptions, although I've been wanting to switch to Fever for a while. One thing I wanted to do when I launched my new site (the one you're reading) was to have a downloadable up to date export of my Google Reader OPML file (which of course I never did). I looked around for good ways to automate this and I found a simple Python script to do it with (sorry I couldn't find it again for this post). I decided to rewrite it in Ruby and set it up on my server as an automated cron job. To run the script I came up with use something like: ruby path/to/googleReaderOPML.rb username@gmail.com SekretPassword To add it to your crontab (to run every Sunday at 1:01am) use something like: 1 1 * * 7 ruby path/to/googleReaderOPML.rb username@gmail.com SekretPassword #!/usr/bin/env ruby # # => This script will authorize your Google credentials and download your Google Reader subscriptions # => Usage: ./googleReaderOPML.rb GOOGLEUSERNAME PASSWORD # # The required networking shenanigans require 'uri' require 'net/http' require 'open-uri' require 'rubygems' # This requires the 'colorize' gem. Install with '[sudo] gem install colorize' require 'colorize' # The base Google URLs for callback, authentication, and subscription export $GOOGLE_URL = "http://www.google.com" $LOGIN_URL = "https://www.google.com/accounts/ClientLogin" $READER_URL = "http://www.google.com/reader/subscriptions/export" # The user agent string, for some reason this is required, feel free to change it $SOURCE = "keith.so" # The default output filename, it is automatically overwritten if one already exists $FILE_NAME = "googlereadersubscriptions.opml" # Make sure there is the correct number of arguments if ARGV.count != 2 # Print the instruction puts "Usage: ./#{ File.basename(__FILE__) } USERNAME PASSWORD".red exit end # Build the request URL uri = URI.parse($LOGIN_URL) # Setup the Pa