This commit is contained in:
Galiley
2023-08-16 17:19:03 +02:00
parent fcfd4acd74
commit f97b09d082
2 changed files with 5 additions and 3 deletions

View File

@ -431,7 +431,9 @@ type DownloadResult struct {
waitCh chan struct{} waitCh chan struct{}
} }
// Download is a shortcut of DownloadOptions where the options use the default value // Download format matched by filter (usually a format id or quality designator).
// If filter is empty, then youtube-dl will use its default format selector.
// It's a shortcut of DownloadWithOptions where the options use the default value
func (result Result) Download(ctx context.Context, filter string) (*DownloadResult, error) { func (result Result) Download(ctx context.Context, filter string) (*DownloadResult, error) {
return result.DownloadWithOptions(ctx, DownloadOptions{ return result.DownloadWithOptions(ctx, DownloadOptions{
Filter: filter, Filter: filter,
@ -443,7 +445,7 @@ type DownloadOptions struct {
// If filter is empty, then youtube-dl will use its default format selector. // If filter is empty, then youtube-dl will use its default format selector.
Filter string Filter string
// The index of the entry to download from the playlist that would be // The index of the entry to download from the playlist that would be
// passed to youtube-dl wia --playlist-items. The index value starts at 1 // passed to youtube-dl via --playlist-items. The index value starts at 1
PlaylistIndex int PlaylistIndex int
} }

View File

@ -343,7 +343,7 @@ func TestDownloadPlaylistEntry(t *testing.T) {
} }
dr, err := r.DownloadWithOptions(context.Background(), goutubedl.DownloadOptions{ dr, err := r.DownloadWithOptions(context.Background(), goutubedl.DownloadOptions{
PlaylistIndex: playlistIndex + 1, PlaylistIndex: int(r.Info.Entries[playlistIndex].PlaylistIndex),
Filter: r.Info.Entries[playlistIndex].Formats[0].FormatID, Filter: r.Info.Entries[playlistIndex].Formats[0].FormatID,
}) })
if err != nil { if err != nil {