cjbarrie / academictwitteR

Repo for academictwitteR package to query the Twitter Academic Research Product Track v2 API endpoint.
Other
272 stars 59 forks source link

[BUG] <Getting error 400> #378

Closed Deena72 closed 1 year ago

Deena72 commented 1 year ago

Please confirm the following

Describe the bug

When I try to run get_all_tweets, I get this error Error in make_query(url = endpoint_url, params = params, bearer_token = bearer_token, : something went wrong. Status code: 400

I am using the Twitter academic API and it did run for a couple of times then started giving me this error

Here is my code: my_query <- c("coronavirus","corona","sars-cov-2","ncov","2019ncov", "china virus","chinavirus","chinese virus","chinesevirus", "wuhan virus","wuhanvirus","kung flu","kungflu", "covid","covid19","covid-19","omicron","longcovid") get_all_tweets( query = my_query, lang = "en", country="CA", start_tweets = "2023-06-11T00:00:00Z", end_tweets = "2023-06-11T00:01:00Z", bearer_token = bearer_token, n = 10000, data_path = "CanadaFinal", bind_tweets = FALSE )

Expected Behavior

I expected to get tweets as it was working before then stopped working

Steps To Reproduce

query: (coronavirus OR corona OR sars-cov-2 OR ncov OR 2019ncov OR china virus OR chinavirus OR chinese virus OR chinesevirus OR wuhan virus OR wuhanvirus OR kung flu OR kungflu OR covid OR covid19 OR covid-19 OR omicron OR longcovid) place_country:CA lang:en Error in make_query(url = endpoint_url, params = params, bearer_token = bearer_token, : something went wrong. Status code: 400

Environment

R version 4.2.3 (2023-03-15) Platform: aarch64-apple-darwin20 (64-bit) Running under: macOS Ventura 13.2.1

Matrix products: default LAPACK: /Library/Frameworks/R.framework/Versions/4.2-arm64/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] academictwitteR_0.3.1 forcats_0.5.1 stringr_1.5.0 dplyr_1.1.2 purrr_1.0.1 readr_2.1.2
[7] tidyr_1.3.0 tibble_3.2.1 ggplot2_3.4.1 tidyverse_1.3.2

loaded via a namespace (and not attached): [1] httr_1.4.6 pkgload_1.3.0 jsonlite_1.8.4 modelr_0.1.9 shiny_1.7.2 assertthat_0.2.1 googlesheets4_1.0.1 [8] cellranger_1.1.0 remotes_2.4.2 sessioninfo_1.2.2 pillar_1.9.0 backports_1.4.1 glue_1.6.2 digest_0.6.31
[15] promises_1.2.0.1 rvest_1.0.2 colorspace_2.0-3 htmltools_0.5.3 httpuv_1.6.5 pkgconfig_2.0.3 devtools_2.4.4
[22] broom_1.0.0 haven_2.5.0 xtable_1.8-4 scales_1.2.0 processx_3.7.0 later_1.3.0 tzdb_0.3.0
[29] timechange_0.2.0 googledrive_2.0.0 generics_0.1.3 usethis_2.1.6 ellipsis_0.3.2 cachem_1.0.6 withr_2.5.0
[36] cli_3.6.1 magrittr_2.0.3 crayon_1.5.2 readxl_1.4.1 mime_0.12 memoise_2.0.1 ps_1.7.1
[43] fs_1.6.2 fansi_1.0.4 xml2_1.3.3 pkgbuild_1.3.1 profvis_0.3.7 tools_4.2.3 prettyunits_1.1.1
[50] hms_1.1.2 gargle_1.2.0 lifecycle_1.0.3 munsell_0.5.0 reprex_2.0.2 callr_3.7.1 compiler_4.2.3
[57] rlang_1.1.1 grid_4.2.3 rstudioapi_0.14 htmlwidgets_1.5.4 miniUI_0.1.1.1 gtable_0.3.0 DBI_1.1.3
[64] curl_5.0.0 R6_2.5.1 lubridate_1.9.2 fastmap_1.1.0 utf8_1.2.3 rprojroot_2.0.3 stringi_1.7.12
[71] Rcpp_1.0.9 vctrs_0.6.2 urlchecker_1.0.1 dbplyr_2.2.1 tidyselect_1.2.0

Anything else?

Your advice is appreciated

Deena72 commented 1 year ago

I figured out the issue. I entered a date in the future. It will be good if we can get the reason for the problem with the query. EX: with the error, I get something notifying me that the date is not correct. Thanks.