ddg

package
v0.0.0-...-8261f08 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 20, 2014 License: GPL-3.0 Imports: 6 Imported by: 1

Documentation

Index

Constants

View Source
const (
	Article        = "A"
	Disambiguation = "D"
	Category       = "C"
	Name           = "N"
	Exclusive      = "E"
)

Result Types

View Source
const UrlApi = "api.duckduckgo.com"

Url of the DuckDuckGo API

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Dial   func(network, addr string) (net.Conn, error) // Dialer to use
	UrlApi string                                       // Url to duckduckgo api

	UserAgent string // Useragent used in requests

	Pretty             bool // Return pritty json
	NoHTML             bool // Do not include html in querys
	SkipDisambiguation bool // Skip disambiguation
}

func (*Client) FeelingLucky

func (c *Client) FeelingLucky(searchuqery string) (typ string, text string, err error)

func (*Client) Query

func (c *Client) Query(searchquery string) (r Result, err error)

type Result

type Result struct {
	Abstract       string // Topic summary (can contain HTML, e.g. italics)
	AbstractText   string // Topic summary (with no HTML)
	AbstractSource string // Name of Abstract source
	AbstractURL    string // Deep link to expanded topic page in AbstractSource
	Image          string // Link to image that goes with Abstract
	Heading        string // Name of topic that goes with Abstract

	Answer     string // Instant answer
	AnswerType string // Type of Answer, e.g. calc, color, digest, info, ip, iploc, phone, pw, rand, regexp, unicode, upc, or zip (see goodies & tech pages for examples).

	Definition       string // Dictionary definition (may differ from Abstract)
	DefinitionSource string // Name of Definition source
	DefinitionURL    string // Deep link to expanded definition page in DefinitionSource

	RelatedTopics []struct {
		Result   string // HTML link(s) to related topic(s)
		FirstURL string // First URL in Result

		Icon struct {
			URL    string      // URL of icon
			Height interface{} // Height of icon (px)
			Width  interface{} // Width of icon (px)
		}

		Text string // Text from first URL
	}

	Results []struct {
		Result   string // HTML link(s) to external site(s)
		FirstURL string // First URL in Result

		Icon struct {
			URL    string      // URL of icon
			Height interface{} // Height of icon (px)
			Width  interface{} // Width of icon (px)
		}

		Text string // Text from FirstURL
	}

	Type     string // Response category, i.e. A (article), D (disambiguation), C (category), N (name), E (exclusive), or nothing.
	Redirect string // !bang redirect URL
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL