unable to read Json file using stream_tweets

Hi!

I’m a beginner who’s new to the Rtweet package so please bear with me.
I’m using the rtweet package within R studio and trying to stream tweets via the Twitter API.

I’ve created an app and received access to the Twitter API. Collecting tweets via the search_tweets function works like a charm.

However, when I use the stream_tweets function, I am able to generate a json file with the collected data. The issue is that R returns this file as NULL. I’ve tried to both setting parse to T, and also setting parse = F and then use the parse_stream function on my json file, but R studio still returns NULL.

I tried two options:

stream <- stream_tweets(
  q = "ice cream",
  timeout = 5,
)
stream <- stream_tweets(
  q = "ice cream",
  timeout = 5,
  file_name = "ice"
)

They both save a json file with collected tweets in my directory, but Rstudio only returns the file as NULL.

Most thankful for any help on this issue! Will happily provide more information if necessary!

Which version of rtweet and R are you using? Are you authenticated and can do other searches when this happens? This might br a problem on how stream tweets works, but I haven’t modified it on a while so I doubt it.

1 Like