import "hawx.me/code/riviera/feed"
Package feed provides a feed fetcher capable of reading multiple formats into a common structure.
A Database allows the Feed to keep track of items it has already seen before.
NewDatabase returns an empty in-memory database for item keys.
type Feed struct {
// contains filtered or unexported fields
}
This function returns true or false, depending on whether the CacheTimeout value has expired or not. Additionally, it will ensure that we adhere to the RSS spec's SkipDays and SkipHours values. If this function returns true, you can be sure that a fresh feed update will be performed.
Returns the number of seconds needed to elapse before the feed should update.
func (f *Feed) Fetch(uri string, client *http.Client, charset func(charset string, input io.Reader) (io.Reader, error)) (status int, err error)
Fetch retrieves the feed's latest content if necessary.
The charset parameter overrides the xml decoder's CharsetReader. This allows us to specify a custom character encoding conversion routine when dealing with non-utf8 input. Supply 'nil' to use the default from Go's xml package.
The client parameter allows the use of arbitrary network connections, for example the Google App Engine "URL Fetch" service.
If the feed is unable to update (see CanUpdate) then no request will be made, instead the result will be (status=-1, err=nil).
Path | Synopsis |
---|---|
atom | Package atom provides a parser for Atom feeds. |
rdf | Package rdf provides a parser for RDF Site Summary (RSS) 1.0. |
rss | Package rss provides a parser for RSS v2.0 feeds. |
Package feed imports 12 packages (graph) and is imported by 7 packages. Updated 2018-01-16. Refresh now. Tools for package owners.