mirror of
https://github.com/pikami/tiktok-dl.git
synced 2024-11-25 09:15:41 +00:00
28 lines
600 B
Go
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)
|
|
}
|