Home > Net >  How to get full RT tweet text with academictwitteR package?
How to get full RT tweet text with academictwitteR package?

Time:05-20

I'm trying to get all tweets and retweets mentioning Obama or Trump from a certain period of time with the academictwitteR package. The problem I'm facing is that every retweet comes with "..." instead the full text (desired output). This is the code I'm using to do this.

  variable <-
      get_all_tweets(
        query = c("Obama", "Trump"),
        start_tweets = "2010-01-01T00:00:00Z",
        end_tweets = "2022-05-11T00:00:00Z",
        n = 100000)

I've done some research and I've found this post (When I use the package AcademicTwitterR and function 'get_all_tweets' it seems to return the shortened version of the original tweet), where is asked how to avoid shortened tweets, with academictwitteR package, but i didn't understood the answers with implementations of the solution. For eg., this code is showed as a solution: bind_tweets(data_path = "tweetdata") %>% as_tibble I don't know where to put it in my code. Can anyone show me a full code example to deal with this problem?

CodePudding user response:

The idea is to download the tweets as json instead of immediately binding them into a dataframe, which apparently truncates the retweets.

variable <-
      get_all_tweets(
        query = c("Obama", "Trump"),
        start_tweets = "2010-01-01T00:00:00Z",
        end_tweets = "2022-05-11T00:00:00Z",
        n = 100000,
        data_path = "tweetdata",
        bind_tweets = FALSE)

Then the raw data can be pulled in with:

tweet_data <- bind_tweets(data_path = "tweetdata", output_format = "raw")
  • Related