Christian Heilmann

Posts Tagged ‘BOSS’

Yahoo BOSS keyword extraction API wrappers (JS/PHP)

Thursday, November 13th, 2008

One of my favourite “old school” Yahoo APIs is the term extractor which is a service that extracts relevant keywords from a text you give it.

Yahoo BOSS is now supporting this feature for indexed web sites. While you’d normally just get a list of sites with for example:

http://boss.yahooapis.com/ysearch/web/v1/donkeys?format=xml&appid={appid}

You can get the keywords for each of the pages returned by adding the (so far undocumented) view=keyterms parameter:

http://boss.yahooapis.com/ysearch/web/v1/donkeys?format=xml&view=keyterms&appid={appid}

This can be pretty useful to get a list of keywords related to a certain term.

In order to do this, I’ve written a small API in PHP and JavaScript that gets you the related terms from the first ten search results and returns them as an array.

The PHP API wrapper

The PHP version takes three parameters: the mandatory term to search for, an optional callback method name to wrap around the JSON return value and an optional format parameter that can be set to HTML to return an HTML list instead of a JSON object.

The JavaScript API wrapper

The JavaScript wrapper uses dynamically generated script nodes to retrieve the data and can be used by simply calling a BOSSTERMS.get() method with a search term and the name of a callback method. The return object has a term property, the keywords as an array and a string that is an HTML list of the terms.

Get the lot

You can download the whole BOSS keyword API here. As always, it is BSD licensed, so go nuts using it :)

Making Yahoo BOSS easier with yboss

Monday, November 10th, 2008

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:



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:

[slideshare id=733718&doc=javascript-and-boss-open-hack-day-brazil-2907&w=425]

Unsafe Search – playing with BOSS and YUI3

Tuesday, October 21st, 2008

As I am giving some presentations on YUI3 and BOSS tomorrow I thought I give them a whirl and see what I can come up with. I remembered my esteemed colleague Neil Crosby joking about the idea of an “unsafe search” – take a search result and diff it with the safe search result (adult filters enabled) and you will only get the unsafe results.

Well, BOSS allows you to set filters on the data you get back, this was not too hard to do. I give you Unsafe Search