visionmedia / google-search Goto Github PK
View Code? Open in Web Editor NEWRuby - Google Search API
Ruby - Google Search API
Google::Search
now returns for about 60 results. Is it okay or it can be handled somehow?
I'm working on a feature for the faker gem that would utilize this gem, and anytime I run the tests for it, it prints this message a lot.
I was able to solve it by declaring @each_response as nil in the initialize, but would love feedback from others as well
I'm trying to simulate a search like this:
https://www.google.com/search?q=site:xapo.*
Results: xapo.com xapo.ch xapo.de xapo.info xapo.at xpo.co.pt etc...
What I have is something like this:
q = Google::Search::Web.new query: "site:xapo.*"
q.get_uri
# http://www.google.com/uds/GwebSearch?start=0&rsz=large&hl=en&key=notsupplied&v=1.0&q=site%3Axapo.%2A&filter=1
q.take 100
# Results: xapo.com foo.xapo.com etc...
The results are way different. What am I doing wrong?
When I first require 'roo' and then require 'google-search' I get an error
TypeError: Google is not a module
Again, I first require 'google-search' and then require 'roo' I get this error
TypeError: Google is not a class
See below for what actually happened on irb
{12:30}[1.9.3]~ ➭ irb
1.9.3-p0 :001 > require 'roo'
=> true
1.9.3-p0 :002 > require 'google-search'
TypeError: Google is not a module
from /home/sagar/.rvm/gems/ruby-1.9.3-p0/gems/google-search-1.0.3/lib/google-search/version.rb:2:in <top (required)>' from /home/sagar/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in
require'
from /home/sagar/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in require' from /home/sagar/.rvm/gems/ruby-1.9.3-p0/gems/google-search-1.0.3/lib/google-search.rb:26:in
<top (required)>'
from /home/sagar/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:59:in require' from /home/sagar/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:59:in
rescue in require'
from /home/sagar/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:35:in require' from (irb):2 from /home/sagar/.rvm/rubies/ruby-1.9.3-p0/bin/irb:16:in
<top (required)>' from /home/sagar/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in
require'require' from /home/sagar/.rvm/gems/ruby-1.9.3-p0/gems/roo-1.10.1/lib/roo.rb:74:in
<top (required)>'require' from /home/sagar/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:59:in
rescue in require'require' from (irb):2 from /home/sagar/.rvm/rubies/ruby-1.9.3-p0/bin/irb:16:in
'It seems some searches do not get results. When searching for 8715664020388 i get no results through google-search gem. When I google it myself, I do get search results. I encounter the problem with a lot of queries.
I don't know if it's very relevant here, but we've released a gem that uses our own backend to get back Google results: https://github.com/serpapi/google-search-results-ruby
Hopefully it will be helpful.
I'm using Google::Search::Web for results but from today I'm facing the issue and get response (The Google Web Search API is no longer available)
{"responseData"=>nil, "responseDetails"=>"The Google Web Search API is no longer available. Please migrate to the Google Custom Search API (https://developers.google.com/custom-search/)", "responseStatus"=>403}
Hi TJ,
I've checked out your gem because I need to create a toy metasearch engine, the thing is that I need to have proxy support to pass through my university network, and I was about to create a patch.
As you already know, adding proxy support is trivial but, in order to keep the excellent usability of the API I was wondering which one of the following approaches would you prefer me to follow:
Google::Search::Web.new(:query => 'naked celebrities', :proxy => 'http://proxy.uniovi.es:8888').each do |web_result|
#... Whatever
end
Google::Search::Defaults.set(:proxy, 'http://proxy.uniovi.es:8888')
Google::Search::Web.new(:query => 'naked celebrities').each{ | web_result | ... }
Google::Search::Images.new(:query => 'angelina jolie').each{ | image | ... }
Google::Search::Local.new(:query => 'foo bar').each{ |place| ... }
Both alternatives can be complementary.
Do you think that having a Defaults object would break your API orthogonality? having it would ease the case of needing a proxy, which IMHO is not that uncommon, but I would like to know your opinion.
Regards,
Miguel
I am trying to require google-search gem inside a helper module, but getting the following error on require cannot load such file -- google-search
. This is working well at the local system, but causing problems at the production server. Though I can find the gem when I run gem list
. Unable to figure out the problem.
module TestHelper
require 'google-search'
end
Is it possible to do a search with a date range?
Before it was Image, now even news articles are NOT being displayed from Google::Search::News. Please somebody help here. I m doing my final year project and desperately need some help. I tried it on irb. The result was NIL.
2.3.0 :008 > Google::Search::News.new(query: "Panama Papers")
`2.3.0 :009 > results = _
=> #<Google::Search::News:0x00000000e597c8 @relative_to=nil, @edition=nil, @order_by=nil, @type=:news, @Version=1.0, @offset=0, @SiZe=:large, @language=:en, @query="Panama Papers", @api_key=:notsupplied, @options={}>
2.3.0 :010 > results.each do |result|
2.3.0 :011 > puts result
2.3.0 :012?> end
=> nil `
Going through code i see you have the "rsz" query option, but how can i set that when doing an image search?
Over the last two days Google::Search::Image.new(:query => "anything") has been returning 0 results. I haven't touched any part of my google search code, and the results used to return perfectly. Google::Search::Web also still works. Is this specific to my app or has something happened with Google? Thanks for your help, great gem!
Hi, when I do a search on Google, I get 115,000 items, but with the gem, I get 64. Should they match?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.