From 8f55226a53682f9f4a0b63778b3338451605a6c3 Mon Sep 17 00:00:00 2001 From: Philipp Tanlak Date: Thu, 17 Aug 2023 20:18:55 +0200 Subject: add timestamp --- scrape.go | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'scrape.go') diff --git a/scrape.go b/scrape.go index 793e418..ac75c73 100644 --- a/scrape.go +++ b/scrape.go @@ -25,10 +25,11 @@ type ScrapeOptions struct { } type ScrapeResult struct { - URL string `json:"url"` - Data any `json:"data,omitempty"` - Links []string `json:"-"` - Error error `json:"error,omitempty"` + URL string `json:"url"` + Data any `json:"data,omitempty"` + Links []string `json:"-"` + Error error `json:"error,omitempty"` + Timestamp time.Time `json:"timestamp"` } type ( @@ -96,10 +97,11 @@ func (s *Scraper) Scrape() <-chan ScrapeResult { go func() { for res := range results { scraperesults <- ScrapeResult{ - URL: res.url, - Data: res.data, - Links: res.links, - Error: res.err, + URL: res.url, + Data: res.data, + Links: res.links, + Error: res.err, + Timestamp: time.Now().UTC(), } } close(scraperesults) -- cgit v1.2.3