Since twitter dev removed the API for accessing user followers and following, developers have found it difficult to obtain this data. Here, I'm sharing my reverse engineering solution. If it's helpful to you, please let me know.
go get -u github.com/amovane/reX
uname := os.Getenv("USER_NAME")
upwd := os.Getenv("PASSWORD")
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)
x.SaveCookies(cookiesPath)
}
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
}
}
var cursor *string
var tweets []reX.UserResults
for {
tweets, cursor, err = x.GetFollowerssByScreenName("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)