-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuserinfo_test.go
55 lines (47 loc) · 1.08 KB
/
userinfo_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
package igmedia
import (
"fmt"
"os"
"testing"
)
func ExampleGetUserInfoNoLogin() {
user, err := GetUserInfoNoLogin("instagram")
if err != nil {
panic(err)
}
fmt.Println(user.Id)
fmt.Println(user.Biography)
// Output:
// 25025320
// Discovering — and telling — stories from around the world. Curated by Instagram’s community team.
}
func ExampleGetUserId() {
fmt.Println(GetUserId("instagram"))
// Output: 25025320 <nil>
}
func ExampleGetAllPostCode(t *testing.T) {
mgr := NewInstagramApiManager(
os.Getenv("IG_DS_USER_ID"),
os.Getenv("IG_SESSIONID"),
os.Getenv("IG_CSRFTOKEN"))
codes, err := mgr.GetAllPostCode(os.Getenv("IG_TEST_USERNAME"))
if err != nil {
t.Error(err)
return
}
for _, code := range codes {
fmt.Printf("URL: https://www.instagram.com/p/%s/\n", code)
}
}
func ExampleGetUserInfo(t *testing.T) {
mgr := NewInstagramApiManager(
os.Getenv("IG_DS_USER_ID"),
os.Getenv("IG_SESSIONID"),
os.Getenv("IG_CSRFTOKEN"))
ui, err := mgr.GetUserInfo(os.Getenv("IG_TEST_USERNAME"))
if err != nil {
t.Error(err)
return
}
jsonPrettyPrint(ui)
}