Documentation
¶
Overview ¶
Package library is where the agent reads: public-domain books from Project Gutenberg (found through its own OPDS search) and articles from Wikipedia. It fetches only from an allow-list of hosts, so nothing it reads comes from a page chosen by someone else.
Index ¶
Constants ¶
const ( GutenbergURL = "https://www.gutenberg.org" WikipediaURL = "https://en.wikipedia.org" )
Variables ¶
var ErrNotFound = errors.New("nothing found")
Functions ¶
func Passage ¶
Passage returns the part of text starting at from, about size characters long, ended at a paragraph (or failing that, a sentence) break; and where the next passage starts. next == len(text) at the end.
func StripGutenberg ¶
Types ¶
type Client ¶
type Client struct {
Gutenberg string
Wikipedia string
MaxBytes int64 // the most it downloads at once
// contains filtered or unexported fields
}
func New ¶
New makes a client for the given services ("" for the real ones). Both gutenberg.org hosts are allowed because it redirects books' text between them.