TwitteR scraping with R error, fixing ideas?

118 Views Asked by At

I'm a bit desperate with my problem as I checked all the existing sources and nothing worked for me.

The issue:

I'm trying to scrape twitter with R in Rstudio, I'm on the very first stage of auth with API keys:

library(twitteR)
library(ROAuth)
library(openssl)
library(httpuv)
library(devtools)
origop <- options("httr_oauth_cache")
options(httr_oauth_cache = TRUE)

api_key <- "*****"
api_secret <- "******"
access_token <- "*****"
access_secret <- "******"
setup_twitter_oauth(api_key, api_secret, access_token, access_secret)

I'm using keys with essential access, v2 access level (which in theory shouldn't be the reason for the bug, but who knows?..)


This code gives the error:

Error in check_twitter_oauth() : OAuth authentication error:
This most likely means that you have incorrectly called setup_twitter_oauth()'

What I tried:

1. Restarting the session after installing the packages

2. Fixing httr bug by running:

 library(devtools)
devtools::install_version("httr", version="0.6.0", repos="http://cran.us.r-project.org")

3. Fixing possible compatibility issue by running:

devtools::install_github("jrowen/twitteR", ref = "oauth_httr_1_0")

4. running all of the above, restarting R and even restarting the laptop 3 times.

5. Checked my firewall - it's off.

6. Checked my default browser and being logged in in it into twitter - done.

7. Tried re-generating my access keys and re-running all of the above - didn't help.

I don't know what else to try, does anybody have any idea how to fix this issue?

Thanks a million in advance!

1

There are 1 best solutions below

0
On

Aright, so after some checking here's the solution (if anybody ever needs it):

  1. use library (rtweet)

  2. apply and get approved for elevated access. That was definitely the problem that didn't let me go ahead.