Documentation
¶
Index ¶
- type DownloadOptions
- type Downloader
- func (d *Downloader) Download(ctx context.Context, videoURL string) (*VideoInfo, error)
- func (d *Downloader) GetPlaylistItems(ctx context.Context, playlistID string, limit int) ([]types.PlaylistItem, error)
- func (d *Downloader) GetPlaylistItemsAll(ctx context.Context, playlistID string, limit int) ([]types.PlaylistItem, error)
- func (d *Downloader) ResolveURL(ctx context.Context, videoURL string) (string, *VideoInfo, error)
- func (d *Downloader) WithBotguard(mode botguard.Mode, solver botguard.Solver, cache botguard.Cache) *Downloader
- func (d *Downloader) WithBotguardDebug(debug bool) *Downloader
- func (d *Downloader) WithBotguardTTL(ttl time.Duration) *Downloader
- func (d *Downloader) WithFormat(quality, ext string) *Downloader
- func (d *Downloader) WithHTTPClient(client *http.Client) *Downloader
- func (d *Downloader) WithInnertubeClient(name, version string) *Downloader
- func (d *Downloader) WithOutputPath(path string) *Downloader
- func (d *Downloader) WithProgress(f func(Progress)) *Downloader
- func (d *Downloader) WithRateLimit(bytesPerSecond int64) *Downloader
- type Format
- type Progress
- type VideoInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DownloadOptions ¶
type DownloadOptions struct {
FormatSelector string
DesiredExt string
OutputPath string
HTTPClient *http.Client
ProgressFunc func(Progress)
RateLimitBps int64
ITClientName string
ITClientVersion string
}
DownloadOptions contains configuration for a single download invocation.
Use chainable setters on Downloader to populate these options.
type Downloader ¶
type Downloader struct {
// contains filtered or unexported fields
}
Downloader provides a high-level API for retrieving metadata and downloading YouTube videos using internal clients and helpers.
func (*Downloader) Download ¶
Download retrieves video metadata, resolves URL, and downloads to disk.
func (*Downloader) GetPlaylistItems ¶
func (d *Downloader) GetPlaylistItems(ctx context.Context, playlistID string, limit int) ([]types.PlaylistItem, error)
GetPlaylistItems returns minimal playlist items for a playlist ID (MVP: first page only).
func (*Downloader) GetPlaylistItemsAll ¶
func (d *Downloader) GetPlaylistItemsAll(ctx context.Context, playlistID string, limit int) ([]types.PlaylistItem, error)
GetPlaylistItemsAll returns playlist items with continuations up to the limit.
func (*Downloader) ResolveURL ¶
ResolveURL performs the metadata fetch and URL resolution, returning the final media URL and basic info.
func (*Downloader) WithBotguard ¶
func (d *Downloader) WithBotguard(mode botguard.Mode, solver botguard.Solver, cache botguard.Cache) *Downloader
WithBotguard configures Botguard attestation usage.
func (*Downloader) WithBotguardDebug ¶
func (d *Downloader) WithBotguardDebug(debug bool) *Downloader
WithBotguardDebug enables Botguard debug logging.
func (*Downloader) WithBotguardTTL ¶
func (d *Downloader) WithBotguardTTL(ttl time.Duration) *Downloader
WithBotguardTTL sets default Botguard TTL when solver does not specify ExpiresAt.
func (*Downloader) WithFormat ¶
func (d *Downloader) WithFormat(quality, ext string) *Downloader
WithFormat sets a format selector and optional desired extension. Examples: "itag=22", "best", "height<=480". Extension is case-insensitive.
func (*Downloader) WithHTTPClient ¶
func (d *Downloader) WithHTTPClient(client *http.Client) *Downloader
WithHTTPClient sets a custom HTTP client to be used for all network calls.
func (*Downloader) WithInnertubeClient ¶
func (d *Downloader) WithInnertubeClient(name, version string) *Downloader
WithInnertubeClient sets the Innertube client name and version to use.
func (*Downloader) WithOutputPath ¶
func (d *Downloader) WithOutputPath(path string) *Downloader
WithOutputPath sets the output file path. If empty, a safe filename is derived from the video title and mime extension. If a directory path is provided, a safe filename is derived and placed inside that directory.
func (*Downloader) WithProgress ¶
func (d *Downloader) WithProgress(f func(Progress)) *Downloader
WithProgress registers a callback that receives progress updates.
func (*Downloader) WithRateLimit ¶
func (d *Downloader) WithRateLimit(bytesPerSecond int64) *Downloader
WithRateLimit sets a download rate limit in bytes per second. Zero disables limiting.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package client provides an HTTP client with retry and backoff semantics.
|
Package client provides an HTTP client with retry and backoff semantics. |
|
cmd
|
|
|
ytdlp
command
|
|
|
Package downloader implements a resilient chunked downloader with retries and optional rate limiting.
|
Package downloader implements a resilient chunked downloader with retries and optional rate limiting. |
|
Package errs contains typed errors returned by the library for common YouTube playability and network conditions.
|
Package errs contains typed errors returned by the library for common YouTube playability and network conditions. |
|
internal
|
|
|
Package types contains public data models used across the library.
|
Package types contains public data models used across the library. |
|
youtube
|
|
|
cipher
Package cipher implements YouTube signature decryption.
|
Package cipher implements YouTube signature decryption. |
|
formats
Package formats parses player response formats and provides selection utilities by itag, extension, height constraints, and best/worst.
|
Package formats parses player response formats and provides selection utilities by itag, extension, height constraints, and best/worst. |