Sha256: e0b36f367817b4a17fb322cc45947e61bb6bdce5cbe586dc16c415ad47d01246

Contents?: true

Size: 528 Bytes

Versions: 2

Compression:

Stored size: 528 Bytes

Contents

require 'cgi'
require 'json'

module PageRankr
  class Indexes < Tracker
    class Google < Index
      
      # overloaded to use Google's AJAX search API
      # http://code.google.com/apis/ajaxsearch/documentation/
      def initialize(site)
        @indexes = clean JSON.parse( open( url(site)).read )["responseData"]["cursor"]["estimatedResultCount"].to_s
      end
      
      def url(site)
        "http://ajax.googleapis.com/ajax/services/search/web?v=1.0&rsz=1&q=site%3A#{CGI.escape(site)}"
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
PageRankr-1.7.1 lib/page_rankr/indexes/google.rb
PageRankr-1.7.0 lib/page_rankr/indexes/google.rb