I've registered my oath about 5 times now, but... (twitteR package R)
- by user2985989
I'm attempting to mine twitter data in R, and am having trouble getting started. I created a twitter account, an app in twitter developers, changed the settings to read, write, and access, created my access token, and followed instructions to the letter in registering it:
My code:
> library(twitteR)
> download.file(url="http://curl.haxx.se/ca/cacert.pem",
+ destfile="cacert.pem")
> requestURL <- "https://api.twitter.com/oauth/request_token"
> accessURL <- "https://api.twitter.com/oauth/access_token"
> authURL <- "https://api.twitter.com/oauth/authorize"
> consumerKey <-"my key" #took this part out for privacy's sake
> consumerSecret <- "my secret" #this too
> twitCred <- OAuthFactory$new(consumerKey=consumerKey, consumerSecret = consumerSecret, requestURL = requestURL, accessURL = accessURL, authURL = authURL)
> twitCred$handshake(cainfo="cacert.pem")
To enable the connection, please direct your web browser to:
https://api.twitter.com/oauth/authorize?oauth_token=zxgHXJkYAB3wQ2IVAeyJjeyid7WK6EGPfouGmlx1c
When complete, record the PIN given to you and provide it here: 0010819
> registerTwitterOAuth(twitCred)
[1] TRUE
> save(list="twitCred", file="twitteR_credentials")
And yet, this:
> s <- searchTwitter('#United', cainfo="cacert.pem")
[1] "Unauthorized"
Error in twInterfaceObj$doAPICall(cmd, params, "GET", ...) :
Error: Unauthorized
I'm about to have a temper tantrum. I'd be extremely grateful if someone could explain to me what is going wrong, or, better yet, how to fix it.
Thank you.