mirror of
https://github.com/pikami/tiktok-dl.git
synced 2026-01-29 22:52:56 +00:00
error handling
This commit is contained in:
@@ -7,13 +7,20 @@ import (
|
||||
)
|
||||
|
||||
// GetUserUploads - Get all uploads marked with given hashtag
|
||||
func GetHashtagUploads(hashtagURL string) []models.Upload {
|
||||
func GetHashtagUploads(hashtagURL string) ([]models.Upload, error) {
|
||||
jsMethod := fmt.Sprintf("bootstrapIteratingVideos(%d)", config.Config.Limit)
|
||||
actionOutput := executeClientAction(hashtagURL, jsMethod)
|
||||
return models.ParseUploads(actionOutput)
|
||||
actionOutput, err := executeClientAction(hashtagURL, jsMethod)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return models.ParseUploads(actionOutput), nil
|
||||
}
|
||||
|
||||
func GetHashtagUploadsJson(hashtagURL string) string {
|
||||
func GetHashtagUploadsJson(hashtagURL string) (string, error) {
|
||||
jsMethod := fmt.Sprintf("bootstrapIteratingVideos(%d)", config.Config.Limit)
|
||||
return executeClientAction(hashtagURL, jsMethod)
|
||||
actionOutput, err := executeClientAction(hashtagURL, jsMethod)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return actionOutput, nil
|
||||
}
|
||||
|
||||
@@ -16,7 +16,11 @@ func GetMusicUploads(url string) ([]models.Upload, error) {
|
||||
return models.ParseUploads(actionOutput), nil
|
||||
}
|
||||
|
||||
func GetMusicUploadsJson(url string) string {
|
||||
func GetMusicUploadsJson(url string) (string, error) {
|
||||
jsMethod := fmt.Sprintf("bootstrapIteratingVideos(%d)", config.Config.Limit)
|
||||
return executeClientAction(url, jsMethod)
|
||||
actionOutput, err := executeClientAction(url, jsMethod)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return actionOutput, nil
|
||||
}
|
||||
|
||||
@@ -16,7 +16,11 @@ func GetUserUploads(username string) ([]models.Upload, error) {
|
||||
return models.ParseUploads(actionOutput), nil
|
||||
}
|
||||
|
||||
func GetUserUploadsJson(username string) string {
|
||||
func GetUserUploadsJson(username string) (string, error) {
|
||||
jsMethod := fmt.Sprintf("bootstrapIteratingVideos(%d)", config.Config.Limit)
|
||||
return executeClientAction(`https://www.tiktok.com/@`+username, jsMethod)
|
||||
actionOutput, err := executeClientAction(`https://www.tiktok.com/@`+username, jsMethod)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return actionOutput, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user