Good morning,
I’m testing code ahead of scraping for my research project. I have full academic access and am using rtweet to extract Tweets:
tweets/search/fullarchive/controversiestomapp ***Warning: list(message = “Forbidden: Authentication succeeded but account is not authorized to access this resource.”, sent = “2021-03-30T09:08:00+00:00”, transactionId = “001bf14c00f015b6”)
The code I am using is:
rt ← search_fullarchive(q = “#COVIDVaccine”, n = 100, env_name = “controversiestomapp”, fromDate = “202102010000”, toDate = “202002302359”)
When using a normal search (not from the full archive) I can pull Tweets without an issue.
Any help would be appreciated!
This function calls the v1.1 Premium fullarchive endpoint, a different API, not the v2 academic access.
(same as here except in R instead of tweepy)
You can use this R package to use the v2 Academic Access: GitHub - cjbarrie/academictwitteR: Repo for academictwitteR package to query the Twitter Academic Research Product Track v2 API endpoint.
Thank you for the response. I’m following the git hub process but am getting getting an error when trying to generate a bearer token following Twitter’s code Generating and using app-only Bearer Tokens | Docs | Twitter Developer Platform. I’ve replaced the keys in my script with my own but get the following error:
curl -u "$API_KEYXX:$API_SECRET_KEYXX" \
--data 'grant_type=client_credentials' \
'https://api.twitter.com/oauth2/token'
returns Error: unexpected string constant in"$API_KEYXX:$API_SECRET_KEYXX" \
I may be easier to generate a bearer token from the Developer portal - that way you can provide it to R script directly. The tokens don’t expire unless you reset them https://developer.twitter.com/en/portal/dashboard (Under the “Keys and tokens” key menu under your Academic Access assigned Project App)