mirror of
https://github.com/pikami/tiktok-dl.git
synced 2026-01-01 15:19:51 +00:00
Merge branch 'master' into master
This commit is contained in:
@@ -3,6 +3,7 @@ package workflows
|
||||
import (
|
||||
client "../client"
|
||||
config "../models/config"
|
||||
res "../resources"
|
||||
utils "../utils"
|
||||
"fmt"
|
||||
"regexp"
|
||||
@@ -16,7 +17,11 @@ func CanUseDownloadMusic(url string) bool {
|
||||
|
||||
// DownloadMusic - Download all videos by given music
|
||||
func DownloadMusic(url string) {
|
||||
uploads := client.GetMusicUploads(url)
|
||||
uploads, err := client.GetMusicUploads(url)
|
||||
if err != nil {
|
||||
utils.LogErr(res.ErrorCouldNotGetUserUploads, err.Error())
|
||||
return
|
||||
}
|
||||
uploadCount := len(uploads)
|
||||
|
||||
for index, upload := range uploads {
|
||||
|
||||
@@ -3,20 +3,27 @@ package workflows
|
||||
import (
|
||||
client "../client"
|
||||
config "../models/config"
|
||||
res "../resources"
|
||||
utils "../utils"
|
||||
"fmt"
|
||||
"regexp"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// CanUseDownloadUser - Test's if this workflow can be used for parameter
|
||||
func CanUseDownloadUser(url string) bool {
|
||||
match := strings.Contains(url, "/")
|
||||
return !match
|
||||
isURL := strings.Contains(url, "/")
|
||||
match, _ := regexp.MatchString(".+com\\/@[^\\/]+", url)
|
||||
return !isURL || match
|
||||
}
|
||||
|
||||
// DownloadUser - Download all user's videos
|
||||
func DownloadUser(username string) {
|
||||
uploads := client.GetUserUploads(username)
|
||||
uploads, err := client.GetUserUploads(username)
|
||||
if err != nil {
|
||||
utils.LogErr(res.ErrorCouldNotGetUserUploads, err.Error())
|
||||
return
|
||||
}
|
||||
uploadCount := len(uploads)
|
||||
downloadDir := fmt.Sprintf("%s/%s", config.Config.OutputPath, username)
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
client "../client"
|
||||
models "../models"
|
||||
config "../models/config"
|
||||
res "../resources"
|
||||
utils "../utils"
|
||||
"fmt"
|
||||
"regexp"
|
||||
@@ -18,7 +19,11 @@ func CanUseDownloadSingleVideo(url string) bool {
|
||||
// DownloadSingleVideo - Downloads single video
|
||||
func DownloadSingleVideo(url string) {
|
||||
username := utils.GetUsernameFromString(url)
|
||||
upload := client.GetVideoDetails(url)
|
||||
upload, err := client.GetVideoDetails(url)
|
||||
if err != nil {
|
||||
utils.LogErr(res.ErrorCouldNotGetUserUploads, err.Error())
|
||||
return
|
||||
}
|
||||
downloadDir := fmt.Sprintf("%s/%s", config.Config.OutputPath, username)
|
||||
|
||||
utils.InitOutputDirectory(downloadDir)
|
||||
|
||||
Reference in New Issue
Block a user