ChimeraCoder / anaconda

A Go client library for the Twitter 1.1 API
MIT License
1.14k stars 247 forks source link

No differences between Text and FullText #213

Open apaillarse opened 6 years ago

apaillarse commented 6 years ago

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.

muesli commented 6 years ago

@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)
...
krisiasty commented 6 years ago

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

apaillarse commented 6 years ago

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

jnflint commented 6 years ago

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

muesli commented 6 years ago

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

jnflint commented 6 years ago

@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

wotzhs commented 6 years ago

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