https://github.com/nlpodyssey/gdelt
https://github.com/nlpodyssey/gdelt
Last synced: 7 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/nlpodyssey/gdelt
- Owner: nlpodyssey
- License: apache-2.0
- Created: 2023-12-03T10:28:14.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-01-08T09:41:02.000Z (almost 2 years ago)
- Last Synced: 2025-01-15T22:21:00.698Z (9 months ago)
- Language: Go
- Size: 14.6 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# GDELT Fetcher
## Overview
This package provides tools for fetching and parsing the latest GDELT events data in Go.## Installation
To use this package, import it into your Go project:```console
go get -u github.com/nlpodyssey/gdelt
```## Example
```go
package mainimport (
"fmt"
"time""github.com/nlpodyssey/gdelt"
"github.com/rs/zerolog/log"
)func main() {
log.Info().Msg("getting latest GDELT events")events, err := gdelt.FetchLatestEvents(gdelt.DefaultOpts)
if err != nil {
log.Fatal().Err(err).Msg("error fetching latest events")
}log.Info().Msgf("processing %d events", len(events))
for _, event := range events {
doc := struct {
EventID uint64
URI string
Headline string
ImageURI string
PublishedAt time.Time
}{
EventID: event.GlobalEventID,
URI: event.SourceURL,
Headline: event.GKGArticle.Extras.PageTitle,
ImageURI: event.GKGArticle.SharingImage,
PublishedAt: event.PublishedAt(),
}fmt.Printf("%+v\n", doc)
}
}
```## Contributions
Contributions to this package are welcome.
## License
This project is licensed under the [Apache License, Version 2.0](LICENSE).