diff --git a/ytva.go b/ytva.go index aefdc15..073877b 100644 --- a/ytva.go +++ b/ytva.go @@ -144,9 +144,19 @@ func main() { } } - log.Infof("Downloading video: %s", v.Title) - if err := downloadVideo(v.WebpageURL, path, group); err != nil { - log.Error(err) + if _, err := os.Stat(path); err != nil { + if os.IsNotExist(err) { + log.Infof("Downloading video: %s", v.Title) + if err := downloadVideo(v.WebpageURL, path, group); err != nil { + log.Error(err) + } + } else { + log.Error(err) + continue + } + } else { + log.Infof("Video %s already exists, skipping", v.Title) + continue } } }