You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
829 B

7 years ago
7 years ago
  1. package main
  2. import (
  3. "bufio"
  4. "fmt"
  5. "os"
  6. "strings"
  7. "github.com/dghubble/go-twitter/twitter"
  8. )
  9. func getUser(client *twitter.Client) {
  10. newcommand := bufio.NewReader(os.Stdin)
  11. fmt.Print("enter username: @")
  12. username, _ := newcommand.ReadString('\n')
  13. username = strings.TrimSpace(username)
  14. fmt.Println("user selected: " + username)
  15. fmt.Println("-----------------------")
  16. tweets, _, _ := client.Timelines.UserTimeline(&twitter.UserTimelineParams{
  17. ScreenName: username,
  18. Count: 200,
  19. })
  20. fmt.Println("word count")
  21. analyzeWords(tweets)
  22. analyzeDates(tweets)
  23. fmt.Println(" ")
  24. fmt.Print("first tweet analyzed: ")
  25. fmt.Println(tweets[len(tweets)-1].CreatedAt)
  26. fmt.Print("last tweet analyzed: ")
  27. fmt.Println(tweets[0].CreatedAt)
  28. fmt.Println(" ")
  29. fmt.Println("User @" + username + " analysis finished")
  30. }