Google Search API for .NET 0.1 alpha 5

Google Search API for .NET is a part of Google APIs for .NET.

This project will provides simple, unofficial, .NET Framework APIs for using Google Ajax RestFULL APIs (Search API, Language API etc.)

The Google Translate API for .NET will also be a part of it (Indeed I have just released a new version there).

Now it support the Google Web Search API ,Google News Search API, Google Blog Search API and Google Video Search API.

I’ll add the support of all Google Search APIs(GwebSearch, GlocalSearch, GvideoSearch, GblogSearch, GnewsSearch, GbookSearch, GimageSearch, GpatentSearch) in the future.

Google Search API for .NET 0.1 alpha 5

Description:

Provides a simple, unofficial, .NET Framework API for using Google Ajax Search API service.

Feature:

  • Now support the Google Web Search API ,Google News Search API, Google Blog Search API, Google Video Search API and Google Book Search API.
  • CLS compatible. It can be used by any .NET languages (VB.NET, C++/CLI etc.)

Required:

  • .NET Framework 2.0 or newer version.

Example:

Google Web Search:

class Example
{
    public static void Main()
    {
        // Search 32 results of keyword : "Google APIs for .NET"
        IList<IWebResult> results = GwebSearcher.Search("Google API for .NET", 32);
        foreach(IWebResult result in results)
        {
            Console.WriteLine("[{0}] {1} => {2}", result.Title, result.Content, result.Url);
        }
    }
}

Google News Search:

class Example
{
    public static void Main()
    {
        // Search 16 results of keyword : "Olympic", local : "Beijing"
        IList<INewsResult> results = GnewsSearcher.Search("Olympic", 16, "Beijing");
        foreach(INewsResult result in results)
        {
            Console.WriteLine("[{0}, {1} - {2:d}]{3} => {4}", result.Publisher, result.Location, result.PublishedDate, result.Title, result.Url);
        }
    }
}

Google Blog Search:

class Example
{
    public static void Main()
    {
        // Search 32 results of keyword : "Coldplay"
        IList<IBlogResult> results = GblogSearcher.Search("Coldplay", 32);
        foreach(IBlogResult result in results)
        {
            Console.WriteLine("[{0} - {1:d} by {2}] {3} => {4}", result.Title, result.PublishedDate, result.Author, result.Content, result.BlogUrl);
        }
    }
}

Google Video Search:

class Example
{
    public static void Main()
    {
        // Search 32 results of keyword : "South"
        IList<IVideoResult> results = GVideoSearcher.Search("South Park", 32);
        foreach(IVideoResult result in results)
        {
            Console.WriteLine("[{0} - {1} seconds by {2}] {3} => {4}", result.Title, result.Duration, result.Publisher, result.Content, result.Url);
        }
    }
}

Google Book Search:

class Example
{
    public static void Main()
    {
        // Search 10 result of keyword : "Grimm's Fairy Tales"
        IList<IBookResult> results = GbookSearcher.Search("Grimm's Fairy Tales", 10);
        foreach(IBookResult result in results)
        {
            Console.WriteLine("{0} [by {1} - {2} - {3} pages] {4}", result.Title, result.Authors, result.PublishedYear, result.PageCount, result.BookId);
        }
    }
}

You can download here:

GoogleSearchAPI_0.1_alpha_5.zip

Visite the Google APIs for .NET project for more information.

Tags: , , , , , , , , , ,

3 Responses to “Google Search API for .NET 0.1 alpha 5”

  1. ashok Says:

    This is Ashok Kumar from Olive e-Business Pvt. Ltd. We are using Google search api, according to the documentation available for same the api will return none if a user search for abusive words (like nude) if SafeLevel option of the api is active.

    i am using like but >>SafeLevel.active not working with abuse word

    IList results = GwebSearcher.Search(Convert.ToString(Request.QueryString[“key”]), 50, Google.API.Language.English,SafeLevel.active);

  2. kimi Says:

    Why is the maximum return count is 64?? When you search google through web browser i get thousands of results where as i’m limited to 64 in that API though specifying higher value than 64 in search method of GwebSearchClient class.

    Why?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: