Skip to content

Struki84/ddgo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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)
	}
}

About

Wrapper around DuckDuckGo search engine

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages