Search code examples
rtwitterrtweet

Using Rtweet's search_fullarchive in R


I am trying to use rtweet's search_fullarchive using my premium token registered at Twitter Developer. However, I got an error message of:

Warning: list(message = "Forbidden: Authentication succeeded but account is not authorized to access this resource.", sent = "2019-07-14T14:30:11+00:00", transactionId = "xxxxxxxxxx")

How do I get past this problem? Is there an error in the way i code?

I ensured my token is working well by testing it using httr's POST method and it worked completely fine.

I also tested my token using normal search_tweets, and also worked fine.

cons_key = "xxx"
cons_sec = "xxx"
acc_tok = "xxx"
acc_sec = "xxx"
app = "abc"

token = rtweet::create_token(app,cons_key,cons_sec,acc_tok,acc_sec)

manutd = search_fullarchive("manchester united",n=500,
fromDate = "201812010000",toDate = "201902010000",
env_name = app,token = token)

I expected a tibble dataframe as usually Rtweet's returns. However this is what i received:

"Warning: list(message = "Forbidden: Authentication succeeded but account is not authorized to access this resource.", sent = "2019-07-14T14:30:11+00:00", transactionId = "xxxxxxxxxx")" data frame with 0 columns and 0 rows


Solution

  • To help anyone who might have trouble with the same thing, i'll write down a bit of explanation. Firstly, if you have registered a premium account, go to

    To create the token, you need the App Name.

    token = rtweet::create_token(app_name,cons_key,cons_sec,acc_tok,acc_sec)
    

    To do query, you need the environment name.

    search_fullarchive(q, n = 100, fromDate = NULL, toDate = NULL, env_name = "dev_name", safedir = NULL, parse = TRUE, token = token)
    

    Hope it helps beginners or anyone who might have the same troubles.