Tag: 谷歌搜索

Ruby Google Custom Seach API从下一页获得结果

下面的代码只是从谷歌分页的第一页获得结果…如何获得更多的结果? require ‘google/api_client’ # autenticação client = Google::APIClient.new(:application_name => ‘Ruby Drive sample’, :application_version => ‘1.0.0’, :client_id => ‘xxxxxxxxxxxxxxxx’, :client_secret => ‘xxxxxxxxxxxxxx’, :authorization => nil) search = client.discovered_api(‘customsearch’) # chama a API response = client.execute( :api_method => search.cse.list, :parameters => { ‘q’ => ‘cafe’, ‘key’ => ‘xxxxxxxxxxxx’, ‘cx’ => ‘xxxxxxxxxxxxxxxx’ } ) # recebe a resposta […]

在轨道之外的cattr_accessor

我正在尝试使用google_search ruby库(代码如下),但它抱怨’ cattr_accessor是一种未定义的方法’ – 任何想法为什么会这样或我如何解决它? require ‘rubygems’ require ‘google_search’ GoogleSearch.web :q => “pink floyd”