r - Twitter app is not getting started -


i have written following script extract tweets twitter.

library("twitter") library("roauth") library("rcurl") library("httr") download.file(url="http://curl.haxx.se/ca/cacert.pem",destfile="cacert.pem") ck <- '4qpoqjoibgogp7ju13akxfp2e' cs <- 'ued02vupial3k8nw8foectzj1uftsefqetqjbyxd21ucj0ohjc' ak <- '136316586-xwncmre5uyszigtowtvyr4nh4gfr01adpr5sf5ik' <- 'zsij4lsdc5xkcdyofwkyijknuy8uj71sg1nfaifkzbgc2' requrl<- 'https://api.twitter.com/oauth/request_token' acurl <- 'https://api.twitter.com/oauth/access_token' auurl <- 'https://api.twitter.com/oauth/authorize' cred <- oauthfactory$new(consumerkey=ck,consumersecret=cs,requesturl=requrl,accessurl=acurl,authurl=auurl) cred$handshake(cainfo="cacert.pem") save(cred, file="twitter_authentication.rdata") load("twitter_authentication.rdata") oauth_endpoints("twitter") myapp <- oauth_app("twitter",key=ck,secret=cs) twitter_token <- oauth1.0_token(oauth_endpoints("twitter"), myapp) setup_twitter_oauth(ck,cs) search.string <- "#bahubali" no.of.tweets <- 10 tweets <- searchtwitter(search.string, n=no.of.tweets, lang="en") tweets write.csv(tweets, file='/home/horopter/tweet/csvtweets.csv', row.names=f) 

however setup_twitter_oauth(ck,cs) [1] "using browser based authentication" waiting authentication in browser... press esc/ctrl + c abort

and stuck there. website either says 'you not have permissions.' or doesn't open @ all. if don't give callback url, doesn't authenticate, otherwise gets stuck again aforementioned. me out here.

i used tried using same code , authentication token , here code worked me. setup_twitter_oauth requires ck, cs, ak, as arguments.

library("twitter") library("roauth") library("rcurl")  library("httr") download.file(url="http://curl.haxx.se/ca/cacert.pem",destfile="cacert.pem") ck <- '4qpoqjoibgogp7ju13akxfp2e' cs <- 'ued02vupial3k8nw8foectzj1uftsefqetqjbyxd21ucj0ohjc' ak <- '136316586-xwncmre5uyszigtowtvyr4nh4gfr01adpr5sf5ik' <- 'zsij4lsdc5xkcdyofwkyijknuy8uj71sg1nfaifkzbgc2' setup_twitter_oauth(ck,cs, ak, as) search.string <- "#bahubali" 

this should setup authentication once have downloaded .pem file. when asks authentication press 1.


Comments

Popular posts from this blog

php - Zend Framework / Skeleton-Application / Composer install issue -

c# - Better 64-bit byte array hash -

python - PyCharm Type error Message -