intimate/extractor/mirrativ_extractor/mirrativ_extractor_test.go
2020-09-15 19:06:03 +08:00

52 lines
1.0 KiB
Go

package main
import (
"intimate"
"log"
"testing"
"time"
"github.com/474420502/gcurl"
)
func main() {
ps := intimate.NewPerfectShutdown()
gprofile := gcurl.Parse(`https://www.mirrativ.com/api/user/profile?user_id=103383701`)
tpProfile := gprofile.CreateTemporary(nil)
tpProfileUserID := tpProfile.QueryParam("user_id")
g := gcurl.Parse(`https://www.mirrativ.com/api/live/live?live_id=O5Ia4iX9c5CeZj7DFtg52Q`)
tpLive := g.CreateTemporary(nil)
tpLiveID := tpLive.QueryParam("live_id")
queue := intimate.TStreamer.Queue(intimate.Streamer{}, intimate.ConditionDefault(intimate.PMirrativ))
for !ps.IsClose() {
istreamer, err := queue.Pop()
if err != nil {
log.Println(err)
time.Sleep(time.Second * 2)
continue
}
streamer := istreamer.(*intimate.Streamer)
userid := *streamer.UserId
tpProfileUserID.StringSet(userid)
resp, err := tpProfile.Execute()
if err != nil {
log.Println(err)
time.Sleep(time.Second)
continue
}
profilejson := gcurl.Parse(string(resp.Content()))
}
}
func TestDo(t *testing.T) {
main()
}