Check the original post for the script, and change the line (around line 90)
rnrse = newres.match(/’_rnr_se’: ‘([^’]+)’/)
rnrse = CGI.escape(newres.match(/’_rnr_se’: ‘([^’]+)’/))
The CGI escaping should help with the Google’s changes to the
_rnr_se variable. Evaryont also notes that the script works great in Arch Linux with Ruby 1.9.2. For 1.9 compatibility (thanks to David for clarification in the comments below), remove the
-rjcode from the hashbang on the first line, and add
require 'jcode' if RUBY_VERSION < '1.9' below. Have fun!