tiktok-dl/workflows/downloadShareLink.go
Pijus Kamandulis 70c3faf17e Use go modules
2020-04-12 03:22:00 +03:00

28 lines
600 B
Go

package workflows
import (
"regexp"
client "github.com/pikami/tiktok-dl/client"
log "github.com/pikami/tiktok-dl/utils/log"
)
// CanUseDownloadShareLink - Check's if DownloadShareLink can be used
func CanUseDownloadShareLink(url string) bool {
match, _ := regexp.MatchString("vm.tiktok.com\\/.+", url)
return match
}
// DownloadShareLink - Download item by share link
func DownloadShareLink(url string) {
log.Logf("Resolving share link: %s\n", url)
finalURL, err := client.GetRedirectURL(url)
if err != nil {
OnWorkflowFail(err, url)
return
}
StartWorkflowByParameter(finalURL)
}