mirror of
https://github.com/arnaucube/argos.git
synced 2026-02-06 18:46:40 +01:00
in analyze tweet, group retweets by same minute
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -19,7 +19,6 @@ _cgo_export.*
|
||||
|
||||
_testmain.go
|
||||
|
||||
*.exe
|
||||
*.test
|
||||
*.prof
|
||||
|
||||
|
||||
@@ -7,6 +7,9 @@ Be half bot and half human, a new generation of cyborgs
|
||||
|
||||
The user analyzer features are insipired on the Python tweets_analyzer by x0rz https://github.com/x0rz/tweets_analyzer
|
||||
|
||||
#### [Disclamer]
|
||||
This software was made to learn the Go syntax, it works, but the implementation is not in the optimal way. I don't have time to maintain it.
|
||||
|
||||
#### Argos Panoptes
|
||||
https://en.wikipedia.org/wiki/Argus_Panoptes
|
||||
|
||||
@@ -15,7 +18,6 @@ https://en.wikipedia.org/wiki/Panopticon
|
||||
|
||||

|
||||
|
||||
[under development]
|
||||
|
||||
#### Current features
|
||||
1. User analyzer
|
||||
|
||||
BIN
build/argos
BIN
build/argos
Binary file not shown.
BIN
build/argos.exe
Executable file
BIN
build/argos.exe
Executable file
Binary file not shown.
@@ -7,6 +7,7 @@ import (
|
||||
"sort"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/dghubble/go-twitter/twitter"
|
||||
)
|
||||
@@ -28,7 +29,11 @@ func printDateRT(v DateRT) {
|
||||
fmt.Print("\x1b[0m") //defaultColor
|
||||
fmt.Print(" (ID: ")
|
||||
fmt.Print("\x1b[31;1m" + retweet.User.IDStr + "\x1b[0m)")
|
||||
fmt.Print(", source: \x1b[33;1m" + source + "\x1b[0m")
|
||||
if source == "TweetDeck" {
|
||||
fmt.Print(", source: \x1b[33;1m" + source + "\x1b[0m")
|
||||
} else {
|
||||
fmt.Print(", source: " + source)
|
||||
}
|
||||
fmt.Print(", user created at: \x1b[32;1m" + retweet.User.CreatedAt + "\x1b[0m,")
|
||||
|
||||
fmt.Print(" \x1b[34;1m" + strconv.Itoa(retweet.User.FollowersCount) + "\x1b[0m followers")
|
||||
@@ -68,12 +73,16 @@ func optionAnalyzeTweet(client *twitter.Client) {
|
||||
|
||||
var dates = make(map[string]DateRT)
|
||||
for _, retweet := range retweets {
|
||||
retws := dates[retweet.CreatedAt].Retweets
|
||||
createdat, err := retweet.CreatedAtTime()
|
||||
check(err)
|
||||
createdatRounded := time.Date(createdat.Year(), createdat.Month(), createdat.Day(), createdat.Hour(), createdat.Minute(), 0, 0, createdat.Location())
|
||||
|
||||
retws := dates[createdatRounded.String()].Retweets
|
||||
retws = append(retws, retweet)
|
||||
var currDate DateRT
|
||||
currDate.Retweets = retws
|
||||
currDate.Date = retweet.CreatedAt
|
||||
dates[retweet.CreatedAt] = currDate
|
||||
currDate.Date = createdatRounded.String()
|
||||
dates[createdatRounded.String()] = currDate
|
||||
}
|
||||
fmt.Println("total of " + strconv.Itoa(len(retweets)) + " retweets")
|
||||
|
||||
|
||||
6
twitterConfig_DEMO.json
Normal file
6
twitterConfig_DEMO.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"consumer_key": "xxxxxxxxxxxxxxxx",
|
||||
"consumer_secret": "xxxxxxxxxxxxxxxx",
|
||||
"access_token_key": "xxxxxxxxxxxxxxxx",
|
||||
"access_token_secret": "xxxxxxxxxxxxxxxx"
|
||||
}
|
||||
Reference in New Issue
Block a user