Want to stay on top? Ruby Weekly is a once-weekly e-mail newsletter covering the latest Ruby and Rails news.
     Feed Icon

BOSSMan: Build Your Own Search Engine With Yahoo And Ruby

By Peter Cooper / August 20, 2008

yahooboss.gifRecently, Yahoo! launched BOSS - the "Build Your Own Search Service." In all but name, it appears very similar to their older Yahoo! Search API, as it allows you to query Yahoo's search index programatically. Under the surface though, Yahoo has removed the 5,000 query per day limit, you're unrestricted in how you present the data returned, you can re-order the data, and no attribution is required.

For Rubyists ready to play with BOSS, Jay Pignata has developed BOSSMan, a library for interacting with the Yahoo! BOSS Web service. Either get it with Git or install with RubyGems like so:

gem sources -a http://gems.github.com
gem install jpignata-bossman

Once you've got the library, make sure you've got an application ID from Yahoo (this is unavoidable, alas) and then you can start to play:

require 'rubygems'
require 'bossman'
include BOSSMan

BOSSMan.application_id = "Your Application ID here"

news = BOSSMan::Search.news("Barack Obama", 0, 3)
news.results.each do |result|
  puts "#{result.title} [from #{result.source}]"
end 

BOSSMan supports Web, news, and image searches out of the box. You can dump to JSON, XML, or YAML and access all of the relevant attributes through methods. Superb!

This post supported by Notifixious - Notifixious - a new notification service startup based in San
Francisco - needs a Rails expert to become its CTO! Knowledge of messaging technologies (XMPP) and REST API development is a must. You can learn more here.

Comments

  1. Jeremy Pinnix says:

    Excellent work Jay! It works really well.

  2. yestoall says:

    great

    something similar that works with google?

Other Posts to Enjoy

Twitter Mentions