mirror of
https://github.com/pikami/tiktok-dl.git
synced 2024-11-29 03:05:42 +00:00
33 lines
641 B
Go
33 lines
641 B
Go
package models
|
|
|
|
import (
|
|
"encoding/json"
|
|
"strings"
|
|
)
|
|
|
|
// Upload - Upload object
|
|
type Upload struct {
|
|
ShareLink string `json:"shareLink"`
|
|
URL string `json:"url"`
|
|
}
|
|
|
|
// ParseUploads - Parses json uploads array
|
|
func ParseUploads(str string) []Upload {
|
|
var uploads []Upload
|
|
json.Unmarshal([]byte(str), &uploads)
|
|
return uploads
|
|
}
|
|
|
|
// ParseUpload - Parses json uploads array
|
|
func ParseUpload(str string) Upload {
|
|
var upload Upload
|
|
json.Unmarshal([]byte(str), &upload)
|
|
return upload
|
|
}
|
|
|
|
// GetUploadID - Returns upload id
|
|
func (u Upload) GetUploadID() string {
|
|
parts := strings.Split(u.ShareLink, "/")
|
|
return parts[len(parts)-1]
|
|
}
|