Skip to content

A dot.net instant answer library written in C# for the DuckDuckGo Search API

License

Notifications You must be signed in to change notification settings

timkly/DuckDuckGo.Net

Repository files navigation

DuckDuckGo.Net

A DotNet instant answer library written in C# for the DuckDuckGo Instant Answer API

Access the DuckDuckGo API with [C#].

Version 1.0.1

Requirements

Target framework - 4 Target Test framework - 4.5 (not required for production release)

System.Web to be referenced if using .Net client profile option

Installation

To install, download project and reference the DuckDuckGo.Net library in your project

Via GitHub

Via [NuGet] (https://www.nuget.org/packages/DuckDuckGo.Net/)

Nuget Console:

PM> Install-Package DuckDuckGo.Net

Usage

Once you have referenced the library in your project, ensure you include a using reference in the file which will be consuming it

using DuckDuckGo.Net;

Create a new instance of the DuckDuckGo Search using the default settings

var search = new Search();

Create a new instance of the DuckDuckGo Search using custom settings during initialisation (all settings shown).

var search = new Search
{
    NoHtml = true,
    NoRedirects = true,
    IsSecure = true,
    SkipDisambiguation = true,
    ApiClient = new HttpWebApi()
};

Settings may also be configured after initialisation but before the query is performed

search.NoHtml = false;
search.ApiClient = new FileApi();

Perform a query and return the result as a SearchResult object

var searchResult = search.Query("apple", ApplicationName);

Perform a query and return the result as a JSON formatted string

var jsonString = search.TextQuery("apple", ApplicationName, ResponseFormat.Json);

Perform a query and return the result as a XML formatted string

var xmlString = search.TextQuery("apple", ApplicationName, ResponseFormat.Xml);

Contact

Github - timkly

Twitter - @timkly

LICENSE

MIT LICENSE--see file /LICENSE

This project has no affiliation with the company DuckDuckGo.

About

A dot.net instant answer library written in C# for the DuckDuckGo Search API

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages