mirror of
https://github.com/arnaucube/argos.git
synced 2026-02-07 19:16:40 +01:00
device source analysis
This commit is contained in:
20
analyzeSource.go
Normal file
20
analyzeSource.go
Normal file
@@ -0,0 +1,20 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/dghubble/go-twitter/twitter"
|
||||
)
|
||||
|
||||
func analyzeSource(tweets []twitter.Tweet) map[string]int {
|
||||
var sources = make(map[string]int)
|
||||
for _, v := range tweets {
|
||||
source := strings.Split(strings.Split(v.Source, ">")[1], "<")[0]
|
||||
if _, ok := sources[source]; ok {
|
||||
sources[source] = sources[source] + 1
|
||||
} else {
|
||||
sources[source] = 1
|
||||
}
|
||||
}
|
||||
return (sources)
|
||||
}
|
||||
Reference in New Issue
Block a user