osx - R package TwitteR setup with Twitter API -
i attempting setup r's twitter package query tweets , unfamiliar oauth authorization process. prior posts similar 1 have not indicated necessity go website , enter number string (which message recieve when attempting authenticate). has process changed in last year? need enter accesstoken
, accesssecret
when authenticating?
prior discussions on subject here:
roauth , twitter, mac os x 10.7, r 2.15
twitter, roauth , windows: register ok, certificate verify failed
here r code using , command line responses:
> rm(list=ls()) > install.packages("twitter") > install.packages("roauth") > library("twitter") > library('roauth') > requesturl <- "https://api.twitter.com/oauth/request_token" > accessurl = "http://api.twitter.com/oauth/access_token" > authurl = "http://api.twitter.com/oauth/authorize" > consumerkey = "......................" # generated twitter api: httl://twitter.com/apps/new > consumersecret = "....................." # generated twitter api > cred <- oauthfactory$new(consumerkey=consumerkey, consumersecret=consumersecret, requesturl=requesturl, accessurl=accessurl, authurl=authurl) > cred$handshake(cainfo = system.file("curlssl", "cacert.pem", package = "rcurl")) enable connection, please direct web browser to: http://api.twitter.com/oauth/authorize?oauth_token=w09uecpe4fuiomnx4zhxnrbijoqsntd4jy0shu0xo when complete, record pin given , provide here: > registertwitteroauth(cred) error: forbidden
i have attempted type code provided yields same error message. experience problem?
system info: r version 3.1.0 (2014-04-10) -- "spring dance" copyright (c) 2014 r foundation statistical computing platform: x86_64-apple-darwin13.1.0 (64-bit)
update (jun 3rd, 2014): use github libraries solve problem
#install.packages(c("devtools", "rjson", "bit64")) # intentional exclusion of ', "httr"' # (2) restart r #install.packages("devtools") library("devtools", lib.loc="/users/wschram/library/r/3.1/library") devtools::install_github("hadley/httr") library("httr", lib.loc="/users/wschram/library/r/3.1/library") # github httr install_github("twitter", username="geoffjentry") library(twitter) setup_twitter_oauth(api_key, api_secret, accesstoken, accesssecret) tweets <- searchtwitter('#beer', n=50) head(tweets)
Comments
Post a Comment