I don’t have much time to update this gem. github.com/pivotus/galerts seems to be a newer gem that may work better with the new google alerts api params and is also the gem pushed to rubygems.
Simple Ruby library that uses Mechanize to scrape Google Alerts from the google alerts webpage. A lot of the functionality was ported from github.com/jab/galerts
-
List all alerts associated with account.
-
Create new alerts for any google domain.
-
Update existing alert: Change delivery, frequency, volume, alert type or google domain.
-
Find an alert by keyword
-
Cant sign in to certain Google Domains (co.kr, com.hk, .se etc.)
-
Workaround: Create alerts logged out on different domains and verify them thru google.com/alerts
-
Must use
gem ‘galerts’, :git => ‘git://github.com/amalhotra/galerts’
require 'galerts' g_manager = Galerts::AlertsManager.new(email,password) # List alerts: Returns an Array of Alert objects (see lib/galerts/alert.rb) my_alerts = g_manager.alerts sample_alert = my_alerts.first # Update the google domain of this alert sample_alert.domain = "co.uk" g_manager.update(sample_alert) # Create a new alert for "ruby google alerts" on Google News Spain in real time delivering alerts via email # Note: There are defaults on the create, we list them here for better understanding g_manager.create("ruby google alerts","es",Galerts::NEWS,Galerts::RT,Galerts::BEST_VOL,false) # Delete an alert g_manager.delete(sample_alert) # Find an alert by passing a map of attributes # Returns an array of Alert objects g_manager.find({:query => "ruby google alerts"}) g_manager.find({:query => "ruby google alerts",:domain => "com"}) g_manager.find({:query => "ruby google alerts",:domain => "com",:feed => true}) ..
Certain google domains have been known not to work. Here is a subset from http://en.wikipedia.org/wiki/List_of_Google_domains which are known not work: .ga, .gd, .gf, .im, .io, .lc