mirror of
https://github.com/arnaucube/argos.git
synced 2026-02-07 02:56:41 +01:00
implemented analysis of tweet, getting retweets to detect Bots
This commit is contained in:
BIN
build/argos
BIN
build/argos
Binary file not shown.
@@ -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
|
||||
}
|
||||
|
||||
7
main.go
7
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
optionAnalyzeTweet.go
Normal file
35
optionAnalyzeTweet.go
Normal file
@@ -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))
|
||||
}
|
||||
Reference in New Issue
Block a user