BOSS (Build your Own Search Service)

Install


sudo gem install boss

Examples


require ‘boss’

boss.appid = ‘Bossdemo’ # Set the BOSS appid to what Yahoo assigned you.

count=“10” start=“0” totalhits=“8775”deephits=“8775”

image_example = boss.images.new(‘soccer’, :count => 30) # Sets a new images resultset of 30 matching ‘soccer’. image_example.resultset.each do |r| # Gets current images resultset.

r.abstract # Now we don't know Crawford from Adam but he's a good friend of WCP-occasional-contributor Beans and he somewhat has a point, or at least made us laugh while making it.
r.clickurl # http://us.lrd.yahoo.com/_ylc=X3oDMTFkNXVldGJyBGFwcGlkA2Jvc3NkZW1vBHBvcwMwBHNlcnZpY2UDWVNlYXJjaARzcmNwdmlkAw --/SIG=12f47a1hh/**http%3A//wickedchopspoker.blogs.com/my_weblog/images/why_men_love_soccer.jpg
r.date # 2006/06/09
r.filename # why_men_love_soccer.jpg
r.format # jpeg
r.height # 213
r.mimetype # image/jpeg
r.refererclickurl # http://wickedchopspoker.blogs.com/my_weblog/2006/06/world_cup_musin.html
r.refererurl # http://wickedchopspoker.blogs.com/my_weblog/2006/06/world_cup_musin.html
r.size # 31500
r.thumbnail_height # 120
r.thumbnail_url # http://re3.yt-thm-a01.yimg.com/image/25/m7/3979077535
r.thumbnail_width # 130
r.title # why_men_love_soccer.jpg
r.url # http://wickedchopspoker.blogs.com/my_weblog/images/why_men_love_soccer.jpg
r.width # 230

end image_example.nextpage # Returns string for next images resultset.

news_example = boss.news.new(‘soccer’) # Sets a new news resultset matching ‘soccer’. news_example.resultset.each do |r| # Gets current news resultset.

r.abstract # June 16 (Bloomberg) -- Adidas AG , the world's second - largest sporting-goods maker, will ``clearly exceed'' its full-year sales target for soccer-related goods and gain share in all major markets, Chief Executive Officer Herbert Hainer said.
r.clickurl # http://www.bloomberg.com/apps/news?pid=20601100&sid=aSSf0jMZtvBU
r.date # 2008/06/16
r.language # en english
r.source # Bloomberg.com
r.sourceurl # http://www.bloomberg.com/
r.time # 14:21:15
r.title # Adidas Will `Clearly Exceed' Soccer Sales Target, Hainer Says
r.url # http://www.bloomberg.com/apps/news?pid=20601100&sid=aSSf0jMZtvBU

end news_example.nextpage # Returns string for next news resultset.

spelling_example = boss.spelling.new # Sets a new spelling resultset. spelling_example.resultset.each do |r| # Gets current spelling resultset.

r.query # monkeys+giraffes
r.suggestion # monkeys giraffes

spelling_example.nextpage # Returns string for next spelling resultset.

web_example = boss.web.new # Sets a new web resultset. web_example.resultset.each do |r| # Gets current web resultset.

r.abstract # <![CDATA[World <b>soccer</b> coverage from ESPN, including Premiership, Serie A, La Liga, and Major League <b>Soccer</b>. Get news headlines, live scores, stats, and tournament information.]]>
r.clickurl # http://us.lrd.yahoo.com/_ylc=X3oDMTFkNXVldGJyBGFwcGlkA2Jvc3NkZW1vBHBvcwMwBHNlcnZpY2UDWVNlYXJjaARzcmNwdmlkAw--/SIG=10u3e8260/**http%3A//www.soccernet.com/
r.date # 2008/06/08
r.dispurl # <![CDATA[www.<b>soccernet.com</b>]]>
r.size # 94650
r.title # ESPN Soccernet
r.url # http://www.soccernet.com/

end web_example.nextpage # Returns string for next web resultset.

Universal Arguments (Image, News, Spelling, and Web)


:callback => ‘foobar()’ # Name of callback function to wrap result.

:count => 10 # Total results to return. Maximum: 50.

:lang => ‘en’, :region => ‘us’ # Specifies the language and region (country) search product to query.

http://developer.yahoo.com/search/boss/boss_guide/supp_regions_lang.html

:sites => ‘abc.com, cnn.com’ # Restrict to certain site(s). Note: Images do not yet support multiple sites.

:start => 0 # Ordinal position of first result.

Image Arguments


:dimensions => # Only images of certain size.

'all' # Default
'small' # Small images are generally thumbnail or icon sized.
'medium' # Medium sized images are average sized; usually not exceeding an average screen size.
'large' # Large images are screen size or larger.
'wallpaper'
'widewallpaper'

:filter => # Offensive Content Reduction filter.

'no' # 
'yes' # Default, content marked as offensive is omitted.

:refererurl => ‘foo.com’ # Only image objects with this referring URL.

:url => ‘’ # Exact image result.

News Argument


:age => ‘7d’ # String of integer and one of letters “s”, “m”, “h”, “d” and “w” (seconds, minutes, hours, days and weeks)

Web Arguments


:filter => # Filter out adult or hate content.

'-hate' # U.S. only.
'-porn'
'-hate, -porn' # U.S. only.

:type => # Specifies document formats (pdf, msoffice,etc).

'html'
'pdf' # Adobe Portable Document Format
'msoffice' # xl, msword, ppt
'msword' # Microsoft Word
'nonhtml' # text, pdf, xl, msword, ppt
'ppt' # Microsoft Power Point
'text'
'xl' # Microsoft Excel: xls, xla, xl
'msoffice, -ppt' # Specify a format group then exclude an item.
'html, msoffice, -pdf' # Combine inclusion, exclusion, document types, and type groups.

:view => ‘keyterms’ # Retrieve related words and phrases for each search result.