Documentation
¶
Overview ¶
Package tiengtrungbotui is the library behind the tiengtrungbotui command line: the HTTP client, request shaping, and the typed data models for the Tiếng Trung Bỏ Túi Vietnamese Chinese-learning site.
The Client here is the spine every command shares. It sets a real User-Agent, paces requests so a busy session stays polite, and retries the transient failures (429 and 5xx) that any public site throws under load.
Index ¶
Constants ¶
const BaseURL = "https://" + Host
BaseURL is the root every request is built from.
const DefaultUserAgent = "tiengtrungbotui/dev (+https://github.com/tamnd/tiengtrungbotui-cli)"
DefaultUserAgent identifies the client to the remote host.
const Host = "www.tiengtrungbotui.com"
Host is the site this client talks to, and the host the URI driver in domain.go claims.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
HTTP *http.Client
UserAgent string
Rate time.Duration
Retries int
// contains filtered or unexported fields
}
Client talks to tiengtrungbotui.com over HTTP.
func (*Client) Episodes ¶
Episodes fetches a series page and returns all episodes from its JSON-LD data.
type Domain ¶
type Domain struct{}
Domain is the tiengtrungbotui driver.
func (Domain) Info ¶
func (Domain) Info() kit.DomainInfo
type Episode ¶
type Episode struct {
Rank int `json:"rank" csv:"rank" tsv:"rank"`
Series string `json:"series" csv:"series" tsv:"series"`
Level string `json:"level" csv:"level" tsv:"level"`
Title string `json:"title" csv:"title" tsv:"title"`
YouTubeID string `json:"youtube_id" csv:"youtube_id" tsv:"youtube_id"`
URL string `json:"url" csv:"url" tsv:"url"`
}
Episode is one video inside a series.