Making Yahoo BOSS easier with yboss

Having had a lot of hackers at the Open Hack Day Brazil get confused on how to use the JavaScript output of Yahoo’s Open Search platform BOSS I’ve spent a short while to write a wrapper library for it. You can now easily search the web, images and news of Yahoo in one go with a few lines of code:

<div id="results"></div>
<script type="text/javascript" src="yboss-lib.js">
</script>
<script type="text/javascript">
YBOSS.get(
  {
    searches:'search,images,news',
    query:'obama',
    count:10,
    callback:seeddata
  }
);
function seeddata(o){
 var all = '<h4>Web Sites</h4>' + o.webHTML + 
              '<h4>News</h4>' + o.newsHTML +
             '<h4>Images</h4>' + o.imagesHTML;
 var out = document.getElementById('results');
 out.innerHTML = all;
}
</script>

The wrapper does all the work for you: creating the different script nodes calling the BOSS API with the right parameters and either returning a JSON object with all the mandatory search data (links in a certain format) or returning a bunch of HTML lists that can be printed out as innerHTML anywhere you like.

Check out the yboss homepage and download the script for yourself. The hackers at the Hack Day loved it and the winning hack in the BOSS category was based on it. Also check out the presentation I’ve given on BOSS at the hack day to learn all about the system itself:

JavaScript and BOSS- Open Hack Day Brazil

JavaScript and BOSS- Open Hack Day Brazil

A quick introduction to the BOSS REST API and how to use it in JavaScript using YUI3. Make sure to also download the code examples: http://icant.co.uk/stuff/bosscodebr.zip

Read "JavaScript and BOSS- Open Hack Day Brazil" with Easy SlideShare

Tags: , , , , , , ,

Leave a Reply

Wait till I come! is the blog of Christian Heilmann , a developer evangelist living and working in London, England. Download vcard.

Feed me, Seymour: Entries (RSS) and Comments (RSS).