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.

20 lines
409 B

  1. package main
  2. import (
  3. "strings"
  4. "github.com/dghubble/go-twitter/twitter"
  5. )
  6. func analyzeSource(tweets []twitter.Tweet) map[string]int {
  7. var sources = make(map[string]int)
  8. for _, v := range tweets {
  9. source := strings.Split(strings.Split(v.Source, ">")[1], "<")[0]
  10. if _, ok := sources[source]; ok {
  11. sources[source] = sources[source] + 1
  12. } else {
  13. sources[source] = 1
  14. }
  15. }
  16. return (sources)
  17. }