MGBrown.com Hunk

MGBlog

Wednesday, 02 March 2005

Wed, 02 Mar 2005 - 07:36pm (GMT+0)
Comments

Yahoo! Search Web Service API C# Example

Yahoo! Search has recently published a web service. Sadly, they did not implement it using SOAP and there is no .Net example in their download. Fear not though as I have done the dirty work for you and posted a C# example on my Downloads page.

I don't claim it is perfect, but it is not far off.

Comments

Re: Yahoo! Search Web Service C# Example

There was one small mistake in this when I originaly posted. This is now fixed, just download again to get the fixed code.

The adult_ok and similar_ok parameters take the values 0 and 1 not true and false. As a result I had to change the code to look like this:

adultOk ? "1" : "0", similarOk ? "1" : "0"

It is interesting to note that the C# String.Format has no easy way of doing this I would have liked to put the following in the format string:

"adult_ok={n:1;0}&similar_ok={n:1;0}"

Re: Yahoo! Search Web Service API C# Example

Thanks, I use it for my portal, in complement of Google API. I just add code to support proxy.

Just after "public class YahooSearchService {" :

public WebProxy Proxy {
get { return _proxy; }
set { _proxy = value; }
}
protected WebProxy _proxy;

Then, after each "HttpWebRequest request = (HttpWebRequest)WebRequest.Create(requestUri);" :

if (_proxy != null) {
request.Proxy = _proxy;
}

Re: Yahoo! Search Web Service API C# Example

I found a small mistake in the Yahoo.API.NewsSearchResponse. A "&" is missing in the requestUri just before the result parameter. The result number is then always 10 no matter wich paramteter is passed to the function.

Anyway you have done a very useful job. Thank u.

Re: Yahoo! Search Web Service API C# Example

Thanks for that. This also affected the Video search. I have now posted corrected zip files.

Re: Yahoo! Search Web Service API C# Example

ur work is very useful

Re: Yahoo! Search Web Service API C# Example

Great stuff. As an FYI, there is now als an API to use for TermExtraction:
http://developer.yahoo.net/content/V1/termExtraction.html

Due to your excellent examples, this was very simple to add!

If you need some inspiration as to what is possible with this API, the peopel that build http://www.tagcloud.com used it

Re: Yahoo! Search Web Service API C# Example

Great to see someone built an example in C#/VB.NET - should definitely be posted on Yahoo! somewhere!!! Wouldn't have had to spend an hour looking around for it ;)

How to create the response cs files from XSD

Hi,

I liked the examples, it is the only one example to demonstrate how to create REST requests and comprehend corresponding responses in C#.net. I have one clarification, how did you create the .cs files from XSD files.

I have not found out how to use the XSD tool to accomplish the job !!

Re: Yahoo! Search Web Service API C# Example

send the sample code if any one knows yahoo api in c#

Re: Yahoo! Search Web Service API C# Example


Hi,

I have downloaded this API and trying to run it I always get this error in Visual IDE.

"WebException was handled, Unable to connect to remote server."

I have got the appID and using that ID in the code. Could you please let me know what am I doing wrong.

Thanks
Lipi

email: lipi.sarkar@vebra.com

Re: Yahoo! Search Web Service API C# Example


Lipi,

This normally just indicates that the application can not make an internet connection with Yahoo's servers.

This can be caused by a number of things including fire wall settings, network outages and DNS outages.

The best way to confirm if this is infact the cause is to open up internet explorer and enter the web address of the service you wish to use in the address bar. This should confirm if the issue is with your application or your internet connection.

One exception to this is if you are using a software firewall. These can often give different connection privilages depending upon the exe being run.

Let us know if this helps.

Martin

Re: Yahoo! Search Web Service API C# Example


This is awesome! One question though. When I type in foreign characters, the program bombs. Any suggestions???

Re: Yahoo! Search Web Service API VB Example


thanks,

you just saved me a pile of work. Most grateful.

regards

Mick

Re: Yahoo! Search Web Service API C# Example


I will like to know, how to search a database using C#. To display results similar with the search

Add Your Comment

Your Name:
Harry Potter
Your homepage URL (optional):  
http://www.mgbrown.com
Title:*
Comment:*
Copy code into box:
 
* HTML tags not supported