【发布时间】:2016-09-15 22:20:25
【问题描述】:
我正在尝试检索一个帐户的整个时间线,在阅读了 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 条推文。 我在这里做错了什么?
【问题讨论】: