@ -0,0 +1,19 @@ |
|||||
|
package main |
||||
|
|
||||
|
import ( |
||||
|
"bufio" |
||||
|
"fmt" |
||||
|
"os" |
||||
|
"strings" |
||||
|
) |
||||
|
|
||||
|
func askForUsername() string { |
||||
|
newcommand := bufio.NewReader(os.Stdin) |
||||
|
fmt.Print("enter username: @") |
||||
|
username, _ := newcommand.ReadString('\n') |
||||
|
username = strings.TrimSpace(username) |
||||
|
fmt.Print("user selected: ") |
||||
|
c.Cyan("@" + username) |
||||
|
fmt.Println("-----------------------") |
||||
|
return username |
||||
|
} |
@ -0,0 +1,7 @@ |
|||||
|
package main |
||||
|
|
||||
|
func check(e error) { |
||||
|
if e != nil { |
||||
|
panic(e) |
||||
|
} |
||||
|
} |
@ -0,0 +1,37 @@ |
|||||
|
package main |
||||
|
|
||||
|
import ( |
||||
|
"fmt" |
||||
|
|
||||
|
"github.com/dghubble/go-twitter/twitter" |
||||
|
) |
||||
|
|
||||
|
func optionAnalyzeUserFollowers(client *twitter.Client, username string) { |
||||
|
var followers []twitter.User |
||||
|
var maxid int64 |
||||
|
maxid = 0 |
||||
|
for i := 0; i < 4; i++ { |
||||
|
followersRaw, _, err := client.Followers.List(&twitter.FollowerListParams{ |
||||
|
ScreenName: username, |
||||
|
Count: 200, |
||||
|
Cursor: maxid, |
||||
|
}) |
||||
|
check(err) |
||||
|
maxid = followersRaw.NextCursor |
||||
|
for _, f := range followersRaw.Users { |
||||
|
/*fmt.Println("@" + follower.ScreenName) |
||||
|
fmt.Println("CreatedAt: " + follower.CreatedAt)*/ |
||||
|
followers = append(followers, f) |
||||
|
} |
||||
|
fmt.Println(followersRaw.NextCursor) |
||||
|
if followersRaw.NextCursor == 0 { |
||||
|
break |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
for k, follower := range followers { |
||||
|
fmt.Print(k) |
||||
|
fmt.Println(" @" + follower.ScreenName) |
||||
|
fmt.Println(" CreatedAt: " + follower.CreatedAt) |
||||
|
} |
||||
|
} |