mirror of
https://github.com/arnaucube/twitterReader.git
synced 2026-02-06 19:26:46 +01:00
if there is a link, is not read
This commit is contained in:
5
main.go
5
main.go
@@ -7,10 +7,11 @@ func main() {
|
||||
for i := 0; i < len(tweets); i++ {
|
||||
c.Cyan(tweets[i].User.ScreenName + ": " + tweets[i].Text)
|
||||
c.Green(tweets[i].Lang)
|
||||
content := removeLinks(tweets[i].Text)
|
||||
if tweets[i].Lang == "en" {
|
||||
festivalEn(tweets[i].User.ScreenName + ": " + tweets[i].Text)
|
||||
festivalEn(tweets[i].User.ScreenName + ": " + content)
|
||||
} else {
|
||||
festivalCa(tweets[i].User.ScreenName + ": " + tweets[i].Text)
|
||||
festivalCa(tweets[i].User.ScreenName + ": " + content)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
|
||||
func getTimeline(client *twitter.Client) []twitter.Tweet {
|
||||
homeTimelineParams := &twitter.HomeTimelineParams{
|
||||
Count: 4,
|
||||
Count: 50,
|
||||
}
|
||||
tweets, _, _ := client.Timelines.HomeTimeline(homeTimelineParams)
|
||||
return (tweets)
|
||||
|
||||
BIN
twitterReader
BIN
twitterReader
Binary file not shown.
16
utils.go
Normal file
16
utils.go
Normal file
@@ -0,0 +1,16 @@
|
||||
package main
|
||||
|
||||
import "strings"
|
||||
|
||||
func removeLinks(text string) string {
|
||||
words := strings.Split(text, " ")
|
||||
var cleaned []string
|
||||
for i := 0; i < len(words); i++ {
|
||||
if strings.Contains(words[i], "http") {
|
||||
|
||||
} else {
|
||||
cleaned = append(cleaned, words[i])
|
||||
}
|
||||
}
|
||||
return strings.Join(cleaned, " ")
|
||||
}
|
||||
Reference in New Issue
Block a user