使用twitteR包检索maxID给出意外结果的用户时间轴

时间:2016-09-13 15:34:34

标签: r twitter

我正在尝试检索帐户的整个时间轴,在阅读了推特API之后,我编写了以下代码:

healthLeadersTimeline <- twListToDF(userTimeline("HealthLeaders", n=200, includeRts=TRUE, retryOnRateLimit=180))
write.table(healthLeadersTimeline, "health.csv", sep=",", row.names=FALSE)
maxID <- getMaxID(last(healthLeadersTimeline)$id)
healthLeadersTimeline <- twListToDF(userTimeline("HealthLeader", n=200, maxID=maxID, includeRts=TRUE, retryOnRateLimit=180))
write.table(healthLeadersTimeline, "health.csv", sep=",", append=TRUE, col.names=FALSE, row.names=FALSE)

和getMaxID实现如下:

getMaxID <- function (tweetID) {
  lastID <- as.numeric(tweetID)
  maxID <- toString(lastID -1)
  return(maxID)
}

这个Twitter帐户显然有超过400条推文。但在第二次调用时间线时,我只能检索35条推文。 我在这做错了什么?

1 个答案:

答案 0 :(得分:0)

你没有做错任何事,除非可能没有阅读docs :)。 3200是您可以从时间线正式获得的最大帖子数。

相关问题