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.
uname := os.Getenv("USER_NAME")
upwd := os.Getenv("PASSWORD")
x := reX.New(uname, upwd)
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()
x.SaveCookies(cookiesPath)
}
var cursor *string
var tweets []reX.Legacy
for {
tweets, cursor, err = x.GetFollowingsByScreenName("shareverse_", cursor)
for _, tweet := range tweets {
println(tweet.ScreenName)
}
if cursor == nil || err != nil {
break
}
}
var cursor *string
var tweets []reX.Legacy
for {
tweets, cursor, err = x.GetFollowersByScreenName("shareverse_", cursor)
for _, tweet := range tweets {
println(tweet.ScreenName)
}
if cursor == nil || err != nil {
break
}
}