Documentation
¶
Overview ¶
Package reuters is the library behind the reuters command: the HTTP client, feed URL resolution, and RSS parsing for Reuters news.
The client fetches RSS feeds from the public Reuters agency endpoint at https://www.reutersagency.com. No authentication is required. It sets a real User-Agent, paces requests, and retries transient 429/5xx errors with exponential backoff.
Index ¶
Constants ¶
const DefaultUserAgent = "reuters/dev (+https://github.com/tamnd/reuters-cli)"
DefaultUserAgent identifies the client to Reuters.
const Host = "www.reuters.com"
Host is the Reuters site this client represents.
Variables ¶
var ErrUnknownSection = errors.New("unknown section")
ErrUnknownSection is returned when an unknown section name is requested.
Functions ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client fetches Reuters RSS feeds.
type Config ¶
type Config struct {
BaseURL string
UserAgent string
Rate time.Duration
Retries int
Timeout time.Duration
}
Config holds constructor parameters.
type Domain ¶ added in v0.1.1
type Domain struct{}
Domain is the reuters kit driver. It carries no state; the per-run Client is built by the factory Register hands kit.
func (Domain) Info ¶ added in v0.1.1
func (Domain) Info() kit.DomainInfo
Info describes the scheme, the hostnames a pasted link is matched against, and the identity reused for the binary's help and version.
type FeedItem ¶
type FeedItem struct {
Name string `json:"name" kit:"id" table:"name"`
URL string `json:"url" table:"url,url"`
}
FeedItem is the rendered record for the feeds command.
type Item ¶
type Item struct {
Title string `json:"title"`
Link string `json:"link"`
Description string `json:"description"`
PubDate string `json:"pub_date"`
}
Item is the public record emitted for each news article.
type NewsItem ¶
type NewsItem struct {
Rank int `json:"rank" table:"rank"`
Title string `json:"title" kit:"id" table:"title"`
Summary string `json:"summary" table:"summary"`
Date string `json:"date" table:"date"`
URL string `json:"url" table:"url,url"`
Section string `json:"section" table:"section"`
}
NewsItem is the rendered record for the news command.