MaelKubli / RTwitterV2

R functions for Twitter's v2 API
MIT License
46 stars 6 forks source link

Unknown error when using full_archive_search() #7

Closed gaiobr closed 2 years ago

gaiobr commented 2 years ago

Hello,

I'm testing RTwitterV2 for the first time, and when I tried

query <- "#Biden OR #Trump -is:retweet"

lower <- "2020-06-01T00:00:01Z"
upper <- "2021-06-01T00:00:01Z"

tmp <- full_archive_search(token = bearer_token, search_query = query, n = 2500,
                           start_time=lower, end_time=upper, JSON = FALSE)

I got this error:

Something went wrong!
Error in full_archive_search(token = bearer_token, search_query = query,  : 

Error: 

I tried test <- get_user_v2(token = bearer_token, user_names = 'user,user2') and it works fine!

What could be happening?

MaelKubli commented 2 years ago

Hi

I was able to replicate the error and started investigating, what went wrong. It turns out in the last update of the package I made some assignment error which did not trigger an error in my test functions. I have now fixed this error and your example is now working on my end.

The Package is now updated to version 0.2.6 where the bug is fixed.

gaiobr commented 2 years ago

Hi, thank you for the quick response!

I updated the package to the 0.2.6. version and tried again, but I got the same error:

tmp <- full_archive_search(token = bearer_token, search_query = query, n = 2500,
+                            start_time=lower, end_time=upper, JSON = FALSE)
Something went wrong!
Error in full_archive_search(token = bearer_token, search_query = query,  : 

Error:

my sessionInfo(package = 'RTwitterV2')

R version 4.2.0 (2022-04-22 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 22000)

Matrix products: default

locale:
[1] LC_COLLATE=Portuguese_Brazil.utf8  LC_CTYPE=Portuguese_Brazil.utf8    LC_MONETARY=Portuguese_Brazil.utf8
[4] LC_NUMERIC=C                       LC_TIME=Portuguese_Brazil.utf8    

attached base packages:
character(0)

other attached packages:
[1] RTwitterV2_0.2.6

loaded via a namespace (and not attached):
 [1] progress_1.2.2    tidyselect_1.1.2  remotes_2.4.2     purrr_0.3.4       ROAuth_0.9.6      lattice_0.20-45  
 [7] testthat_3.1.4    vctrs_0.4.1       generics_0.1.3    usethis_2.1.6     grDevices_4.2.0   utf8_1.2.2       
[13] rlang_1.0.2       pkgbuild_1.3.1    later_1.3.0       pillar_1.7.0      glue_1.6.2        withr_2.5.0      
[19] DBI_1.1.2         sp_1.5-0          sessioninfo_1.2.2 lifecycle_1.0.1   devtools_2.4.3    memoise_2.0.1    
[25] tzdb_0.3.0        callr_3.7.0       fastmap_1.1.0     httpuv_1.6.5      ps_1.7.0          curl_4.3.2       
[31] fansi_1.0.3       methods_4.2.0     Rcpp_1.0.8.3      geosphere_1.5-14  readr_2.1.2       promises_1.2.0.1 
[37] cachem_1.0.6      desc_1.4.1        pkgload_1.2.4     jsonlite_1.8.0    fs_1.5.2          brio_1.1.3       
[43] hms_1.1.1         stats_4.2.0       datasets_4.2.0    graphics_4.2.0    digest_0.6.29     processx_3.5.3   
[49] dplyr_1.0.9       rprojroot_2.0.3   grid_4.2.0        cli_3.3.0         tools_4.2.0       bitops_1.0-7     
[55] magrittr_2.0.3    RCurl_1.98-1.7    tibble_3.1.7      crayon_1.5.1      pkgconfig_2.0.3   ellipsis_0.3.2   
[61] data.table_1.14.2 utils_4.2.0       prettyunits_1.1.1 lubridate_1.8.0   rstudioapi_0.13   assertthat_0.2.1 
[67] base_4.2.0        httr_1.4.3        R6_2.5.1          compiler_4.2.0  
MaelKubli commented 2 years ago

Hi

I just tested the package again on a Windows Machine. I am unable to reproduce this error.

May I ask what kind of API Token you have, since this function will only work with an AcademicAPI Token!?

gaiobr commented 2 years ago

Hi,

Not sure if I'm using the AcademicAPI token.

I'm starting to use the Twitter API v2. It looks like it has three options:

As I am first learning to retrieve information, I have no yet not requested an Academic Token.

So I will try to get an Academic Token and test again.

I am grateful for your help!

MaelKubli commented 2 years ago

Hi,

In that case it makes sense to go and apply for an academic track if you are eligible for it. In general only the academic track and payed business api tokens are working with endpoints which allow full archive access. All other API tokens only grant access to the 7 day recent search endpoint, which is available in my package through the recent_search() function.