Adding timeline while Extracting Twitter data in R -


i trying extract twitter data keyword using following code:

cred<- oauthfactory$new(consumerkey='xxxx', consumersecret='xxxx',                         requesturl='https://api.twitter.com/oauth/request_token',                         accessurl='https://api.twitter.com/oauth/access_token',                         authurl='https://api.twitter.com/oauth/authorize')  cred$handshake(cainfo = system.file("curlssl", "cacert.pem", package = "rcurl")) 

to enable connection, please direct web browser to: https://api.twitter.com/oauth/authorize?oauth_token=cwr7ggwidjh9pzcmajclq6cg1ziqk4jsid8q7v1s when complete, record pin given , provide here: 8387466

registertwitteroauth(cred) search=searchtwitter('facebook',cainfo="cacert.pem",n=1000) 

but evenwith n=1000, function returns list of 99 tweets should more that. tried same function specific timeline:

search=searchtwitter('facebook',cainfo="cacert.pem",n=1000,since='2013-01-01',until='2014-04-01') 

but function returns empty list.

can me out, correct set of additional queries can extract data specific timeline , without restriction on number of tweets? have amount of data fetched api?

thanks in advance

it looks twitter api restricts number of returned tweets. should check out in api documentation. keeping restriction in mind, can use since , sinceid arguments of searchtwitter() within loop, like:

for (i in 1:20) {   if (i==1) search = searchtwitter('facebook',cainfo="cacert.pem",n=2, since='2014-04-15')   else search = searchtwitter('facebook',cainfo="cacert.pem",n=2, since='2014-04-15', sinceid=search[[1]]$id)   print(search)   sys.sleep(10) } 

you may need adjust sys.sleep(10) portion if hit api restrictions.


Comments

Popular posts from this blog

Why can rails not find a route created by a helper? -

javascript - jquery or ashx not working -

opencv - DataType<cv::detail::deriv_type>::depth what is it used for -