Adron
12/7/2018 - 9:47 PM

This is the core findem implementation that goes out, grabs some basic information about a Twitter user and displays it to the screen.

This is the core findem implementation that goes out, grabs some basic information about a Twitter user and displays it to the screen.

	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)
	},