GoogleSearch is a Ruby Abstraction of the Google CSE XML API.
Ruby
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
spec
LICENSE
README.textile
Rakefile
googlesearch.gemspec

README.textile

GoogleSearch

Description

GoogleSearch is a Ruby Abstraction of the Google CSE XML API.

Installation

    
        gem sources -a http://gems.github.com
        sudo gem install mlangenberg-googlesearch 
    

Example

    
        require 'googlesearch'
        response = GoogleSearch.new(:cx => 'unique-cse-id', :q => 'chunky+bacon', :cr => 'en', :lr => 'en', :start => 0, :num => 5).response
        response.total_number_of_results #=> 54
        response.total_server_time #=> 0.189222
        response.index_of_first_result #=> 1
        response.index_of_last_result #=> 5
        response.results.first.index #=> 1
        response.results.first.title #=> 'CHUNKY BACON!'
        response.results.first.excerpt #=> "<b>chunky bacon</b>. why's (poignant) guide to Ruby ..."
        response.results.first.url #=> "www.<b>chunkybacon</b>.com/"
        response.results.first.language #=> 'en'
        response.results.first.mime_type #=> nil  (but could be 'application/pdf')