socialnetworknews-api

git clone git://archive.git.mtrnord.blog/SocialNetworkNews/socialnetworknews-api.git
Log | Files | Refs | LICENSE

commit 92ee33806426654dcfb0213f337c5fc8068ec8d0
parent f5aff1fcca3c62c9a3c90b6614169f9c8e0fab0a
Author: MTRNord <mtrnord1@gmail.com>
Date:   Wed, 28 Mar 2018 17:33:37 +0200

Don't duplicate tweets if it got retweeted

Diffstat:
Mtwitter/twitter.go | 7++++++-
1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/twitter/twitter.go b/twitter/twitter.go @@ -219,8 +219,13 @@ func (t *TwitterAPI) GetTweets(tweets []int64) ([]byte, error) { if tweetsSlice[t.IdStr] { continue } + if tweetsSlice[t.RetweetedStatus.IdStr] { + continue + } if t.RetweetedStatus != nil { JT.Retweet = true + tweetsSlice[t.IdStr] = true + tweetsSlice[t.RetweetedStatus.IdStr] = true if retweets[t.RetweetedStatus.IdStr] { continue } else { @@ -231,8 +236,8 @@ func (t *TwitterAPI) GetTweets(tweets []int64) ([]byte, error) { } } else { JT.Retweet = false + tweetsSlice[t.IdStr] = true } - tweetsSlice[t.IdStr] = true // If we got a retweet get the data of the original tweet if JT.Retweet { JT.Username = t.RetweetedStatus.User.ScreenName