1

I was trying to fetch tweets twitter using search API and R. I can fetch the tweets using following codes. However, I am unable to save the tweets in a file. I would like to save those in a JSON file. But somehow it provides me an encrypted file as the attached image. Can you please give me any idea why this is happening? I check the output of "tweets". It showing the tweets are there.

setup_twitter_oauth(api_key, api_secret, token, token_secret)
# Run Twitter Search. Format is searchTwitter("Search Terms", n=100, lang="en", geocode="lat,lng", also accepts since and until).

tweets <- searchTwitter("iphone", n=100, lang="en", since="2014-08-20")
save(tweets, file="export.JSON")

Encrypted output file

  • `save()` writes an external representation of the R object (`tweets` in this case). Just because the file extension is specified as .JSON doesn't mean it's written in JSON format. You may wish to check the answer to [this](https://stackoverflow.com/questions/24662303/saving-a-json-object-to-file-json) question. – Z.Lin Sep 13 '17 at 05:36

0 Answers0