Skip to content

Instantly share code, notes, and snippets.

@mnlwldr
Last active July 20, 2020 09:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mnlwldr/cdb59dc009dc62f515bbd371825851bc to your computer and use it in GitHub Desktop.
Save mnlwldr/cdb59dc009dc62f515bbd371825851bc to your computer and use it in GitHub Desktop.
Your follower on Twitter
package main
import (
"fmt"
"net/url"
"os"
"strconv"
"github.com/ChimeraCoder/anaconda"
)
func initAnaconda() *anaconda.TwitterApi {
return anaconda.NewTwitterApiWithCredentials(
"ACCESS_TOKEN",
"ACCESS_TOKEN_SECRET",
"CONSUMER_TOKEN",
"CONSUMER_TOKEN_SECRET")
}
func main() {
api := initAnaconda()
params := url.Values{}
params.Set("count", "200")
params.Set("skip_status", "true")
params.Set("include_user_entities", "false")
var cursor int64 = -1 // Initial value, which is the first page
for cursor != 0 {
params.Set("cursor", strconv.FormatInt(cursor, 10))
followers, err := api.GetFollowersList(params)
if err != nil {
fmt.Println(err)
os.Exit(0)
}
for _, follower := range followers.Users {
fmt.Printf("%s\n", follower.ScreenName)
}
cursor = followers.Next_cursor
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment