jimmyday12 / fitzRoy

A set of functions to easily access AFL data
https://jimmyday12.github.io/fitzRoy
Other
125 stars 27 forks source link

fetch_player_details_footywire returns error when fetching non-current player details #208

Open databatch opened 4 months ago

databatch commented 4 months ago

fitzRoy::fetch_player_details_footywire returns an error when the 'current' argument is set to FALSE.

> fitzRoy::fetch_player_details_footywire('Richmond',
+                                         current = FALSE)
ℹ Fetching past player details for Richmond - this takes some time!
Error in `map()`:
ℹ In index: 1.
Caused by error in `open.connection()`:
! HTTP error 404.
Run `rlang::last_trace()` to see where the error occurred.
> rlang::last_trace()
<error/purrr_error_indexed>
Error in `map()`:
ℹ In index: 1.
Caused by error in `open.connection()`:
! HTTP error 404.
---
Backtrace:
     ▆
  1. ├─fitzRoy::fetch_player_details_footywire("Richmond", current = FALSE)
  2. │ └─fitzRoy:::fetch_player_details_footywire_past(team)
  3. │   └─players_url %>% cli::cli_progress_along() %>% ...
  4. ├─purrr::map_dfr(., get_past_player_footywire)
  5. │ └─purrr::map(.x, .f, ...)
  6. │   └─purrr:::map_("list", .x, .f, ..., .progress = .progress)
  7. │     ├─purrr:::with_indexed_errors(...)
  8. │     │ └─base::withCallingHandlers(...)
  9. │     ├─purrr:::call_with_cleanup(...)
 10. │     └─fitzRoy (local) .f(.x[[i]], ...)
 11. │       ├─rvest::read_html(...)
 12. │       └─xml2:::read_html.default(...)
 13. │         ├─base::suppressWarnings(...)
 14. │         │ └─base::withCallingHandlers(...)
 15. │         ├─xml2::read_xml(x, encoding = encoding, ..., as_html = TRUE, options = options)
 16. │         └─xml2:::read_xml.character(...)
 17. │           └─xml2:::read_xml.connection(...)
 18. │             ├─base::open(x, "rb")
 19. │             └─base::open.connection(x, "rb")
 20. └─base::.handleSimpleError(...)
 21.   └─purrr (local) h(simpleError(msg, call))
 22.     └─cli::cli_abort(...)
 23.       └─rlang::abort(...)