Post by Peter Cooper on June 2nd, 2006
Perform Yahoo searches in 2 lines of code

- Getting stock quotes in 1 line of Ruby code
- 21 Ruby Tricks You Should Be Using In Your Own Code
- BOSSMan: Build Your Own Search Engine With Yahoo And Ruby


Step 1: Get the Yahoo-Ruby API. It's only a small Ruby file. Its only dependencies are net/http and REXML that come with Ruby anyway.
Step 2: Make sure you have a Yahoo! API ID. If you don't, get one now.
Step 3: Use a script like this one from O'Reilly's Yahoo! Hacks book. The code can be as simple as this:
obj = WebSearch.new('insert app ID', 'chunky bacon', 'phrase', 10) results = obj.parse_results # results now contains an array of hashes puts results.inspect

Click here to add on del.icio.us








