ropensci / rtweet

🐦 R client for interacting with Twitter's [stream and REST] APIs
https://docs.ropensci.org/rtweet
Other
785 stars 201 forks source link

Error: Twitter API failed [403] #777

Closed sunta3iouxos closed 1 year ago

sunta3iouxos commented 1 year ago

Problem

Is this related to new tweeter policy? is there a way to resolve this issue? rstats <- search_tweets("#rstats", n = 100, include_rts = FALSE) Error: Twitter API failed [403]. Check error message at https://developer.twitter.com/en/support/twitter-api/error-troubleshooting

Expected behavior

return a list of mentions to rstats

Reproduce the problem

rstats <- search_tweets("#rstats", n = 100, include_rts = FALSE)

rtweet version

## copy/paste output
packageVersion("rtweet")
[1] ‘1.2.0.9003’

Session info

## copy/paste output
sessionInfo()
R version 4.2.1 (2022-06-23 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 22621)

Matrix products: default

locale:
[1] LC_COLLATE=English_United Kingdom.utf8  LC_CTYPE=English_United Kingdom.utf8   
[3] LC_MONETARY=English_United Kingdom.utf8 LC_NUMERIC=C                           
[5] LC_TIME=English_United Kingdom.utf8    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] rtweet_1.2.0.9003

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.10       rstudioapi_0.14   magrittr_2.0.3    hms_1.1.3         progress_1.2.2    rappdirs_0.3.3   
 [7] R6_2.5.1          rlang_1.1.0       httr_1.4.5        httr2_0.2.2       tools_4.2.1       cli_3.6.0        
[13] withr_2.5.0       askpass_1.1       openssl_2.0.6     lifecycle_1.0.3   crayon_1.5.2      later_1.3.0      
[19] vctrs_0.6.0       promises_1.2.0.1  curl_5.0.0        glue_1.6.2        compiler_4.2.1    prettyunits_1.1.1
[25] jsonlite_1.8.4    httpuv_1.6.9      pkgconfig_2.0.3  
llrs commented 1 year ago

As the error message tells you, this is due to Twitter policy change. There is nothing rtweet can do to solve this issue. If you want to get those tweets you'll need to pay for the basic plan (or higher) and use the API v2 (tweet_search_recent function).