0

我想将 R 连接到 Twitter。我已按照此处设置的步骤操作:http: //cran.r-project.org/web/packages/twitteR/vignettes/twitteR.pdf

我拥有的代码如下:

library(ROAuth)
cred <- OAuthFactory$new(consumerKey="xyz",
consumerSecret=xyz",
requestURL="https://api.twitter.com/oauth/request_token",
accessURL="https://api.twitter.com/oauth/authorize",
authURL="https://api.twitter.com/oauth/access_token")
cred$handshake(ssl.verifypeer = FALSE)

当我获得推特链接时: https ://api.twitter.com/oauth/access_token?oauth_token=YZZOYJ1liH1TDEY8G6Eb3YmgAWQlgGiEfAzI1ADwZ4

并将其加载到我的浏览器中,它会返回一个空白页面,其中没有关于 PIN 的信息。谁能告诉我为什么这个链接是空白的

4

1 回答 1

0

因为您访问了错误的 URL 来进行授权。交换你的authaccess网址!

accessURL="https://api.twitter.com/oauth/access_token",
authURL="https://api.twitter.com/oauth/authorize")

#You should get...
Cred$handshake(cainfo = system.file("CurlSSL", "cacert.pem", package = "RCurl") )   
To enable the connection, please direct your web browser to: 
http://api.twitter.com/oauth/authorize?oauth_token=someaccessstokenvalue
When complete, record the PIN given to you and provide it here: 

#Final step to register connections
registerTwitterOAuth(Cred)
于 2013-03-10T07:07:31.053 回答