cjbarrie/academictwitteR

[BUG] get_all_tweets returns Error (Status Code 400) when targeting more than 34 users

ld127 opened this issue · 0 comments

ld127 commented

Please confirm the following

  • I have searched the existing issues
  • The behaviour of the program is deviated from what is described in the documentation.
  • I can reproduce this problem for more than one time.
  • This is NOT a 3-digit error -- it does not display an error message like something went wrong. Status code: 400.
  • This is a 3-digit error and I have consulted the Understanding API errors vignette and the suggestions do not help.

Describe the bug

I want to retrieve the tweets from 50 people in the past year. But as soon as the number of users exceeds 34, I get the Error in make_query with Status Code 400.
Error in make_query(url = endpoint_url, params = params, bearer_token = bearer_token, : something went wrong. Status code: 400

I haven't been able to find a restriction in the function or the API documentation yet that would explain this pattern. Also, it doesn't matter which IDs I use (e.g. I excluded author_id[35] or tried the second half of users).

get_all_tweets(
  data_path = file_path, 
  bind_tweets = F,
  bearer_token = bearer.token,
  users = df_users$author_id[1:34],
  query = keywords,
  start_tweets = start_tweets,
  end_tweets = end_tweets,
  n = Inf,
  lang = "en",
  is_retweet = F,
  is_verified = F,
  remove_promoted = T
)

Expected Behavior

I would expect it to work for 35 IDs as well

Steps To Reproduce

Cannot really give data for reproduction due to anonymity reasons.

Environment

R version 4.1.2 (2021-11-01)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Big Sur 11.5.2

Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.1/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

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

other attached packages:
[1] lubridate_1.8.0 readxl_1.3.1 tidylog_1.0.2 forcats_0.5.1 stringr_1.4.0 dplyr_1.0.7
[7] purrr_0.3.4 readr_2.1.0 tidyr_1.1.4 tibble_3.1.6 ggplot2_3.3.5 tidyverse_1.3.1
[13] openssl_1.4.5 academictwitteR_0.3.0 rtweet_0.7.0

loaded via a namespace (and not attached):
[1] progress_1.2.2 clisymbols_1.2.0 tidyselect_1.1.1 haven_2.4.3 colorspace_2.0-2 vctrs_0.3.8 generics_0.1.1 usethis_2.1.3
[9] utf8_1.2.2 rlang_0.4.12 pillar_1.6.4 glue_1.5.0 withr_2.4.2 DBI_1.1.1 bit64_4.0.5 dbplyr_2.1.1
[17] modelr_0.1.8 lifecycle_1.0.1 munsell_0.5.0 gtable_0.3.0 cellranger_1.1.0 rvest_1.0.2 tzdb_0.2.0 parallel_4.1.2
[25] curl_4.3.2 fansi_0.5.0 broom_0.7.10 Rcpp_1.0.7 scales_1.1.1 backports_1.3.0 vroom_1.5.6 jsonlite_1.7.2
[33] bit_4.0.4 fs_1.5.0 askpass_1.1 hms_1.1.1 stringi_1.7.5 grid_4.1.2 cli_3.1.0 tools_4.1.2
[41] magrittr_2.0.1 crayon_1.4.2 pkgconfig_2.0.3 ellipsis_0.3.2 prettyunits_1.1.1 xml2_1.3.2 reprex_2.0.1 assertthat_0.2.1
[49] httr_1.4.2 rstudioapi_0.13 R6_2.5.1 compiler_4.1.2

Anything else?

Thank you for any hints!