简体   繁体   中英

search_fullarchive with rtweet on elevated (or academic) account refused by Twitter API

I need to use the rtweet search_fullarchive to access historical data. I have two developer accounts: one is elevated and the other is academic. This stackoverflow suggested Academic had not been given elevated access , so I primarily used the elevated account. I believe the elevated account is just sandbox, not paid.

I have used two methods of generating authentication tokens for the search. Method 1 is said to be deprecated:

auth <- create_token(
  app = "App Name",
  consumer_key="",
  consumer_secret="",
  access_token = "",
  access_secret = "",
  set_renv = TRUE
)

Method 2 requests the bearer token:

auth_as(rtweet_app())

The search form is:

data<-search_fullarchive("#rstats", n=10, env_name="MyAppName", parse=TRUE, token=auth,fromDate=201401010000",toDate="201401312359")

I have received the 400 errors "Unauthorized" and "Forbidden", but I am not sure of their priority in printing. Is it possible the "sandbox" status of my Elevated account is not authorized? Or is there some new way to authenticate to the Twitter API now?

I did read about the environment vs. app name issue here , but definitely received errors using anything other than the app name as the env_name value. I think that might be an incorrect stackoverflow and will update it if I find evidence confirming it.

The search_fullarchive method in rtweet requires the Premium v1.1 API.

  • a developer account with Elevated access has access to the standard v1.1 API, but you will also need to have created a Premium sandbox developer environment

    • you would find this in the developer portal in the left sidebar under Products->Premium->Dev environments - there is a separate environment name/label (that should be what you enter for env_name ), and the environment should contain the app which contains the consumer key and token you are using.
  • a developer account with Academic access has access to the more rich v2 full archive search API, but rtweet doesn't yet support it - I think academicTwitteR may offer that access instead, but I'm not an R developer so I'm not 100% sure.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM