First pass through Windows Live™ Search Web Service API

Published Thu, Feb 15 2007 6:24 | William

So far, I've done nothing too impressive with this.  I got sick of SSRS, I guess the Miami Vice Bikini girl just got me distracted.  Anyway, as most of my family and co-workers know, I've been working on the CuckooBot for a while now, much to their dismay.  Something about Response bots and Women (like my Mom and Girlfriend) just don't mix.  So the Cuckoobot is getting close to full completion and I'll be releasing him into the wild shortly.  

CuckooBotTablet is the next incarnation and well, he's still in his egg as far as development goes. It's too late to get really into it but the goal is to speak a series of words and criteria into the tablet, go to work, and return home to accurate results.  I'm very behind schedule on this so far... but With enough boredom and ephedrine+, anything's possibly.

 

Ok, just a little to get you through the hurdles...

If you're running VISTA and Windows Firewall, this secure by annoyance feature will prompt you each time you make the call to the service - trust me, go into control panel and just open the port - otherwise this annoyance will keep bothering you over and over and over and over and over and over and over and over

 

MSNSearchService CuckooBotTablet = new MSNSearchService();
SearchRequest LiveRequest = new SearchRequest();
SourceRequest[] LiveReqs = new SourceRequest[1];
LiveReqs[0]=new SourceRequest();
LiveReqs[0].Source = SourceType.Web;
LiveRequest.AppID = "YOU_NEED_YOUR_OWN"
LiveRequest.CultureInfo = "en-US"
LiveRequest.SafeSearch = SafeSearchOptions.Off;
LiveRequest.Requests = LiveReqs;
LiveRequest.Query = "inlineASP.com" //ATM
SearchResponse LiveResults = CuckooBotTablet.Search(LiveRequest);
Result[] LiveOutput = LiveResults.Responses[0].Results;
foreach (Result singleResult in LiveOutput)
{
    Debug.WriteLine(singleResult.Description);
    Debug.WriteLine(singleResult.Title);
    Debug.WriteLine(singleResult.Summary);
}

 

 

 The next thing you need to do is create an application id and replace it in the AppID field....directions to pull that off are provided here.

Also, be careful with the SafeSearchOptions.  I'd recommend that they be set to Strict unless you are specifically looking for something you know is a little out there.  As I've found too many times with this sort of thing, be careful what you ask for, b/c it usually overdelivers. You'd be amazed at how seemingly innocuous words like CamelToe or ATM can return such inappropriate stuff.

Be congnizant to the SourceType Enumeration Value you use as well. In this case, I used SourceType.Web. There are many more, with amazingly pragmatic and useful ones like .Spelling.

These are the main issues that will cramp your style up front.  vNext of the CuckooBotTablet will search images and return them.  Considering alll the new found fans I have lately that care sooooo much about the content of my posts, I'll make triple sure SafeSearch is on - wouldn't want to offend any of the "Inappropriate for community site" robots or impede them from taking their marching orders.

I'm going off to bed now and letting a few of the other functions run. Hopefully results will be impressive (and will no doubt wolf down my bandwidth) and I'll have something to report back shortly.

Comments

# CuckooBotSwatter said on February 18, 2007 8:19 PM:

What's this I hear about a Miami Vice Bikini girl? And a CuckooBot Tablet? Does the world REALLY need another CuckooBot, Bill? Oh brother, better get out my broom...!

Signed,

She Who Swats the Cuckoo Bot, aka HP :-)

# Bill said on February 18, 2007 11:19 PM:

Do you know how to make a CSS sheet that will change all the text of my blog to something innocuous when the IP Address is recognized as a family member?  I'm going to have to write a HTTPModule to do it before I get myself in trouble

Search

This Blog

Tags

Community

Archives

News

My other sites

Cool Stuff

Book Stuff

Security

ORM

Data Access

Funny Stuff

Compact Framework Stuff

Web Casts

My KnowledgeBase Articles

My MVP Profile

Design Patterns

Performance

Debugging

Remoting

My Fellow Authors

My Books

LINQ

Misc

Speech

Syndication

Email Notifications