R and twitteR - userTimeline() function not return

2019-04-14 05:46发布

Why can't I get the number of tweets I request when I use the userTimeline() function in the twitteR package ? I now the limit request for a user timeline is 3200 tweets but I just get about 10% of that...

Here are two examples :

In this example 'googledevs' account has only 2,000 tweets so I did ask for 1000 tweets and I still only got 106...

> library(twitteR)
> load('OAuth.RData')
> test <- userTimeline(user = 'googledevs', n=1000)
> length(test)
[1] 106

In this example 'FiveThirtyEight' has 5622 tweets. So I asked for 3200 and only got 317...

> library(twitteR)
> load('OAuth.RData')
> test2 <- userTimeline(user = 'FiveThirtyEight', n=3200)
> length(test2)
[1] 317

Can someone help me fix this ? Thank you

4条回答
Summer. ? 凉城
2楼-- · 2019-04-14 05:52

You need to include the includeRts=TRUE argument in your userTimeline call. This will return the minimum of 3200 posts and the total posts on the user's timeline.

查看更多
相关推荐>>
3楼-- · 2019-04-14 06:05

The Twitter API will only return tweets from the past week or so. See the documentation.

"The Search API is not complete index of all Tweets, but instead an index of recent Tweets. At the moment that index includes between 6-9 days of Tweets."

查看更多
够拽才男人
4楼-- · 2019-04-14 06:11

You need to include the includeRts=TRUE argument in your userTimeline call. This should give you the max of the number of tweets on the user's timeline and 3200.

查看更多
倾城 Initia
5楼-- · 2019-04-14 06:16

I believe the problem is that while it is only retrieving a certain number of tweets it is going through the maximum number you set. It includes retweets and replies. If you set to true the include replies and retweets options you should retrieve the total number of tweets you set. A nice workaround this limit is "making" time windows using the tweets ID and the sinceID and maxID options.

查看更多
登录 后发表回答