1) BOSS (Build Your Own Search Service) is a Yahoo API that allows developers to build custom search applications and services by accessing Yahoo's search index and data through a RESTful API.
2) The API can be used to search the web, images, news and other sources. It returns search results in JSON or XML format that can be displayed however the developer wants.
3) Examples are provided showing how to use the BOSS API from JavaScript to dynamically search terms and display results, as well as examples using other programming languages and frameworks. Additional features and enhancements to the BOSS API are also highlighted.
Report
Share
Report
Share
1 of 87
Download to read offline
More Related Content
Finding things on the web with BOSS
1. Finding things on the
web with BOSS
Christian Heilmann | http://wait-till-i.com | http://scriptingenabled.org
Open Hack Day 2009 - Bangalore, India
4. In the best of all cases this
means that it gets easier for
the person using a product
to reach a goal.
5. This can be achieved by
connecting several different
products and turning them
into one. (pssst... Mashup).
6. I’ve seen this followed
cleverly on several levels
here in India.
8. BOSS is your chance to make
the web an easier to navigate
space.
9. You can help us turn a search
engine into a find engine.
10. Web search is broken!
http://luckyrobot.com/2009/02/06/search-is-broken-%E2%80%93-really-broken/
http://www.borthwick.com/weblog/2009/02/05/creative-destruction-google-slayed-by-the-notificator/
11. Back in the
days the
web was
small and
largely static
documents.
12. Nowadays it
is huge and
its content
and the
publication
speed
increased a
lot.
13. This is one challenge of
search engines these days.
29. The REST API:
boss.yahooapis.com/ysearch/{type}/v1/
{search}
type is what you want to
search:
web: the interwebs
news: new stuff
images: pictures
30. The REST API:
boss.yahooapis.com/ysearch/{type}/v1/
{search}
search is the term to look for
(url-encoded)
Put “” around terms to ensure the right order, f.e. “donkey
fur” (you don’t want to see cats, do you?)
Filter with a -, f.e. donkey -shrek
Restrict to a site using site:, f.e. donkey site:flickr.com
31. The REST API:
boss.yahooapis.com/ysearch/{type}/v1/
{search}
Other parameters:
appid: your app ID (needed)
count: amount of results
start: where to start the counting
region / lang: country and language
format: xml or json
sites: restrict to certain sites (comma separated)
32. Web search REST API:
boss.yahooapis.com/ysearch/web/v1/{search}
Extra parameters:
filter: To filter out nasties, use filter=-porn-hate
type: to search different types. You can use html, text, pdf,
xl, msword, ppt or groups like msoffice and nonhtml. You
can also do a type=msoffice,-xl
33. Image search REST API:
boss.yahooapis.com/ysearch/images/v1/
{search}
Extra parameters:
filter: no nudies
dimensions: all, small, medium, large, wallpaper,
widewallpaper
refererurl: all images in that url
url: image at that url
34. News search REST API:
boss.yahooapis.com/ysearch/news/v1/{search}
Extra parameters:
age: how old the news are in days. Last five days would be
“5d”
35. There are restrictions how to
display results and
information as to what data
comes back.
36. For this, read the guide!
http://developer.yahoo.com/search/boss/boss_guide/
54. <p>Warning: this is terrible code, USE A LIBRARY INSTEAD!</p>
<ul id=quot;searchesquot;>
<li><a href=quot;http://search.yahoo.com/search?va=donkeysquot;>
Search for Donkeys
</a>
</li>
<li><a href=quot;http://search.yahoo.com/search?va=kittensquot;>
Search for kittens
</a>
</li>
</ul>
<div id=quot;searchresultsquot;></div>
55. <script type=quot;text/javascriptquot; charset=quot;utf-8quot;>
function founddonkeys(o){
var donkeys = o.ysearchresponse.resultset_web;
var results = document.createElement('ul');
for(var i=0,j=donkeys.length;i<j;i++){
var item = document.createElement('li');
var link = document.createElement('a');
var abstract = document.createElement('p');
link.setAttribute('href',donkeys[i].clickurl);
link.innerHTML = donkeys[i].title;
item.appendChild(link);
abstract.innerHTML = donkeys[i].abstract;
item.appendChild(abstract);
results.appendChild(item);
}
var resultsbox = document.getElementById('searchresults');
resultsbox.innerHTML = '';
resultsbox.appendChild(results);
}
var APIkey = 'TX6b4XHV34EnPXW0sYEr51hP1pn5O8KAGs'+
'.LQSXer1Z7RmmVrZouz5SvyXkWsVk-';
var searchlinks =
document.getElementById('searches').getElementsByTagName('a');
for(var i=0;searchlinks[i];i++){
56. var APIkey = 'TX6b4XHV34EnPXW0sYEr51hP1pn5O8KAGs'+
'.LQSXer1Z7RmmVrZouz5SvyXkWsVk-';
var searchlinks = document.getElementById('searches').
getElementsByTagName('a');
for(var i=0;searchlinks[i];i++){
searchlinks[i].onclick = function(){
var searchterm = this.href.split('va=')[1];
var url = 'http://boss.yahooapis.com/ysearch/web/v1/' +
searchterm + '?format=json&' +
'callback=founddonkeys' + '&appid=' + APIkey
var s = document.createElement('script');
s.setAttribute('type','text/javascript');
s.setAttribute('src',url);
document.getElementsByTagName('head')[0].appendChild(s);
return false;
}
}
</script>
58. Using the YUI library (YUI3
JavaScript and CSS grids) you
can easily make this much
cooler:
61. To make using BOSS with
JavaScript easier, I’ve written
a BOSS wrapper called
YBOSS:
http://icant.co.uk/sandbox/yboss/
62. <div id=quot;resultsquot;></div>
<script type=quot;text/javascriptquot; src=quot;yboss-lib.jsquot;>
</script>
<script type=quot;text/javascriptquot;>
YBOSS.get({
searches:'search,news',
query:'obama',
count:10,
callback:seedpics
});
function seedpics(o){
var all = '<h4>Web Sites</h4>' + o.webHTML +
'<h4>News</h4>' + o.newsHTML;
var out = document.getElementById('results');
out.innerHTML = all;
}
</script>
63. For server side code there are
code examples available at:
http://www.saurabhsahni.com/boss-
examples.zip
64. There’s also the Python
mashup framework that
allows for SQL for remixing
arbitrary XML/JSON sources:
http://developer.yahoo.com/search/boss/mashup.html
65. And there’s an easy way to
deploy BOSS apps at Google
App Engine:
http://zooie.wordpress.com/2008/08/04/yahoo-boss-
google-app-engine-integrated/
85. The client side is where
strange things happen.
http://isithackday.com/hacks/web-the-adventure/
86. The motherlode of BOSS
implementations:
http://mashable.com/boss/
http://delicious.com/tag/bossmashup
Add yours by tagging it with
“bossmashup” on Del.icio.us!