Home > OS >  Scraping Twitter Data: API Failed (Error 403)
Scraping Twitter Data: API Failed (Error 403)

Time:08-28

I am trying to learn how to scrape tweets from Twitter (using R). I have a twitter account and registered for the API. I got all necessary keys that seem to be required (api key, api secret, access token, access secret, bearer token).

I am now following this tutorial here: enter image description here

and auth file in dir (on linux): ~/.config/R/rtweet.

Then you can make query like: obama_tweets <- rtweet::get_timeline(c("barackobama"), n = 3, parse=T, token=my_auth)


You can also use function auth_sitrep() to see which auth file is valid, because auth files created with rtweet_app() are (almost) empty (you can also check directory ~/.config/R/rtweet).

You can also reuse, saved (automatically) auth file with auth <- readRDS("~/.config/R/rtweet/default.rds").

CodePudding user response:

I'm not a "R" programmer, but I found an article maybe that helps you :)

https://medium.com/analytics-vidhya/scraping-and-analyzing-tweets-in-r-62582e2f4543

  • Related