tiktok-dl/workflows/downloadUser.go

28 lines
596 B
Go
Raw Normal View History

2020-01-21 21:46:30 +00:00
package workflows
import (
client "../client"
models "../models"
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) {
downloadDir := fmt.Sprintf("%s/%s", models.Config.OutputPath, username)
uploads := client.GetUserUploads(username)
utils.InitOutputDirectory(downloadDir)
for _, upload := range uploads {
downloadVideo(upload, downloadDir)
}
}