diff --git a/goutubedl.go b/goutubedl.go index f7ad73b..33091f8 100644 --- a/goutubedl.go +++ b/goutubedl.go @@ -319,9 +319,9 @@ func infoFromURL(ctx context.Context, rawURL string, options Options) (info Info isPlaylist := info.Type == "playlist" || info.Type == "multi_video" switch { case options.Type == TypePlaylist && !isPlaylist: - return Info{}, nil, fmt.Errorf("not a playlist") + return Info{}, nil, fmt.Errorf("is not a playlist") case options.Type == TypeSingle && isPlaylist: - return Info{}, nil, fmt.Errorf("not a single") + return Info{}, nil, fmt.Errorf("is not a single entry") default: // any type } @@ -406,7 +406,7 @@ func (result Result) Download(ctx context.Context, filter string) (*DownloadResu debugLog := result.Options.DebugLog if result.Info.Type == "playlist" || result.Info.Type == "multi_video" { - return nil, fmt.Errorf("is a playlist") + return nil, fmt.Errorf("can't download a playlist") } tempPath, tempErr := ioutil.TempDir("", "ydls") diff --git a/goutubedl_test.go b/goutubedl_test.go index 63dd1bc..f4bd019 100644 --- a/goutubedl_test.go +++ b/goutubedl_test.go @@ -233,22 +233,22 @@ func TestSubtitles(t *testing.T) { } } -func TestErrorNotAPlaylist(t *testing.T) { +func TestErrorIsNotAPlaylist(t *testing.T) { _, ydlResultErr := New(context.Background(), testVideoRawURL, Options{ Type: TypePlaylist, DownloadThumbnail: false, }) - if ydlResultErr.Error() != "not a playlist" { + if ydlResultErr.Error() != "is not a playlist" { t.Errorf("expected is playlist error") } } -func TestErrorNotASingle(t *testing.T) { +func TestErrorIsNotASingleEntry(t *testing.T) { _, ydlResultErr := New(context.Background(), playlistRawURL, Options{ Type: TypeSingle, DownloadThumbnail: false, }) - if ydlResultErr.Error() != "not a single" { - t.Errorf("expected is playlist error") + if ydlResultErr.Error() != "is not a single entry" { + t.Errorf("expected is not a playlist error") } }