Reputation: 137
i am using awesome google-search gem for search some info in google.
This is my ruby (model Items belongs_to Product) :
require 'rubygems'
require "google-search"
query = "Some query for google"
Google::Search::Web.new do |search|
search.query = query
puts search.first.uri
end
But often i got results not same like in my browser. I guess its all about my account, because google range searched data by my search history and google-search gem has no this history.
Who know how i can solve this issue that got more relevant result from google ?
Upvotes: 1
Views: 579
Reputation: 5145
As this gem is now deprecated, we built our own gem. It's quite simple to use:
query_params = {
q: "query",
google_domain: "Google Domain",
location: "Location Requested",
device: device,
hl: "Google UI Language",
gl: "Google Country",
num: "Number of Results",
}
query = GoogleSearchResults.new query_params
hash_results = query.get_hash
html_results = query.get_html
json_results = query.get_json
Upvotes: 2