Documentation
¶
Overview ¶
Package media provides a single entry point for obtaining media content. All consumers — Telegram direct messages, Telegram inline queries and the gRPC API — go through Loader so that source-specific download requirements (e.g. TikTok's mandatory cookies + referer headers) live in one place.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Content ¶
type Content struct {
Body io.ReadCloser
ContentLength int64
}
Content is a readable media stream with metadata.
type Loader ¶
type Loader interface {
// DirectURL reports a URL that any HTTP client can fetch without special
// headers — suitable to hand to Telegram inline results or API clients.
// ok is false when the item can only be obtained by downloading it via Open
// (e.g. TikTok, whose CDN requires cookies + referer).
DirectURL(item *models.MediaItem) (url string, ok bool)
// Open streams the item's content, applying any required download headers.
// The caller must close Content.Body.
Open(ctx context.Context, item *models.MediaItem) (*Content, error)
}
Loader is the unified media-loading interface.
func NewHTTPLoader ¶
func NewHTTPLoader() Loader
NewHTTPLoader creates the default HTTP-based loader.
Click to show internal directories.
Click to hide internal directories.