mirror of
https://github.com/pikami/tiktok-dl.git
synced 2024-11-25 17:25:42 +00:00
29 lines
681 B
Go
29 lines
681 B
Go
package workflows
|
|
|
|
import (
|
|
client "../client"
|
|
models "../models"
|
|
utils "../utils"
|
|
"fmt"
|
|
"regexp"
|
|
)
|
|
|
|
// CanUseDownloadMusic - Check's if DownloadMusic can be used for parameter
|
|
func CanUseDownloadMusic(url string) bool {
|
|
match, _ := regexp.MatchString(".com\\/music\\/.+", url)
|
|
return match
|
|
}
|
|
|
|
// DownloadMusic - Download all videos by given music
|
|
func DownloadMusic(url string) {
|
|
uploads := client.GetMusicUploads(url)
|
|
|
|
for _, upload := range uploads {
|
|
username := models.GetUsernameFromString(upload.Uploader)
|
|
downloadDir := fmt.Sprintf("%s/%s", models.Config.OutputPath, username)
|
|
|
|
utils.InitOutputDirectory(downloadDir)
|
|
downloadVideo(upload, downloadDir)
|
|
}
|
|
}
|