Created
December 7, 2018 21:47
-
-
Save Adron/90c134fdc2b30058686eff268df86bc7 to your computer and use it in GitHub Desktop.
This is the core findem implementation that goes out, grabs some basic information about a Twitter user and displays it to the screen.
This file contains 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
Run: func(cmd *cobra.Command, args []string) { | |
fmt.Println("Starting Twitter Information Retrieval.") | |
completedTwitterList := buildTwitterList() | |
fmt.Printf("Getting Twitter details for: \n%s", completedTwitterList) | |
accessToken, err := getBearerToken(viper.GetString("consumer_api_key"), viper.GetString("consumer_api_secret")) | |
check(err) | |
config := &oauth2.Config{} | |
token := &oauth2.Token{AccessToken: accessToken} | |
// OAuth2 http.Client will automatically authorize Requests | |
httpClient := config.Client(context.Background(), token) | |
// Twitter client | |
client := twitter.NewClient(httpClient) | |
// users lookup | |
userLookupParams := &twitter.UserLookupParams{ScreenName: completedTwitterList} | |
users, _, _ := client.Users.Lookup(userLookupParams) | |
fmt.Printf("\n\nUsers:\n%+v\n", users) | |
howManyUsersFound := len(users) | |
fmt.Println(howManyUsersFound) | |
}, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment