tweet_search_recent()
Closed this issue · 3 comments
DenaNico1 commented
hello, I'd like some help collecting tweets based on hastags and a specific country (for example Burkina Faso). here's my code:
Expected behavior
Reproduce the problem
## insert code here
rtweet version
# Définir la requête de recherche avec les hashtags et le pays Burkina Faso
query <- "#football OR #terrorism OR #pdi OR #violence "
# Rechercher les tweets
tweets_rechhh <- tweet_search_recent(
query = query,
n = 100, # Nombre de tweets à récupérer
fields = set_fields(media = media_fields, poll = poll_fields, tweet = tweet_fields, place = place_fields,
user = user_fields, list = NULL),
expansions = set_expansions(),
verbose = TRUE, # Afficher les informations de requête
parse = FALSE
)
Error in `httr2::req_perform()`:
! Failed to parse error body with method defined in `req_error()`.
Caused by error in `FUN()`:
! is.list(x) n'est pas TRUE
Run `rlang::last_trace()` to see where the error occurred.
Erreur pendant l'emballage (wrapup) : 'length = 22' in coercion to 'logical(1)'
Erreur : plus de gestionnaire d’erreur disponible (erreurs récursives ?) ; appel d’un redémarrage de type 'abort'
## copy/paste output
packageVersion("rtweet")
> packageVersion("rtweet")
[1] ‘1.2.1’
Session info
## copy/paste output
sessionInfo()
sessionInfo()
R version 4.3.2 (2023-10-31 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19045)
Matrix products: default
locale:
[1] LC_COLLATE=French_France.1252 LC_CTYPE=French_France.1252 LC_MONETARY=French_France.1252
[4] LC_NUMERIC=C LC_TIME=French_France.1252
time zone: Etc/UTC
tzcode source: internal
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] rtweet_1.2.1 jsonlite_1.8.8 academictwitteR_0.3.1 httr_1.4.7
[5] RTwitterV2_0.2.6.7
loaded via a namespace (and not attached):
[1] rappdirs_0.3.3 utf8_1.2.4 generics_0.1.3 bitops_1.0-7 lattice_0.21-9
[6] hms_1.1.3 digest_0.6.34 magrittr_2.0.3 evaluate_0.23 grid_4.3.2
[11] timechange_0.3.0 fastmap_1.1.1 progress_1.2.3 promises_1.2.1 purrr_1.0.2
[16] fansi_1.0.6 httr2_1.0.0 cli_3.6.2 rlang_1.1.3 crayon_1.5.2
[21] withr_3.0.0 yaml_2.3.8 tools_4.3.2 tzdb_0.4.0 geosphere_1.5-18
[26] dplyr_1.1.4 httpuv_1.6.13 curl_5.2.0 vctrs_0.6.5 R6_2.5.1
[31] lifecycle_1.0.4 lubridate_1.9.3 fs_1.6.3 usethis_2.2.2 pkgconfig_2.0.3
[36] pillar_1.9.0 later_1.3.2 data.table_1.14.10 glue_1.7.0 Rcpp_1.0.12
[41] xfun_0.41 ROAuth_0.9.6 tibble_3.2.1 tidyselect_1.2.0 knitr_1.45
[46] rstudioapi_0.15.0 htmltools_0.5.7 rmarkdown_2.25 readr_2.1.5 compiler_4.3.2
[51] prettyunits_1.2.0 askpass_1.2.0 RCurl_1.98-1.14 sp_2.1-2 openssl_2.1.1
llrs commented
Could you try again and after you get the error run rlang::last_trace()
and paste here the output? But I think this is a duplicate of the recent fixed bug reported in #788
Unfortunately, I cannot reproduce it as I am not paying the "basic" subscription to the API.
It would help if you provided some funds or the patch to fix them. Thanks.
DenaNico1 commented
here is the result of rlang::last_trace() :
rlang::last_trace()
<error/rlang_error>
Error in `httr2::req_perform()`:
! Failed to parse error body with method defined in `req_error()`.
Caused by error in `FUN()`:
! is.list(x) n'est pas TRUE
---
Backtrace:
x
1. \-rtweet::tweet_search_recent(...)
2. \-rtweet:::pagination(req_final, n_pages, n, verbose)
3. \-httr2::req_perform(req)
4. \-httr2:::handle_resp(req, resp, error_call = error_call)
5. \-httr2:::error_body(req, resp, error_call)
6. +-rlang::try_fetch(...)
7. | +-base::tryCatch(...)
8. | | \-base (local) tryCatchList(expr, classes, parentenv, handlers)
9. | | \-base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]])
10. | | \-base (local) doTryCatch(return(expr), name, parentenv, handler)
11. | \-base::withCallingHandlers(...)
12. \-httr2:::req_policy_call(req, "error_body", list(resp), default = NULL)
13. +-rlang::exec(req$policies[[name]], !!!args)
14. \-rtweet (local) `<fn>`(`<httr2_rs>`)
15. +-base::do.call(rbind, lapply(r$errors, list2DF))
16. \-base::lapply(r$errors, list2DF)
17. \-base (local) FUN(X[[i]], ...)
18. \-base::stopifnot(is.list(x), is.null(nrow) || nrow >= 0L)
19. \-base::stop(simpleError(msg, call = if (p <- sys.parent(1L)) sys.call(p)))
Run rlang::last_trace(drop = FALSE) to see 4 hidden frames.
llrs commented
I think it is fixed in recent changes. Let me know if you try again and it fails with the same error.
Thanks for reporting the issue.