搜索推特并通过标签获取推文,从而最大程度地返回返回的搜索结果 [英] Search twitter and obtain tweets by hashtag, maximizing number of returned search results

查看:218
本文介绍了搜索推特并通过标签获取推文,从而最大程度地返回返回的搜索结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正尝试使用R中的 twitteR软件包 ,从其API上,通过其API在Twitter上编译与世界杯相关的所有Tweet的语料库。

I am attempting to compile a corpus of all Tweets related to the World Cup on Twitter from their API using the twitteR package in R.

我将以下代码用于单个主题标签(例如)。但是,我的问题是,我似乎仅被授权访问有限的一组推文(在这种情况下,仅访问32条最新的推文)。

I am using the following code for a single hashtag (for example). However, my problem is that it appears I am only 'authorized' to access a limited set of the tweets (in this case, only the 32 most recent).

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条推文)的地方?

My question is: How do I access the maximum number of tweets using a specific hashtag? (Also, could someone clarify what the 'max' limit actually is? And why I can't seem to get anywhere close to this value of (~ 1500 tweets)?

我已经在Twitter Developer网站上测试了OAuth,并分别获得了签名基本字符串,授权标头和cURL命令的签名结果,向我表明我具有适当的绘制权限和授权来自Twitter服务器的适当数据。如果我错了,或者如果您需要进一步的信息,请告知/纠正我。

I have tested OAuth within the Twitter Developer website and obtained signing results for the Signature base string, authorization header, and cURL commands respectively, indicating to me that I have the appropriate permissions & authorizations to draw the appropriate data from Twitter's servers. Please advise/correct me if I am wrong, or if you need further information on this.

我的API权限当前设置为:读取,编写和访问直接消息

My API Permissions are currently set to: Read, Write & Access direct messages

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()

R的最大tweets中的twitter包此消息指出最大值为1500

This source states the max is 1500

Twitter api搜索鸣叫主题标签

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

This source states the max is 3200

推荐答案

这是不可能的

使用Twitter搜索API


不是所有推文的完整索引,而是最近推文的
索引。目前,该索引包含6至9天
天的推文。

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

这篇关于搜索推特并通过标签获取推文,从而最大程度地返回返回的搜索结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆