I would like to connect to Twitter's Streaming API using RCurl in R, and also be able to filter keywords. However, new restrictions on authorization in Twitter API v1.1 is making using RCurl difficult.
Before, code could go something like this taken from this page:
getURL("https://stream.twitter.com/1/statuses/filter.json",
userpwd="Username:Password",
cainfo = "cacert.pem",
write=my.function,
postfields="track=bruins")
But now, Twitter's new API is making users authorize with OAuth. I have a token and secret, I just need to place it in this code for authorization.
Thanks!
You can do it with pacakge
ROAuth
. I assume you have registered your app with Twitter and have an API key. I pieced this together from other questions on Stack Overflow (that question and associated answers also contains some links to other contributing questions) and the documentation for packageROAuth
andtwitteR
.I believe that use of the streaming API is handled by the package
streamR
HTH