Using Google Search REST API in Ruby - ruby

I'm trying to do a google search using Ruby, and print the 1st 3 results.
Could anyone point me to a sample code? I'm unable to find it.

The gem googleajax is there for that:
require 'googleajax'
GoogleAjax.referer = "your_domain_name_here.com"
GoogleAjax::Search.web("Hello world")[:results][0...3]

Now Google wants you to use this http://code.google.com/p/google-api-ruby-client/ with a limit of 100 courtesy queries, and a pricing structure for anything above that.

Related

google-cloud-vision API gives fewer results

I was using ruby client of Google Cloud Vision, to extract the vehicle information on Automobile Original Titles.
Observations:
When I used the client API, i was getting 171 words.
But, when I used the google's API demo here: https://cloud.google.com/vision/, I got 459 words. It has much of the information I was looking for.
Can anyone please explain, how to get the most out of the API ?
I found the answer to my question,
thanks to #marlon-giona.
I was referring to the post: Google Vision API text detection strange behaviour - Javascript
When I used the image.document to extract dense text, I got the exact words I was looking for

How do I use the Ruby twitter gem to get a list of followers for a given ID/handle?

I want to use v5.0 of the Twitter gem, and I can't figure out the documentation to understand how to get a list of followers, given a handle.
It looks like previous versions had a method that looked something like Twitter.follower_ids('ID to lookup'), but that doesn't work any more.
I don't know if there's some easier way to navigate the RDoc documentation but I had to first root around in the code, to notice the RDoc comments, to then realize that this is the page which documents some of the behavior I wanted.
# configure client with secrets and access keys
client.followers 'screen_name_of_interest'
This returns a certain number of followers - but I still can't figure out how to figure out how many followers, and how to use cursors to retrieve more.

How does Market Samurai and Long Tail Pro handle retrieving the top 10 Google search results for a keyword?

I'm curious to know how Market Samurai, Long Tail Pro and other software handle retrieving the top 10 Google search results and not running into limits. It appears that these software packages use the users own Google account. Google Custom Search limits users to 100 queries per day (the free limit) but people tend to do keyword research on hundreds or even thousands of keywords per day and don't pay any additional amounts to Google.
Are they paying extra for this service, are they using a different API (perhaps the Adwords API?) or are they scraping the Google search results page (violation of TOS)? Really would like to know! Thanks.
i have done this in one of my project (in java).
this is very simple, in java there is one library call JSoup by using this library you can send get request to google, for example:
https://www.google.co.in/webhp?sourceid=chrome-instant&ion=1&espv=2&ie=UTF-8#q=<your url encoded search term>
this will return you an HTML code of google search result with your own term.
using Jsoup u can find specific HTML tag with specific class or id. this concept helps you to extract url link, title and description from google search result.
for working example check here, in that example you can extract google serach result links with custom search term.
i hope this will help you.

How to retrieve more than 100 search results using Twitter RubyGem

I am using the Twitter rubygem and my goal is to retrieve all 1500 search results of a search.
Currently:
Twitter.search("test", :count => 1500).results.map do |status|
i = i+1
end
puts i
The :count does not seem to matter, it only retrieves 100 tweets at most.
This in itself is weird to me as one page of twitter results should return only 20 tweets.
I couldn't find an official doc (sigh~) and digging in the spec didn't help.
Anyone knows how to "turn pages" with this thing, or tell it to do it by itself?
Thanks
Twitter's API may be the limiting factor here, not the gem. – Andrew Marshall
I was mistaken, I mixed up "users/search" with "search/tweets" in the Twitter API, the limit seems to be a hundred for the later and a thousand for the first. It's working as intended =)

What's the quickest way to do complex queries on Twitter using their Ruby API?

I want to create a complex query, e.g. return the first 100 Twitter Users that match the following criteria:
Have greater than X # of followers
Have greater than X # of tweets
Have the string "Rails developer" or "Rails" in their bio
Have tweeted in the last X days.
I was looking through their API docs and it seems so complex to just get something up and running quickly. I don't want to create a full blown app, I just want something simple that will help me do some research.
Am I overthinking this and it should be easy to do via their API (Ruby preferably) ?
I also don't mind it being run locally, and spitting out a text file or a csv file - but also if there is a nice way to have it spit out a nicely formatted HTML page that would be good too.
I just want to get at the data, that's all.
Your best bet is going to be using the GET users/search API method. You can search on "rails" and page through the results discarding any users who don't match your followers/status requirements. It isn't going to be perfect but in general Twitter tries to return popular/relevant users first.

Resources