Submitted by drjunior on Mon, 01/13/2014 - 17:13
How to download an image from google:
def getimageurlfromgoogle(query)
response = Net::HTTP.get_response('ajax.googleapis.com',
URI.encode("/ajax/services/search/images?v=1.0&q=#{query}&as_filetype=png&safe=active"))
JSON.parse(response.body)["responseData"]["results"][0]["url"]
end
The first result is not always the best result!!