r语言 - 搜索twitter并通过标签获取tweet,最大化返回的搜索结果数量



我正在尝试使用r中的 Twitter包从Twitter的API编译与世界杯相关的所有tweet的语料库。

我对单个标签使用以下代码(例如)。然而,我的问题是,我似乎只被"授权"访问一组有限的tweet(在这种情况下,只有最近的32条)。

library(twitteR)
reqURL <- "https://api.twitter.com/oauth/request_token"
accessURL <- "https://api.twitter.com/oauth/access_token"
authURL <- "http://api.twitter.com/oauth/authorize"
#consumerKey <- Omitted
#consumerSecret <- Omitted
twitCred <- OAuthFactory$new(consumerKey=consumerKey,
                             consumerSecret=consumerSecret,
                             requestURL=reqURL,
                             accessURL=accessURL,
                             authURL=authURL)
options(RCurlOptions = list(cainfo = system.file("CurlSSL", "cacert.pem", package =  "RCurl")))
twitCred$handshake()
#setwd("/Users/user/FIFA")
#save(twitCred, file="twitterAuthentication.Rdata")
#load("twitterAuthentication.Rdata")
registerTwitterOAuth(twitCred)
FIFA<-searchTwitter("#WorldCup", n=9999, since='2007-10-30')

返回以下错误:

Warning message:
In doRppAPICall("search/tweets", n, params = params, retryOnRateLimit = retryOnRateLimit,  :
  9999 tweets were requested but the API can only return 32

我的问题是:如何使用特定标签访问tweet的最大数量?(另外,有人能澄清一下"最大"限制实际上是什么吗?为什么我似乎无法接近这个值(~ 1500条推文)?

我在Twitter Developer网站内测试了OAuth,并分别获得了签名基字符串、授权头和cURL命令的签名结果,这表明我有适当的权限&;授权从Twitter的服务器提取适当的数据。如果我错了,或者如果你需要更多的信息,请告诉我/纠正我。

我的API权限目前设置为:读,写&访问直接消息

Session Info:
R version 3.0.2 (2013-09-25)
Platform: x86_64-apple-darwin10.8.0 (64-bit)
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     
other attached packages:
[1] RJSONIO_1.0-3  twitteR_1.1.7  rjson_0.2.12   ROAuth_0.9.3   digest_0.6.3   RCurl_1.95-4.1 bitops_1.0-5  
[8] foreign_0.8-55
loaded via a namespace (and not attached):
[1] tools_3.0.2

额外的资源/来源:

使用searchTwitter()查询最多推文

这个源声明最大值是1500

Twitter api搜索推文中的标签

这个源声明最大值是3200

这是不可能的,

使用Twitter搜索API

"搜索API不是所有推文的完整索引,而是一个最近推文的索引。目前,该指数在6-9之间几天的推特。"

这个响应是为那些仍然在寻找类似问题的人提供的…你可以包括一个额外的参数"resultType",并提到如果你想要"流行"或"最近"的帖子。

FIFA <- searchTwitter("#WorldCup", n=9999, since='2007-10-30', resultType = 'recent')

最新更新