anaconda icon indicating copy to clipboard operation
anaconda copied to clipboard

No differences between Text and FullText

Open apaillarse opened this issue 7 years ago • 7 comments

Hello, First of all thanks for this good library ! I'm having a problem retrieving the full length of tweets when they are truncated. I'm using the following simple code :

api := anaconda.NewTwitterApi(accessToken, accessTokenSecret)

stream := api.PublicStreamFilter(url.Values{
	"track": trackingArray,
})
defer stream.Stop()

for v := range stream.C {
        t, ok := v.(anaconda.Tweet)
	if !ok {
		logrus.Warningf("received unexpected value of type %T", v)
		continue
	}
	fmt.Print(t.Text)
	fmt.Print(t.FullText)
}

Both printing methods print exactly the same tweet (the full tweet if its length is low and a truncated tweet if its length is over 140 characters). It may be a dumb question as I'm not an expert in programming. Anyway thanks for the time you spend responding to me.

apaillarse avatar Oct 18 '17 13:10 apaillarse

@apaillarse: Thanks for your report! Can you check if the problem still exists if you initialize the stream like this:

...
v := url.Values{}
v.Set("tweet_mode", "extended")
v.Set("track", trackingArray)
stream := api.PublicStreamFilter(v)
...

muesli avatar Nov 18 '17 02:11 muesli

Yep, I hit the same issue, but with tweet_mode set to extended it looks good now. Thanks.

krisiasty avatar Nov 19 '17 23:11 krisiasty

It didn't change anything for me... Can you share your code @krisiasty ?

apaillarse avatar Dec 06 '17 10:12 apaillarse

I thought I had this issue but what I found was if it was a retweet, the FullText is always truncated (it's as received). If you check if tweet.RetweetedStatus != nil { originalFull_text = tweet.RetweetedStatus.FullText } you will get the >140 chars version

jnflint avatar Mar 31 '18 08:03 jnflint

@jnflint I believe that is how the Twitter API behaves and how it is documented.

muesli avatar Mar 31 '18 08:03 muesli

@muesli yes, I was just mentioning as the stream I am looking at has a very high level of retweets so it looked like there was a problem when there wasn't. Thought I would mention it in case someone else thought the shorten text in retweets was a problem

jnflint avatar Mar 31 '18 08:03 jnflint

perhaps it would be helpful to have this in the readme :)

wotzhs avatar Apr 04 '18 10:04 wotzhs