ropensci-archive/rtweet

404 retrieving timeline

Closed this issue · 2 comments

Since Saturday I'm having this strange issue where a code that used to work now doesn't.

I have a simple script on my Ubuntu server that retrieves some timelines periodically. It has always worked, but since Saturday it throws a 404 API error with a username that does exist. The strange thing is that it does work on my Windows laptop, but it doesn't on the server. This is a minimal example:

library(rtweet)
bearer <- ""
auth <- rtweet_app(bearer)
auth_as(auth)

get_timeline("hmeleiros", n = 3)

Output:

Error: Twitter API failed [404]. Check error message at https://developer.twitter.com/en/support/twitter-api/error-troubleshooting
 * Sorry, that page does not exist (34)

This is the session info on my Ubuntu server:

> sessionInfo()
R version 4.3.0 (2023-04-21)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 20.04.6 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.9.0
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.9.0

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C
 [9] LC_ADDRESS=C               LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

time zone: Etc/UTC
tzcode source: system (glibc)

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] httr_1.4.6        compiler_4.3.0    R6_2.5.1          cli_3.6.1
 [5] hms_1.1.3         prettyunits_1.1.1 withr_2.5.0       curl_5.0.0
 [9] crayon_1.5.2      vctrs_0.6.2       progress_1.2.2    jsonlite_1.8.4
[13] lifecycle_1.0.3   pkgconfig_2.0.3   rlang_1.1.1

I updated rtweet to the 1.2.0 version to check if that solved the issue, but it didn't. This error also came up in version 1.1.0.

Thanks in advance to the creator and maintainers. This is a great package, and it's a pity the future restrictions of Twitter API.

llrs commented

Sorry, this doesn't seem to be a problem in rtweet. I tried with the devel verison and it is working as expected.

It could either be a temporal problem in Twitter or something in the sever (Proxy?). At the moment there is nothing I can do on rtweet to address this. You will need to compare your computer with the server in order to find what is different and what is the cause of this error.

You are right. I'm trying to make a GET request with cURL from my ubuntu server and it throws the same error message. It is really strange because the same request works correctly in macOS (using cURL) and in windows (using Invoke-RestMethod). It's even stranger that other Twitter API endpoints work fine from my ubuntu server, but not /1.1/statuses/user_timeline.json

Thanks anyway!