gpt4 book ai didi

r - 搜索推特并通过hashtag获取推文,最大化返回搜索结果数量

转载 作者:行者123 更新时间:2023-12-04 20:08:26 25 4
gpt4 key购买 nike

我正在尝试使用 从他们的 API 编译与 Twitter 上与世界杯相关的所有推文的语料库。推特包在 R。

我将以下代码用于单个主题标签(例如)。但是,我的问题是,我似乎只有“授权”才能访问有限的一组推文(在这种情况下,只有 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

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

我已经在 Twitter 开发人员网站中测试了 OAuth,并分别获得了 Signature 基本字符串、授权 header 和 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

其他资源/来源:

twitter package in R maximum tweets using searchTwitter()

此消息来源指出最大值为 1500

Twitter api searching tweets for hashtags

此消息来源指出最大值为 3200

最佳答案

这不可能,

Using the Twitter Search API

"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."

关于r - 搜索推特并通过hashtag获取推文,最大化返回搜索结果数量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22313431/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com