Skip to content

Latest commit

 

History

History
49 lines (33 loc) · 779 Bytes

README.md

File metadata and controls

49 lines (33 loc) · 779 Bytes

DuckDuckGo API Query

Small wrapper around DuckDuckGo search API in GoLang. Will return search results based on user input and passed number of wanted results.

Installation

go get https://github.com/Struki84/ddgo

Use the query function to perform a search, define the number of returned results.

results, err := ddgo.Query("2020 FIFA world cup winner?", 10)

Results:

type Result struct {
	Title string
	Info  string
	Ref   string
}

Example

package main

import (
	"github.com/Struki84/ddgo"
)

func main() {

	results, query := ddgo.Query("2020 FIFA world cup winner?", 5)

	for _, result := range results {
		fmt.Printf("\nTitle: %s \nInfo: %s \nReference: %s \n\n", result.Title, result.Info, result.Ref)
	}
}