Hello. I have been trying to set up a connection to Twitter api with R. I have seemingly managed to get authorization correct. Atleast without error messages, though this was bit of a hurdle and I am still somewhat skeptical of having done it properly. Anyhoo, I try to use searchTwitter-function to find some tweets but to no avail. The error message I receive is thus:
Warning message:
In doRppAPICall(“search/tweets”, n, params = params, retryOnRateLimit = retryOnRateLimit, :
1 tweets were requested but the API can only return 0
I use the following code:
library(httr)
library(twitteR)
# 1. Find OAuth settings for twitter:
# https://dev.twitter.com/docs/auth/oauth
oauth_endpoints("twitter")
# 2. Register an application at https://apps.twitter.com/
# Make sure to set callback url to "http://127.0.0.1:1410"
#
# Replace key and secret below
myapp <- oauth_app("twitter",
key = "",
secret = ""
)
# 3. Get OAuth credentials
twitter_token <- oauth1.0_token(oauth_endpoints("twitter"), myapp)
# 4. Use API
req <- GET("https://api.twitter.com/1.1/statuses/home_timeline.json",
config(token = twitter_token))
stop_for_status(req)
content(req)
api_key <- ""
api_secret <- ""
access_token <- ""
access_token_secret <- ""
setup_twitter_oauth(api_key,api_secret,access_token,access_token_secret)
tweet=searchTwitter("#JDSLille",n=1)
What ever could be the problem?
Is this problem with authentication or somehow with my own Twitter app and it’s permissions? (I listed topic here rather than under OAuth section because I seemingly manage to get authentication done correctly)