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