Reputation: 2255
Say I wanted to create a ruby script that would access google, search for 'dogs', and then return the links of the top 5 results. How would this be implemented in ruby? Thanks.
To clarify, I'm not looking for a way to search Google specifically. I want this to work on other sites too, such as amazon.com, dictionary.com, etc.
Upvotes: 0
Views: 203
Reputation: 26210
See the answer to this question: Using Google Search REST API in Ruby
Upvotes: 1
Reputation: 9577
You could hack through it with hpricot, if a google api doesn't exist already. Or here is a script
Upvotes: 0
Reputation: 26997
I would use cURL to actually GET the page contents (its a simple GET request to google.com/?q=stuff). Then you'll need to use regular expressions and intuition to parse the DOM, extract the links, and display :)
Upvotes: 0