-
Notifications
You must be signed in to change notification settings - Fork 7
/
example.go
39 lines (36 loc) · 908 Bytes
/
example.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
package main
import (
"fmt"
reX "github.com/amovane/reX/x"
"os"
)
func main() {
uname := os.Getenv("USER_NAME")
upwd := os.Getenv("PASSWORD")
code := os.Getenv("CODE")
x := reX.New()
wd, _ := os.Getwd()
cookiesPath := fmt.Sprintf("%s/cookies.json", wd)
err := x.SetCookies(cookiesPath)
if err != nil || !x.IsLoggedIn() {
println("You must login first")
x.Login(uname, upwd, code)
x.SaveCookies(cookiesPath)
}
// followings
var cursor *string
var tweets []reX.UserResults
for {
tweets, cursor, err = x.GetFollowingsByScreenName("shareverse_", cursor)
for _, tweet := range tweets {
println(tweet.Result.Legacy.ScreenName)
}
if cursor == nil || err != nil {
break
}
}
uid, _ := x.GetUserIDByScreenName("jarredsumner")
uidOfFollower, _ := x.GetUserIDByScreenName("cybermageek")
isFollowing := x.IsFollowing(uid, uidOfFollower)
println("isFollowing", isFollowing)
}