In the process of working on GMemory, a Silverlight 2 game I wrote as an exercise a couple of weeks back, I became familiar with Google’s RESTful webservice API. Using this API applications can execute searches and receive results back. The API is not a complete drop-in replacement for the full-blown Google search engine – it can produce at most 64 results (8 items per page over 8 pages), for example – but it is an interesting and useful way to incorporate search results into your applications. Results come back in the form of some nested JSON types, which are easily deserialized into .NET classes once you understand the structure and get the type definitions correct. I had to do that for image searches to make GMemory work, so once that was done I decided to go ahead and implement the rest of the search types as well.
The result is GSearch, a library of classes for searching Google from .NET 3.5 and Silverlight 2 managed code. The library encompases all the supported search types on the current version of the Google API, meaning blogs, books, images, locations, news, patents, video, and web pages. The classes are very easy to use, and you’ll find some examples in the readme files accompanying the runtime packages. The .NET distribution also includes GSearchPad, a WPF example program that will allow you to execute any of the search types with custom arguments and display the results.
GSearch is copyrighted software released under a BSD Permissive license. Feel free to play around with it and use it in your own commercial or noncommercial apps. This is the first release, and there are sure to be some warts left in it. If you find one, or have a question, please feel free to drop a comment here or shoot me an email.