Browse Source

small update, code cleaned

master
arnaucode 7 years ago
parent
commit
55f58e2914
10 changed files with 7 additions and 13 deletions
  1. +4
    -4
      README.md
  2. +0
    -1
      analyzeDates.go
  3. BIN
      build/argos
  4. +1
    -1
      main.go
  5. +0
    -1
      optionDeleteTweets.go
  6. +1
    -3
      optionFollowRandom.go
  7. +1
    -0
      optionTweetRandom.go
  8. +0
    -1
      optionUnfollowAll.go
  9. +0
    -1
      printSortedMapStringInt.go
  10. +0
    -1
      readConfigTokensAndConnect.go

+ 4
- 4
README.md

@ -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

+ 0
- 1
analyzeDates.go

@ -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

BIN
build/argos


+ 1
- 1
main.go

@ -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")

+ 0
- 1
optionDeleteTweets.go

@ -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)

+ 1
- 3
optionFollowRandom.go

@ -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)

+ 1
- 0
optionTweetRandom.go

@ -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)

+ 0
- 1
optionUnfollowAll.go

@ -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

+ 0
- 1
printSortedMapStringInt.go

@ -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)
}
}

+ 0
- 1
readConfigTokensAndConnect.go

@ -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 --> ")

Loading…
Cancel
Save