ropensci/rcrossref

Cannot retrieve works ("application/json;charset=UTF-8" is not TRUE)

BEFH opened this issue ยท 8 comments

BEFH commented
Session Info
> sessionInfo()
R version 4.1.1 (2021-08-10)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Big Sur 10.16

Matrix products: default
BLAS:   /Library/Frameworks/R.framework/Versions/4.1/Resources/lib/libRblas.0.dylib
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] rcrossref_1.1.0

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.8.3      compiler_4.1.1    pillar_1.6.2      later_1.3.0       plyr_1.8.7        tools_4.1.1       digest_0.6.28     jsonlite_1.7.2    lifecycle_1.0.1   tibble_3.1.4      pkgconfig_2.0.3
[12] rlang_0.4.11      shiny_1.7.0       DBI_1.1.1         crul_1.2.0        curl_4.3.2        fastmap_1.1.0     xml2_1.3.2        stringr_1.4.0     dplyr_1.0.7       generics_0.1.0    vctrs_0.3.8
[23] htmlwidgets_1.5.4 triebeard_0.3.0   DT_0.19           tidyselect_1.1.1  glue_1.4.2        httpcode_0.3.0    R6_2.5.1          fansi_0.5.0       purrr_0.3.4       magrittr_2.0.1    urltools_1.7.3
[34] promises_1.2.0.1  ellipsis_0.3.2    htmltools_0.5.2   assertthat_0.2.1  mime_0.11         xtable_1.8-4      httpuv_1.6.3      utf8_1.2.2        stringi_1.7.4     miniUI_0.1.1.1    crayon_1.4.1

When I attempt to run cr_works(), it fails with the following error:

> cr_works(dois = "10.1371/journal.pone.0228782")
Error in cr_GET(endpoint = path, args, todf = FALSE, ...) :
  res$response_headers$`content-type` == "application/json;charset=UTF-8" is not TRUE

No DOI or URL works. Did CrossRef change their API?

Same here...

> cr_cn(dois = "10.1371/journal.pone.0112608", format = "text", style = "apa")
Error in cr_GET(endpoint = sprintf("works/%s/agency", x), args = list(),  : 
  res$response_headers$`content-type` == "application/json;charset=UTF-8" is not TRUE

I added my mail to ~/.Renviron

R version 4.2.1 (2022-06-23)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Linux Mint 20.3

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3
LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/liblapack.so.3

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

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

other attached packages:
 [1] rcrossref_1.1.0.99 forcats_0.5.1      stringr_1.4.0      dplyr_1.0.9        purrr_0.3.4        readr_2.1.2       
 [7] tidyr_1.2.0        tibble_3.1.8       ggplot2_3.3.6      tidyverse_1.3.1   

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.9        lubridate_1.8.0   prettyunits_1.1.1 ps_1.7.1          rprojroot_2.0.3   assertthat_0.2.1 
 [7] digest_0.6.29     utf8_1.2.2        mime_0.12         R6_2.5.1          cellranger_1.1.0  plyr_1.8.7       
[13] backports_1.4.1   reprex_2.0.1      httr_1.4.3        pillar_1.8.0      rlang_1.0.4       curl_4.3.2       
[19] readxl_1.4.0      rstudioapi_0.13   miniUI_0.1.1.1    callr_3.7.0       DT_0.23           urltools_1.7.3   
[25] htmlwidgets_1.5.4 triebeard_0.3.0   munsell_0.5.0     shiny_1.7.2       broom_0.8.0       compiler_4.2.1   
[31] httpuv_1.6.5      modelr_0.1.8      pkgconfig_2.0.3   pkgbuild_1.3.1    htmltools_0.5.3   tidyselect_1.1.2 
[37] httpcode_0.3.0    fansi_1.0.3       crayon_1.5.1      tzdb_0.3.0        dbplyr_2.2.0      withr_2.5.0      
[43] later_1.3.0       crul_1.2.0        grid_4.2.1        jsonlite_1.8.0    xtable_1.8-4      gtable_0.3.0     
[49] lifecycle_1.0.1   DBI_1.1.3         magrittr_2.0.3    scales_1.2.0      cli_3.3.0         stringi_1.7.8    
[55] remotes_2.4.2     fs_1.5.2          promises_1.2.0.1  xml2_1.3.3        ellipsis_0.3.2    generics_0.1.3   
[61] vctrs_0.4.1       tools_4.2.1       glue_1.6.2        hms_1.1.1         processx_3.6.1    fastmap_1.1.0    
[67] colorspace_2.0-3  sessioninfo_1.2.2 rvest_1.0.2       haven_2.5.0  

The development version (1.1.0.99) is working for me. The one on CRAN (1.1.0) is giving me the same error that @BEFH and @agricolamz reported.

Aariq commented

I had this issue and tracked it down to a problem with capitalization of "UTF" not matching what was expected ("utf"). But it looks like it's fixed in the development version on GitHub

Hi All, I am having the same issue using the CRAN 1.1.0 version. Can you point me to the development version that is working? I tried devtools::install_github("ropensci/rcrossref@api_update") with no luck. Where are the development versions listed?

Aariq commented

If you just use devtools::install_github("ropensci/rcrossref") it will install the current development version.

Aariq commented

@njahn82, it might be good to make a patch release for CRAN if this fix isn't in the CRAN version yet

if this fix isn't in the CRAN version yet

This fix isn't on CRAN yet. See also #221 (comment)

Related to a CRAN update, the package is currently failing CRAN checks, so it is in risk of being archived

https://cran.r-project.org/web/checks/check_results_rcrossref.html

New CRAN release 1.2.0 fixes this issue.