From 0745c124c5c78a55cc2cea9efd626ccce263dc73 Mon Sep 17 00:00:00 2001 From: Markus Kuuse Date: Tue, 6 Feb 2024 12:45:37 +0200 Subject: [PATCH] continue when video has no formats --- youtube.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/youtube.go b/youtube.go index e891806..2c5765c 100644 --- a/youtube.go +++ b/youtube.go @@ -74,14 +74,14 @@ func downloadAndFormat(song string, artist string, name string, cfg Youtube) (st // Remove illegal characters for file naming re := regexp.MustCompile("[^a-zA-Z0-9._]+") - s := re.ReplaceAllString(song, " ") - a := re.ReplaceAllString(artist, " ") + s := re.ReplaceAllString(song, "_") + a := re.ReplaceAllString(artist, "_") video, _ := yt_client.GetVideo(v.ID.VideoID) formats := video.Formats.WithAudioChannels() // Get video with audio if formats == nil { - log.Printf("video format is empty, skipping track") - break + log.Println("video format is empty, getting next one...") + continue } stream, _, err := yt_client.GetStream(video, &formats[2]) if err != nil {