Skip to content

Commit

Permalink
fix issue #137 and add extra pauses between fbref tests
Browse files Browse the repository at this point in the history
  • Loading branch information
JaseZiv committed Jun 19, 2022
1 parent 0474966 commit b2d49ee
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 58 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Type: Package
Package: worldfootballR
Title: Extract and Clean World Football (Soccer) Data
Version: 0.5.6
Version: 0.5.6.1000
Authors@R: c(
person("Jason", "Zivkovic", , "[email protected]", role = c("aut", "cre", "cph")),
person("Tony", "ElHabr", , "[email protected]", role = "ctb"),
Expand Down
9 changes: 9 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
# worldfootballR 0.5.6.1000

### Bugs

* `player_transfer_history()` no longer throwing errors for players without a club [#137](https://github.com/JaseZiv/worldfootballR/issues/137)
* Increase sleep times in tests for FBref functions

***

# worldfootballR 0.5.6

* CRAN submission
Expand Down
2 changes: 1 addition & 1 deletion R/player_transfer_history.R
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ player_transfer_history <- function(player_urls) {
.tm_fix_dates() %>% lubridate::ymd(), error = function(e) NA_character_)

# country_flags <- tryCatch(all_transfer_rows[each_row] %>% rvest::html_nodes(".flagge"), error = function(e) NA)
country_from <- tryCatch(all_transfer_rows[each_row] %>% rvest::html_nodes(".tm-player-transfer-history-grid__old-club .tm-player-transfer-history-grid__flag") %>% rvest::html_attr("alt") %>% stringr::str_squish(), error = function(e) NA_character_)
country_from <- tryCatch(all_transfer_rows[each_row] %>% rvest::html_nodes(".tm-player-transfer-history-grid__old-club .tm-player-transfer-history-grid__flag") %>% rvest::html_attr("alt") %>% stringr::str_squish() %>% .replace_empty_na(), error = function(e) NA_character_)
country_to <- tryCatch(all_transfer_rows[each_row] %>% rvest::html_nodes(".tm-player-transfer-history-grid__new-club .tm-player-transfer-history-grid__flag") %>% rvest::html_attr("alt"), error = function(e) NA_character_)
# to handle for players that are retired, like: "https://www.transfermarkt.com/massimiliano-allegri/profil/spieler/163501":
if(rlang::is_empty(country_to)) {
Expand Down
Loading

0 comments on commit b2d49ee

Please sign in to comment.