Skip to content

Commit

Permalink
Merge pull request #358 from JaseZiv/player-bio-fix
Browse files Browse the repository at this point in the history
fix missing player valuations in bios
  • Loading branch information
JaseZiv authored Jan 17, 2024
2 parents dbd52b2 + 612966a commit a12f152
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 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.6.5.0001
Version: 0.6.5.0002
Authors@R: c(
person("Jason", "Zivkovic", , "[email protected]", role = c("aut", "cre", "cph")),
person("Tony", "ElHabr", , "[email protected]", role = "ctb"),
Expand Down
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
### Bugs

* `fb_league_stats()` not returning `opponent` table. (0.6.5.0001) [#355](https://github.com/JaseZiv/worldfootballR/issues/355)
* `tm_player_bio()` not returning values in the `player_valuation`, `max_player_valuation` and `max_player_valuation_date` fields. Unfortunately, `max_player_valuation` and `max_player_valuation_date` fields are no able to be scraped at this release (0.6.5.0002) [#357](https://github.com/JaseZiv/worldfootballR/issues/357)

***

Expand Down
6 changes: 3 additions & 3 deletions R/tm_player_bio.R
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ tm_player_bio <- function(player_urls) {
# handle for duplicate socials
a <- a %>% dplyr::distinct(X1, .keep_all = TRUE)

player_val <- tryCatch(player_page %>% rvest::html_nodes(".tm-player-market-value-development__current-value") %>% rvest::html_text() %>%
stringr::str_squish(), error = function(e) NA_character_) %>% .replace_empty_na()
player_val_max <- tryCatch(player_page %>% rvest::html_nodes(".tm-player-market-value-development__max-value") %>% rvest::html_text() %>%
player_val <- tryCatch(player_page %>% rvest::html_nodes(".data-header__market-value-wrapper") %>% rvest::html_text() %>%
stringr::str_squish() %>% gsub(" Last.*", "", .), error = function(e) NA_character_) %>% .replace_empty_na()
player_val_max <- tryCatch(player_page %>% rvest::html_nodes(".max") %>% rvest::html_text() %>%
stringr::str_squish(), error = function(e) NA_character_) %>% .replace_empty_na()
player_val_max_date <- tryCatch(player_page %>% rvest::html_nodes(".tm-player-market-value-development__max div") %>% .[3] %>% rvest::html_text() %>%
stringr::str_squish(), error = function(e) NA_character_) %>% .replace_empty_na()
Expand Down

0 comments on commit a12f152

Please sign in to comment.