2020-07-27 21:42:45 +02:00
|
|
|
package downloader
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
2022-08-11 18:01:55 +02:00
|
|
|
"github.com/lbryio/ytsync/v5/ip_manager"
|
2020-08-06 02:12:05 +02:00
|
|
|
"github.com/lbryio/ytsync/v5/sdk"
|
2022-08-11 18:01:55 +02:00
|
|
|
|
|
|
|
"github.com/lbryio/lbry.go/v2/extras/stop"
|
|
|
|
|
2020-07-27 21:42:45 +02:00
|
|
|
"github.com/sirupsen/logrus"
|
2020-08-06 02:12:05 +02:00
|
|
|
"github.com/stretchr/testify/assert"
|
2020-07-27 21:42:45 +02:00
|
|
|
)
|
|
|
|
|
2020-07-27 23:14:06 +02:00
|
|
|
func TestGetPlaylistVideoIDs(t *testing.T) {
|
2020-08-06 02:12:05 +02:00
|
|
|
videoIDs, err := GetPlaylistVideoIDs("UCJ0-OtVpF0wOKEqT2Z1HEtA", 50, nil, nil)
|
2020-07-27 21:42:45 +02:00
|
|
|
if err != nil {
|
|
|
|
logrus.Error(err)
|
|
|
|
}
|
|
|
|
for _, id := range videoIDs {
|
|
|
|
println(id)
|
|
|
|
}
|
|
|
|
}
|
2020-07-27 23:14:06 +02:00
|
|
|
|
|
|
|
func TestGetVideoInformation(t *testing.T) {
|
2022-08-11 18:01:55 +02:00
|
|
|
s := stop.New()
|
|
|
|
ip, err := ip_manager.GetIPPool(s)
|
|
|
|
assert.NoError(t, err)
|
2022-08-16 02:41:14 +02:00
|
|
|
video, err := GetVideoInformation("kDGOHNpRjzc", s.Ch(), ip)
|
|
|
|
assert.NoError(t, err)
|
|
|
|
assert.NotNil(t, video)
|
|
|
|
logrus.Info(video.ID)
|
2020-07-27 23:14:06 +02:00
|
|
|
}
|
2020-08-06 02:12:05 +02:00
|
|
|
|
|
|
|
func Test_getUploadTime(t *testing.T) {
|
2021-11-24 05:54:08 +01:00
|
|
|
configs := sdk.APIConfig{}
|
2020-08-06 02:12:05 +02:00
|
|
|
got, err := getUploadTime(&configs, "kDGOHNpRjzc", nil, "20060102")
|
|
|
|
assert.NoError(t, err)
|
|
|
|
t.Log(got)
|
|
|
|
}
|