2020-01-19 02:11:53 +00:00
|
|
|
package client
|
|
|
|
|
|
|
|
import (
|
2020-03-22 00:10:24 +00:00
|
|
|
"fmt"
|
|
|
|
|
2020-01-19 02:11:53 +00:00
|
|
|
models "../models"
|
2020-02-24 22:56:19 +00:00
|
|
|
config "../models/config"
|
2020-01-19 02:11:53 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// GetUserUploads - Get all uploads by user
|
2020-02-25 18:12:01 +00:00
|
|
|
func GetUserUploads(username string) ([]models.Upload, error) {
|
2020-03-22 00:10:24 +00:00
|
|
|
actionOutput, err := GetUserUploadsJSON(username)
|
2020-02-25 18:12:01 +00:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return models.ParseUploads(actionOutput), nil
|
2020-01-19 02:11:53 +00:00
|
|
|
}
|
2020-02-24 22:56:19 +00:00
|
|
|
|
2020-03-22 00:10:24 +00:00
|
|
|
// GetUserUploadsJSON - Get user uploads scrape
|
|
|
|
func GetUserUploadsJSON(username 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(`https://www.tiktok.com/@`+username, jsMethod)
|
|
|
|
if err != nil {
|
|
|
|
return "", err
|
|
|
|
}
|
|
|
|
return actionOutput, nil
|
2020-02-24 23:01:10 +00:00
|
|
|
}
|