tiktok-dl/workflows/downloadUser.go
Pijus Kamandulis 1b3f985f42 Improved status output
Added `-quiet` flag

Move out error messages to separate file
2020-02-08 02:52:26 +02:00

31 lines
708 B
Go

package workflows
import (
client "../client"
config "../models/config"
utils "../utils"
"fmt"
"strings"
)
// CanUseDownloadUser - Test's if this workflow can be used for parameter
func CanUseDownloadUser(url string) bool {
match := strings.Contains(url, "/")
return !match
}
// DownloadUser - Download all user's videos
func DownloadUser(username string) {
uploads := client.GetUserUploads(username)
uploadCount := len(uploads)
downloadDir := fmt.Sprintf("%s/%s", config.Config.OutputPath, username)
utils.InitOutputDirectory(downloadDir)
for index, upload := range uploads {
downloadVideo(upload, downloadDir)
utils.Logf("\r[%d/%d] Downloaded", index+1, uploadCount)
}
utils.Log()
}