goduckgo

package module
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2021 License: MIT Imports: 7 Imported by: 0

README

DuckDuckGo-image-api

This project is Go adaptation of Python3 forked duckduckgo-image-api . I made this modules because this module will be need in my future project .

Contribution are always welcome

How to use

Import

Example Use Cases

Get Search Results
func main() {
	hunsen := goduckgo.Search(goduckgo.Query{Keyword: "duck"})
    fmt.Print(hunsen.Results)
}

Get Search Result Image
func main() {
	hunsen := goduckgo.Search(goduckgo.Query{Keyword: "duck"})
	for _, somtam := range hunsen.Results {
        // This Can be use with all hunsen.Results(or anything.Results depending on your goduckgo.Search)
        // e.g. Title or URL depending on what you want 
		fmt.Println(somtam.Image)
	}
}
Specific P and S
func main() {
	hunsen := goduckgo.Search(goduckgo.Query{Keyword: "duck", P: "1", S: "200"})
    fmt.Print(hunsen.Results)
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Gogo

type Gogo struct {
	Ads          interface{} `json:"ads"`
	Next         string      `json:"next"`
	Query        string      `json:"query"`
	QueryEncoded string      `json:"queryEncoded"`
	ResponseType string      `json:"response_type"`
	Results      []struct {
		Height    int    `json:"height"`
		Image     string `json:"image"`
		Source    string `json:"source"`
		Thumbnail string `json:"thumbnail"`
		Title     string `json:"title"`
		URL       string `json:"url"`
		Width     int    `json:"width"`
	} `json:"results"`
}
func Search(keyword Query) Gogo

Hit duckduckgo for results NOTE: this module for now can only get p=1 s=0 results

type Query

type Query struct {
	Keyword, P, S string
}

Jump to

Keyboard shortcuts

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