Documentation
¶
Index ¶
- Constants
- Variables
- func WithHeaders(headers map[string]string) func(*DDGS)
- func WithProxy(proxy string) func(*DDGS)
- func WithSleepDuration(d time.Duration) func(*DDGS)
- func WithTimeout(timeout time.Duration) func(*DDGS)
- type Backend
- type DDGS
- func (d *DDGS) Images(keywords string, region string, safesearch SafeSearchLevel, ...) ([]map[string]interface{}, error)
- func (d *DDGS) News(keywords string, region string, safesearch SafeSearchLevel, ...) ([]map[string]interface{}, error)
- func (d *DDGS) Text(keywords string, region string, safesearch SafeSearchLevel, ...) ([]map[string]string, error)
- func (d *DDGS) Videos(keywords string, region string, safesearch SafeSearchLevel, ...) ([]map[string]interface{}, error)
- type SafeSearchLevel
- type Timelimit
Constants ¶
View Source
const ( ResolutionHigh resolution = "high" ResolutionStandard resolution = "standard" ResolutionAll resolution = "" )
View Source
const ( DurationShort durationTime = "short" DurationMedium durationTime = "medium" DurationLong durationTime = "long" DurationAll durationTime = "" )
View Source
const ( LicenseCreativeCommon licenseVideos = "creativeCommon" LicenseYouTube licenseVideos = "youtube" LicenseAll licenseVideos = "" )
Variables ¶
Functions ¶
func WithHeaders ¶
WithHeaders sets custom headers for the DDGS client
func WithSleepDuration ¶
WithSleepDuration sets the sleep duration between requests for rate limiting
func WithTimeout ¶
WithTimeout sets the request timeout for the DDGS client
Types ¶
type DDGS ¶
type DDGS struct {
// contains filtered or unexported fields
}
func (*DDGS) Images ¶
func (d *DDGS) Images( keywords string, region string, safesearch SafeSearchLevel, timelimit Timelimit, maxResults int, ) ([]map[string]interface{}, error)
Images performs image search on DuckDuckGo
func (*DDGS) News ¶
func (d *DDGS) News( keywords string, region string, safesearch SafeSearchLevel, timelimit Timelimit, maxResults int, ) ([]map[string]interface{}, error)
News performs news search on DuckDuckGo
type SafeSearchLevel ¶
type SafeSearchLevel string
const ( SafeSearchOn SafeSearchLevel = "on" SafeSearchModerate SafeSearchLevel = "moderate" SafeSearchOff SafeSearchLevel = "off" )
type Timelimit ¶
type Timelimit string
const ( // TimelimitDay restricts results to the past day TimelimitDay Timelimit = "d" // TimelimitWeek restricts results to the past week TimelimitWeek Timelimit = "w" // TimelimitMonth restricts results to the past month TimelimitMonth Timelimit = "m" // TimelimitYear restricts results to the past year TimelimitYear Timelimit = "y" // TimelimitAll means no time restriction TimelimitAll Timelimit = "" )
Click to show internal directories.
Click to hide internal directories.