I am using the twitteR
package for R
to collect some tweets. However, I noticed that the Tweet text returned by the searchTwitter
function is not the complete tweet text, but abridged to equal exactly 140 characters with the rest of the text replaced by a link to the tweet on the web.
Using a tweet I found for an example:
require(twitteR)
require(ROAuth)
# authorize twitter with consmuer and access key/secret
setup_twitter_oauth(AAA, BBB, CCC, DDD) # actual secret codes go here...
# get sample tweet
tweet <- searchTwitter("When I was driving around earlier this afternoon I only saw two Hunters",
n=500,
since = "2017-11-04",
until = "2017-11-05",
retryOnRateLimit=5000)
# print tweet
tweet[[1]]
[1] "_TooCrazyFox_: When I was driving around earlier this afternoon I only saw two Hunters but it was during the midday break. I didn'… *SHORTENEDURL*"
# the *SHORTENEDURL* is actually a link that brings you to the tweet; stackoverflow didn't want me to a put shortened urls in here
# convert to data frame
df <- twListToDF(tweet)
# output text and ID
df$text
[1] "When I was driving around earlier this afternoon I only saw two Hunters but it was during the midday break. I didn'… *SHORTENEDURL*"
df$id
[1] "926943636641763328"
If I go to this tweet via my web browser, it is clear that twitteR
shortened the text to 140 characters and included a link to the tweet containing the whole text.
I don't see any mention of this in the twitteR
documentation. Is there any way to retain the entire tweet text during a search?
My assumption is that this is related to the change in Twitter character length as referenced here: https://developer.twitter.com/en/docs/tweets/tweet-updates (in the 'Compatibility mode JSON rendering'). This implies that I need to retrieve the full_text
field, rather than the text
field. However, this does not seem to be supplied by twitteR
.