Scraping Twitter Data: API Failed (Error 403)
my_auth <- rtweet::create_token()
works better but it's deprecated. But it works!
Run my_auth <- rtweet::create_token()
without arguments, and you should see a login window in your browser (or confimation is you are already logged in).
In a result you should get a new variable in your environment "my_auth". Like on the image:
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").
Trying to connect to Twitter Streaming API using ROAuth, getting Error: Forbidden
I changed the http
s to https
es and it worked.
twitteR authorization - cannot get PIN
You accidentally put a dot instead of a slash, try this instead:
authURL <- https://api.twitter.com/oauth/authorize
And that should bring up the link to the twitter developer page to authorize your application
R TwitteR package authorization error
set callback url to http://127.0.0.1:1410 in app settings in twitter
Authorization Required error when accessing Twitter API
If you are using the CRAN version of twitteR(1.1.7) try using the GitHub version (1.1.8).
The 1.1.8 version useses httr instead of ROAuth which might help
link
Download from GitHub:
library(devtools)
library(httr)
install_github("twitteR", username = "geoffjentry")
library(twitteR)
You might get a Warning message:
Username parameter is deprecated. Please use geoffjentry/twitteR
But you should ind twitteR in your library anyway.
And then with twitteR 1.1.8
library(httr)
library(twitteR)
setup_twitter_oauth(api_key, api_secret, access_token, access_token_secret)
tweets <- searchTwitter('#bigdata', n=150)
tweets.df <- do.call(rbind, lapply(tweets, as.data.frame))
write.csv(tweets.df, "C:/...")
Hope this helps!
Related Topics
R Table Function - How to Remove 0 Counts
Create a Concentric Circle Legend for a Ggplot Bubble Chart
How to Custom or Display Modebar in Plotly
Cannot Install Stringi Since Xcode Command Line Tools Update
Filtering a Dataframe Showing Only Duplicates
Ggplot2: Adding Lines in a Loop and Retaining Colour Mappings
Adding a New Column to Matrix Error
Change Line Color Depending on Y Value with Ggplot2
In R, Switch Uppercase to Lowercase and Vice-Versa in a String
Error in Install.Packages:Type =="Both" Cannot Be Used with 'Repos =Null'
R Shiny: Plot with Dynamical Size
Drawing Minor Ticks (Not Grid Ticks) in Ggplot2 in a Date Format Axis
"Non-Finite Function Value" When Using Integrate() in R
How to Convert Class of Several Variables at Once
R/Ggplot Cumulative Sum in Histogram
R Shiny - Ui.R Seems to Not Recognize a Dataframe Read by Server.R
Downgrade R Version (No Issues with Bioconductor Installation)