diff options
| author | Philipp Tanlak <philipp.tanlak@gmail.com> | 2023-08-17 20:18:55 +0200 |
|---|---|---|
| committer | Philipp Tanlak <philipp.tanlak@gmail.com> | 2023-08-17 20:18:55 +0200 |
| commit | 8f55226a53682f9f4a0b63778b3338451605a6c3 (patch) | |
| tree | d435e924de369cebbbe66449f2cd82f79b6c0300 /scrape.go | |
| parent | 5e2b1d1dc902ba53fc537b31e835d82c0e55dfb6 (diff) | |
add timestamp
Diffstat (limited to 'scrape.go')
| -rw-r--r-- | scrape.go | 18 |
1 files changed, 10 insertions, 8 deletions
@@ -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) |