-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
example_test.go
63 lines (52 loc) · 966 Bytes
/
example_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
package tv_test
import (
"fmt"
"testing"
"github.com/go-olive/tv"
)
func ExampleTv() {
t, err := tv.New("huya", "518512")
if err != nil {
println(err.Error())
return
}
t.Snap()
fmt.Println(t)
}
func ExampleSetCookie() {
douyinCookie := "__ac_nonce=06245c89100e7ab2dd536; __ac_signature=_02B4Z6wo00f01LjBMSAAAIDBwA.aJ.c4z1C44TWAAEx696;"
t, err := tv.New("douyin", "600571451250", tv.SetCookie(douyinCookie))
if err != nil {
println(err.Error())
return
}
t.Snap()
fmt.Println(t)
}
func ExampleNewWithUrl() {
t, err := tv.NewWithUrl("https://www.huya.com/518512")
if err != nil {
println(err.Error())
return
}
t.Snap()
fmt.Println(t)
}
func TestExampleTv(t *testing.T) {
if !testing.Verbose() {
return
}
ExampleTv()
}
func TestExampleSetCookie(t *testing.T) {
if !testing.Verbose() {
return
}
ExampleSetCookie()
}
func TestExampleNewWithUrl(t *testing.T) {
if !testing.Verbose() {
return
}
ExampleNewWithUrl()
}