tiktok-dl/client/getMusicUploads.go

28 lines
685 B
Go
Raw Normal View History

package client
import (
2020-03-22 00:10:24 +00:00
"fmt"
2020-04-12 01:22:00 +01:00
models "github.com/pikami/tiktok-dl/models"
config "github.com/pikami/tiktok-dl/models/config"
)
// GetMusicUploads - Get all uploads by given music
2020-02-25 18:12:01 +00:00
func GetMusicUploads(url string) ([]models.Upload, error) {
2020-03-22 00:10:24 +00:00
actionOutput, err := GetMusicUploadsJSON(url)
2020-02-25 18:12:01 +00:00
if err != nil {
return nil, err
}
return models.ParseUploads(actionOutput), nil
}
2020-03-22 00:10:24 +00:00
// GetMusicUploadsJSON - Get music uploads scrape
func GetMusicUploadsJSON(url string) (string, error) {
2020-02-24 23:01:10 +00:00
jsMethod := fmt.Sprintf("bootstrapIteratingVideos(%d)", config.Config.Limit)
2020-02-25 19:16:57 +00:00
actionOutput, err := executeClientAction(url, jsMethod)
if err != nil {
return "", err
}
return actionOutput, nil
2020-02-24 23:01:10 +00:00
}