I did all the steps
> library(ROAuth)
> reqURL <- "https://api.twitter.com/oauth/request_token"
> accessURL <- "http://api.twitter.com/oauth/access_token"
> authURL <- "http://api.twitter.com/oauth/authorize"
> consumerKey <- "xxxxxxxxxxxxxxx"
> consumerSecret <- "xxxxxxxxxxxxxxx"
> twitCred <- OAuthFactory$new(consumerKey=consumerKey,
+ consumerSecret=consumerSecret,
+ requestURL=reqURL,
+ accessURL=accessURL,
+ authURL=authURL)
> twitCred$handshake()
after that it told me to do this :
To enable the connection, please direct your web browser to:
http://api.twitter.com/oauth/authorize?oauth_token=gYBR6Z2pg2YExfMjAsNp8QmjkSwpwfa5nPQNtUdgMWw
When complete, record the PIN given to you and provide it here: registerTwitterOAuth(twitCred)
Error: Forbidden
I pasted my pin
> xyxabcd
it gave : [1] xyxabcd
I typed my query
> delta.tweets = searchTwitter('@abcdx', n=1500)
but it gave this error again.
Error in twInterfaceObj$doAPICall(cmd, params, "GET", ...) :
OAuth authentication is required with Twitter's API v1.1
[Dont use http but use https]
You can follow this step:
reqURL <- "https://api.twitter.com/oauth/request_token"
accessURL <- "https://api.twitter.com/oauth/access_token"
authURL <- "https://api.twitter.com/oauth/authorize"
consumerKey <- "Mjn6tdsadsadkasdklad2SV1l"
consumerSecret <- "58Z7Eldsdfaslkf;asldsaoeorjkfksaVCQtvri"
twitCred <- OAuthFactory$new(consumerKey=consumerKey,
consumerSecret=consumerSecret,
requestURL=reqURL,
accessURL=accessURL,
authURL=authURL)
twitCred$handshake()
After you run this code you will see in R console message like this :
To enable the connection, please direct your web browser to:
https://api.twitter.com/oauth/authorize?oauth_token=scmVODruosvz6Tdsdadadasdsa
When complete, record the PIN given to you and provide it here:
Just paste the link to your browser then authorize app, last one you will get the PIN code, just copy and paste the PIN code to your R console.
registerTwitterOAuth(twitCred)
R console will show TRUE if you success.
user <- getUser("xxx")
userTimeline(user, n=20, maxID=NULL, sinceID=NULL, includeRts=FALSE)
If still any problem just try to show your package version and update to the last version
sessionInfo()
update.packages("twitteR")
The last version for twitteR is 1.1.7 => http://cran.r-project.org/web/packages/twitteR/index.html
You can download twitteR manual => see page number 12 http://cran.r-project.org/web/packages/twitteR/twitteR.pdf