Skip to content
/ adstxt Public

Quickly and correcty fetch and parse ads.txt files with Go.

Notifications You must be signed in to change notification settings

ayang64/adstxt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 

Repository files navigation

adstxt

Implements the ads.txt spec described at the link below:

https://iabtechlab.com/ads-txt/

The spec is pretty simple. This package simlpy parses the ads.txt file.

Quick Start

package main

import (
	"github.com/ayang64/adstxt"
	"log"
	"time"
)

func main() {

	ctx, cancel := context.WithTimeout(context.Background, time.Millisecond*500)
	defer cancel()

	ads, err := adstxt.Fetch(ctx, "https://www.example.com/ads.txt", "https://www.example2.com/ads.txt")

	if err != nil {
		log.Printf("error: %v", err)
		return
	}

	log.Printf("ads: %#v\n", ads)
}

TODO

Finish code to asynchronously fetch ads.txt files with cancellation.

About

Quickly and correcty fetch and parse ads.txt files with Go.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages