Last active
July 20, 2020 09:59
-
-
Save mnlwldr/cdb59dc009dc62f515bbd371825851bc to your computer and use it in GitHub Desktop.
Your follower on Twitter
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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