<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -3,8 +3,10 @@ class Google
 
   BASE_SEARCH_URL = &quot;http://www.google.com/search?q=&quot;
 
-  def self.search_url query
-    BASE_SEARCH_URL + URI.encode(query)
+  def self.search_url query, options = {}
+    url =  BASE_SEARCH_URL + URI.encode(query)
+    url += &quot;&amp;start=#{ (options[:page] - 1) * 10 }&quot; if options[:page] and options[:page] != 1
+    url
   end
 
   def self.fetch_url url
@@ -15,8 +17,16 @@ class Google
     ( Hpricot(html) / 'div.g' ).map { |result| Result.new(result) }
   end
 
-  def self.search query 
-    parse_results( fetch_url(search_url(query)) )
+  def self.search query, options = {}
+    if options[:pages] and options[:pages] &gt; 1
+      results = []
+      options[:pages].times do |i|
+        results += parse_results( fetch_url(search_url(query, :page =&gt; i+1)) )
+      end
+      results
+    else
+      parse_results( fetch_url(search_url(query)) )
+    end
   end
 
   # Simple class representing a single Google result</diff>
      <filename>lib/domain-finder/google.rb</filename>
    </modified>
    <modified>
      <diff>@@ -12,6 +12,12 @@ describe Google do
     Google.search_url(@example_query).should == @example_url
   end
 
+  it '.search_url should support pagination' do
+    Google.search_url(@example_query, :page =&gt; 1 ).should == @example_url
+    Google.search_url(@example_query, :page =&gt; 2 ).should == @example_url + '&amp;start=10'
+    Google.search_url(@example_query, :page =&gt; 10).should == @example_url + '&amp;start=90'
+  end
+
   it '.fetch_url should fetch the results of a full url' do
     Google.should_receive(:open).with(@example_url).and_return(StringIO.new(@example_html))
     Google.fetch_url(@example_url).should == @example_html
@@ -30,7 +36,19 @@ describe Google do
 
   it '.search should return GoogleResult objects for a query' do
     Google.should_receive(:open).with(@example_url).and_return(StringIO.new(@example_html))
-    Google.search(@example_query).first.should be_a_kind_of(Google::Result)
+    results = Google.search(@example_query)
+    results.length.should == 10
+    results.first.should be_a_kind_of(Google::Result)
+  end
+  
+  it '.search should support pagination' do
+    Google.should_receive(:open).with(@example_url).and_return(StringIO.new(@example_html))
+    Google.should_receive(:open).with(@example_url + '&amp;start=10').and_return(StringIO.new(@example_html))
+    Google.should_receive(:open).with(@example_url + '&amp;start=20').and_return(StringIO.new(@example_html))
+
+    results = Google.search(@example_query, :pages =&gt; 3)
+    results.length.should == 30
+    results.first.should be_a_kind_of(Google::Result)
   end
 
 end</diff>
      <filename>spec/google_spec.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>03488e1c162988c9904b559e64b8e8ca068374a9</id>
    </parent>
  </parents>
  <author>
    <name>remi</name>
    <email>remi@remitaylor.com</email>
  </author>
  <url>http://github.com/remi/domain-finder/commit/a6e706532cb74e08d94662c2d35ef96f8b1a4256</url>
  <id>a6e706532cb74e08d94662c2d35ef96f8b1a4256</id>
  <committed-date>2008-06-14T15:34:10-07:00</committed-date>
  <authored-date>2008-06-14T15:34:10-07:00</authored-date>
  <message>added Google pagination ... Google.search 'query', :pages =&gt; 3 (should give 30 results)</message>
  <tree>1512ca8426593e476dcbbb88cc8a87f5b79fabe2</tree>
  <committer>
    <name>remi</name>
    <email>remi@remitaylor.com</email>
  </committer>
</commit>
