Skip to content

andrei-m/adstxt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

adstxt

GoDoc

ads.txt resolver for Go. This implementation is based on v1.03 of the ads.txt spec as published by the IAB Tech Lab.

Examples

Resolve ads.txt from a domain using the default HTTP client:

adstxt, err := adstxt.DefaultResolve("www.example.com")

Customize the HTTP client. Consider using this package's CheckRedirect function, because it implements the IAB-specified external redirect rules.

client := &http.Client{
	Timeout: 1 * time.Minute,
	CheckRedirect: adstxt.CheckRedirect,
}
adstxt, err := adstxt.Resolve(client, "www.example.com")

Parse ads.txt data without making an HTTP request

rawAdsTxt := strings.NewReader(`# comment
foo,bar,DIRECT,baz
three,four,RESELLER`)
adstxt, err := adstxt.Parse(rawAdsTxt)

See the GoDoc link for a description of the parsed ads.txt format.

About

ads.txt resolver for Go

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages