I've been pulling twitter for about a month now using the following code library (RCurl) library (twitteR) library (streamR) library (ROAuth)
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"
consumersecret = "my secret"
cred <-OAuthFactory$new(consumerKey=consumerkey,consumerSecret=consumersecret,requestURL=requestURL,accessURL=accessURL,authURL=authURL)
cred$handshake (cainfo=system.file("CurlSSL","cacert.pem",package ="RCurl"))
Usually this works, but some times I follow the hyperlink to the pin, paste the pin and get [1] in return. No matter what I write, I just keep getting [1]. Then when I try to submit a request, I'm told it requires OAuth (below). What am I doing wrong? Thank you so much for any help!
Error in twInterfaceObj$doAPICall(cmd, params, "GET", ...) :
OAuth authentication is required with Twitter's API v1.1
If you keep need to do this every time you want the get Twitter data with the streamR package with R. In your code, just add the following:
This will save your credentials in a file called credentials.RData. Then the only thing you have to do every time you want new Twitter data is load the file doing the following:
Hope it helps!