1

I'm trying to retrieve all the tweets from a specific users timeline (donald trump for example) using the userTimeline() function from the twitteR package. My problem is that the function is only returning 469 tweets, as opposed to the 3200 I've specified.

I saw this post of a similar problem, where the answer suggested that the Twitter API only returns tweets from the past week. But in my data, I can see tweets that were created nearly 3 months ago. Does anyone know a way that I can get the max number of tweets possible? If not, does anyone know why I'm getting tweets that were created longer than a week ago?

You can see my code below:

library(devtools)
library(httr)
install_github("twitteR", username = "geoffjentry")
library(twitteR)
setup_twitter_oauth(...."details")

mht=userTimeline('realDonaldTrump',n=3200)
tweets.df <- do.call(rbind, lapply(mht, as.data.frame))

Running this code will get me 469 tweets from his most recent to the 2016-08-12. I want to get as many tweets as possible from as a long a period as I can get.

Community
  • 1
  • 1
Eoin
  • 330
  • 1
  • 3
  • 15
  • Have you gone through their [documentation](https://dev.twitter.com/rest/public/search) - no idea why you can see tweets older than 7 days given [their own rules](http://stackoverflow.com/a/39993266/5977215) – SymbolixAU Nov 02 '16 at 02:37
  • Are the results paginated? I can't recall if `twitteR` handles this. – Jonathan Carroll Nov 02 '16 at 23:10
  • @JonathanCarroll What do you mean by paginated? This is my first time using twitteR as well, so I'm unfamiliar with the ins and outs of it at this time. – Eoin Nov 03 '16 at 14:19
  • @Eoin by pagination, think of when you search for results on Google. You get the first 10-20 and then you have to go to the next page. Some twitter api calls work the same, sending a next page token you can use to proceed to the next page of results. – calder-ty Dec 08 '16 at 14:17
  • This tool may help: https://github.com/pauldotknopf/twitter-dump – Paul Knopf Jan 06 '20 at 13:01

0 Answers0