Sary
Sary

Reputation: 1

R: search_fullarchive() and Twitter Academic research API track

I was wondering whether anyone has found a way to how to use search_fullarchive() from the "rtweet" package in R with the new Twitter academic research project track?

The problem is whenever I try to run the following code:

search_fullarchive(q = "sunset", n = 500, env_name = "AcademicProject", fromDate = "202010200000", toDate = "202010220000", safedir = NULL, parse = TRUE, token = bearer_token)

I get the following error "Error: Not a valid access token". Is that because search_fullarchive() is only for paid premium accounts and that doesn't include the new academic track (even though you get full archive access)?

Also, can you retrieve more than 500 tweets (e.g., n = 6000) when using search_fullarchive()?

Thanks in advance!

Upvotes: 0

Views: 319

Answers (2)

Ahmad Mostafavi
Ahmad Mostafavi

Reputation: 11

Change your code to this:

search_fullarchive(q = "sunset", n = 500, env_name = "AcademicProject", fromDate = "202010200000", toDate = "202010220000", safedir = NULL, parse = TRUE, token = t, env_name = "Your Environment Name attained in the Dev Dashboard")

Also The token must be created like this:

t <- create_token(
  app = "App Name",
  'Key',
  'Secret',
  access_token = '',
  access_secret = '',
  set_renv = TRUE
)

Upvotes: 0

Tiangeng Lu
Tiangeng Lu

Reputation: 13

I've got the same problem w/ Twitter academic research API. I think if you set n = 100 or just skip the argument, the command will return you 100 tweets. Also, the rtweet package does not (yet) support the academic research API.

Upvotes: 0

Related Questions