google-search-results-dotnet 1.2.0

Search Results via SERP API. Hash, JSON, and HTML format supported for Google, Bing, Baidu, Google Product and more...

Install-Package google-search-results-dotnet -Version 1.2.0
dotnet add package google-search-results-dotnet --version 1.2.0
<PackageReference Include="google-search-results-dotnet" Version="1.2.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add google-search-results-dotnet --version 1.2.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Google/Bing/Baidu Search Result in Dotnet / CSharp / .Net

Build Status

This Dotnet package is meant to scrape and parse Google or Bing or Baidu results using SerpApi.

This extension is in development. But the code can be re-use for production because the API is already stable.

The following services are provided:

Serp API provides a script builder to get you started quickly.

Feel free to fork this repository to add more backends.

Installation

Install dotnet
I have only tested on OSX only.

Quick start

Search Google (default search engine)

using System;
using GoogleSearchResults;
using System.Net.Http;
using Newtonsoft.Json.Linq;
using System.Collections;
using System.Threading.Tasks;
using System.Text.RegularExpressions;

class Program
{

  static void Main(string[] args)
  {
    // secret api key from https://serpapi.com/dashboard
    String apiKey = "";

    // Localized search for Coffee shop in Austin Texas
    Hashtable ht = new Hashtable();
    ht.Add("location", "Austin, Texas, United States");
    ht.Add("q", "Coffee");
    ht.Add("hl", "en");
    ht.Add("google_domain", "google.com");

    try
    {
      GoogleSearchResultsClient client = new GoogleSearchResultsClient(ht, apiKey);
      JObject data = client.GetJson();

      Console.WriteLine("local coffee shop");
      JArray coffeeShops = (JArray)data["local_results"];
      foreach (JObject coffeeShop in coffeeShops)
      {
        Console.WriteLine("Found: " + coffeeShop["title"]);
      }

      Console.WriteLine("organic result coffee shop");
      coffeeShops = (JArray)data["organic_results"];
      foreach (JObject coffeeShop in coffeeShops)
      {
        Console.WriteLine("Found: " + coffeeShop["title"]);
      }
    }
    catch (GoogleSearchResultsException ex)
    {
      Console.WriteLine("Exception:");
      Console.WriteLine(ex.ToString());
    }
  }
}

This example displays the top 3 coffee shop in Austin Texas found in the local_results.
Then it displays all 10 coffee shop found in the regular google search named: organic_results.

Note: If you like to search with Baidu or Bing.

string engine = "bing"; # baidu
client =  new GoogleSearchResultsClient(ht, apiKey, engine);

TODO

  • [x] Add test
  • [x] Implement all 4 API
  • [x] Enable CI integration
  • [ ] Publish package
  • [ ] Add advanced examples like: https://github.com/serpapi/google-search-results-ruby (wait for user feedback)

Google/Bing/Baidu Search Result in Dotnet / CSharp / .Net

Build Status

This Dotnet package is meant to scrape and parse Google or Bing or Baidu results using SerpApi.

This extension is in development. But the code can be re-use for production because the API is already stable.

The following services are provided:

Serp API provides a script builder to get you started quickly.

Feel free to fork this repository to add more backends.

Installation

Install dotnet
I have only tested on OSX only.

Quick start

Search Google (default search engine)

using System;
using GoogleSearchResults;
using System.Net.Http;
using Newtonsoft.Json.Linq;
using System.Collections;
using System.Threading.Tasks;
using System.Text.RegularExpressions;

class Program
{

  static void Main(string[] args)
  {
    // secret api key from https://serpapi.com/dashboard
    String apiKey = "";

    // Localized search for Coffee shop in Austin Texas
    Hashtable ht = new Hashtable();
    ht.Add("location", "Austin, Texas, United States");
    ht.Add("q", "Coffee");
    ht.Add("hl", "en");
    ht.Add("google_domain", "google.com");

    try
    {
      GoogleSearchResultsClient client = new GoogleSearchResultsClient(ht, apiKey);
      JObject data = client.GetJson();

      Console.WriteLine("local coffee shop");
      JArray coffeeShops = (JArray)data["local_results"];
      foreach (JObject coffeeShop in coffeeShops)
      {
        Console.WriteLine("Found: " + coffeeShop["title"]);
      }

      Console.WriteLine("organic result coffee shop");
      coffeeShops = (JArray)data["organic_results"];
      foreach (JObject coffeeShop in coffeeShops)
      {
        Console.WriteLine("Found: " + coffeeShop["title"]);
      }
    }
    catch (GoogleSearchResultsException ex)
    {
      Console.WriteLine("Exception:");
      Console.WriteLine(ex.ToString());
    }
  }
}

This example displays the top 3 coffee shop in Austin Texas found in the local_results.
Then it displays all 10 coffee shop found in the regular google search named: organic_results.

Note: If you like to search with Baidu or Bing.

string engine = "bing"; # baidu
client =  new GoogleSearchResultsClient(ht, apiKey, engine);

TODO

  • [x] Add test
  • [x] Implement all 4 API
  • [x] Enable CI integration
  • [ ] Publish package
  • [ ] Add advanced examples like: https://github.com/serpapi/google-search-results-ruby (wait for user feedback)

Release Notes

README.md

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
1.2.0 67 7/8/2019