small update, code cleaned

This commit is contained in:
arnaucode
2017-04-21 10:21:17 +02:00
parent 2e1d99c387
commit 55f58e2914
10 changed files with 7 additions and 13 deletions

View File

@@ -1,6 +1,6 @@
http://arnaucode.com/argos/
# argos
# argos [![Go Report Card](https://goreportcard.com/badge/github.com/arnaucode/argos)](https://goreportcard.com/report/github.com/arnaucode/argos)
twitter analyzer written in Go lang, insipired on the Python tweets_analyzer by x0rz https://github.com/x0rz/tweets_analyzer
#### Argos Panoptes
@@ -21,10 +21,10 @@ https://en.wikipedia.org/wiki/Panopticon
- Devices used
- Hashtags most used count
- Interactions with other users count
2. Delete Tweets
3. Unfollow all
4. Random follow
2. Unfollow all
3. Random follow
- selects n number of accounts to follow, and follows n random accounts
4. Delete Tweets
5. Random tweet
- post a tweet with content from a selected account

View File

@@ -59,7 +59,6 @@ func printDays(days map[string]int) {
func analyzeDays(tweets []twitter.Tweet) {
var days = make(map[string]int)
for _, v := range tweets {
//fmt.Println(v.CreatedAt)
day := strings.Split(v.CreatedAt, " ")[0]
if _, ok := days[day]; ok {
days[day] = days[day] + 1

Binary file not shown.

View File

@@ -11,7 +11,7 @@ const version = "0.1-dev"
const minNumWords = 10
const minNumHashtag = 2
const minNumUserInteractions = 1
const iterationsCount = 1
const iterationsCount = 3
func main() {
c.Yellow("Argos Panoptes")

View File

@@ -39,7 +39,6 @@ func printUserData(user *twitter.User) {
func deleteTweets(client *twitter.Client, user *twitter.User) {
tweets := getTweets(client, user.ScreenName, iterationsCount)
count := 0
//fmt.Println(tweets)
for _, v := range tweets {
c.Red("deleting: [id: " + v.IDStr + "] " + v.Text)
deleted, _, _ := client.Statuses.Destroy(v.ID, nil)

View File

@@ -28,9 +28,8 @@ func getUserToFollowFromUser(client *twitter.Client, fromUser string) string {
}
if httpResp.Status != "200 OK" {
c.Red(httpResp.Status)
c.Purple("maybe twitter has blocked the account, CTRL+C, wait 15 minutes and try again")
}
//fmt.Println(friends.Users)
//c.Green("@" + friends.Users[0].ScreenName)
return friends.Users[0].ScreenName
}
@@ -44,7 +43,6 @@ func followUser(client *twitter.Client, screenName string) {
func followRandom(client *twitter.Client, nFollow int, screenName string) {
fmt.Println("Starting to follow " + strconv.Itoa(nFollow) + " users")
//screenName := firstScreenName
for i := 0; i < nFollow; i++ {
userToFollow := getUserToFollowFromUser(client, screenName)
followUser(client, userToFollow)

View File

@@ -17,6 +17,7 @@ func postTweet(client *twitter.Client, content string) {
}
if httpResp.Status != "200 OK" {
c.Red("error: " + httpResp.Status)
c.Purple("maybe twitter has blocked the account, CTRL+C, wait 15 minutes and try again")
}
fmt.Print("tweet posted: ")
c.Green(tweet.Text)

View File

@@ -37,7 +37,6 @@ func getFollowingUsers(client *twitter.Client, user *twitter.User) {
if httpResp.Status != "200 OK" {
c.Red(httpResp.Status)
}
//fmt.Println(following)
for _, k := range following.Users {
unfollowUser(client, k.ScreenName)
//wait to avoid the twitter api limitation

View File

@@ -22,7 +22,6 @@ func printSortedMapStringInt(m map[string]int, threshold int) map[int][]string {
sort.Sort(sort.Reverse(sort.IntSlice(a)))
for _, k := range a {
for _, s := range n[k] {
//fmt.Printf("%d (%d)- %s,\n", k, tantPerCent, s)
fmt.Println(strconv.Itoa(k) + " - " + s)
}
}

View File

@@ -24,7 +24,6 @@ func readConfigTokensAndConnect() (client *twitter.Client) {
}
content := string(file)
json.Unmarshal([]byte(content), &config)
//fmt.Printf("%+v\n", config)
fmt.Println("twitterConfig.json read comlete")
fmt.Print("connecting to twitter api --> ")