From 1b7865d7150043e865b9ca0259ad6ad32b405f59 Mon Sep 17 00:00:00 2001 From: arnaucode Date: Fri, 23 Jun 2017 04:23:56 +0200 Subject: [PATCH] improved user analysis --- analyzeUserAccount.go | 36 ++++++++++++++++++++++++++++++++++++ optionAnalyzeUserTweets.go | 1 + 2 files changed, 37 insertions(+) create mode 100644 analyzeUserAccount.go diff --git a/analyzeUserAccount.go b/analyzeUserAccount.go new file mode 100644 index 0000000..9bc981e --- /dev/null +++ b/analyzeUserAccount.go @@ -0,0 +1,36 @@ +package main + +import ( + "fmt" + "strconv" + + "github.com/dghubble/go-twitter/twitter" +) + +func analyzeUserAccount(client *twitter.Client, username string) { + user, _, err := client.Users.Show(&twitter.UserShowParams{ + ScreenName: username, + }) + if err != nil { + fmt.Println(err) + } + + fmt.Print("User created at: ") + c.Cyan(user.CreatedAt) + + fmt.Print("email: ") + c.Cyan(user.Email) + + fmt.Print("Following count: ") + c.Cyan(strconv.Itoa(user.FriendsCount)) + fmt.Print("Followers count: ") + c.Cyan(strconv.Itoa(user.FollowersCount)) + + fmt.Print("Location: ") + c.Cyan(user.Location) + + fmt.Print("Timezone: ") + c.Cyan(user.Timezone) + fmt.Println("") + fmt.Println("") +} diff --git a/optionAnalyzeUserTweets.go b/optionAnalyzeUserTweets.go index 4084378..a1e9d04 100644 --- a/optionAnalyzeUserTweets.go +++ b/optionAnalyzeUserTweets.go @@ -62,5 +62,6 @@ func optionAnalyzeUserTweets(client *twitter.Client) { fmt.Println(" ") fmt.Print("User @") c.Cyan(username) + analyzeUserAccount(client, username) fmt.Println(" analysis finished") }