Browse Source

implemented analysis of tweet, getting retweets to detect Bots

master
arnaucode 7 years ago
parent
commit
2716285451
6 changed files with 59 additions and 1 deletions
  1. BIN
      argos
  2. BIN
      build/argos
  3. +11
    -0
      getOperations.go
  4. +6
    -1
      main.go
  5. +35
    -0
      optionAnalyzeTweet.go
  6. +7
    -0
      todo.md

BIN
argos


BIN
build/argos


+ 11
- 0
getOperations.go

@ -84,3 +84,14 @@ func printUserData(user *twitter.User) {
fmt.Print("number of favs: ")
c.Purple(strconv.Itoa(user.FavouritesCount))
}
func getRetweets(client *twitter.Client, tweetId int64) []twitter.Tweet {
var tweets []twitter.Tweet
tweets, _, err := client.Statuses.Retweets(tweetId, &twitter.StatusRetweetsParams{
Count: 200,
})
if err != nil {
fmt.Println(err)
}
return tweets
}

+ 6
- 1
main.go

@ -66,6 +66,7 @@ func main() {
4 - Delete Tweets
5 - Delete Favs (Likes)
6 - Tweet Random
7 - Analyze tweet
0 - Exit script
option to select: `
for {
@ -98,9 +99,13 @@ option to select: `
optionDeleteFavs(client)
break
case "6":
fmt.Println("selected 5 - Tweet random")
fmt.Println("selected 6 - Tweet random")
optionTweetRandom(client)
break
case "7":
fmt.Println("selected 7 - Analyze Tweet")
optionAnalyzeTweet(client)
break
case "0":
fmt.Println("selected 0 - exit script")
os.Exit(3)

+ 35
- 0
optionAnalyzeTweet.go

@ -0,0 +1,35 @@
package main
import (
"bufio"
"fmt"
"os"
"strconv"
"strings"
"github.com/dghubble/go-twitter/twitter"
)
func optionAnalyzeTweet(client *twitter.Client) {
newcommand := bufio.NewReader(os.Stdin)
fmt.Print("enter link of the tweet: ")
link, _ := newcommand.ReadString('\n')
link = strings.TrimSpace(link)
fmt.Print("link selected: ")
c.Cyan(link)
fmt.Println("-----------------------")
linkParam := strings.Split(link, "/")
tweetIdStr := linkParam[len(linkParam)-1]
c.Cyan(tweetIdStr)
tweetId, err := strconv.ParseInt(tweetIdStr, 10, 64)
if err != nil {
fmt.Println(err)
}
tweets := getRetweets(client, tweetId)
for _, tweet := range tweets {
source := strings.Split(strings.Split(tweet.Source, ">")[1], "<")[0]
fmt.Println(tweet.CreatedAt + " @" + tweet.User.ScreenName + ", source: " + source)
}
fmt.Print("total of: ")
fmt.Println(len(tweets))
}

+ 7
- 0
todo.md

@ -0,0 +1,7 @@
- error when getting user from user following list, and this user don't have users following
```
optionFollowRandom.go
line 33
```
just need to check if the user have following users, and if not, get another user to follow

Loading…
Cancel
Save