Skip to content

Commit

Permalink
Merge pull request #337 from drasbaek/main
Browse files Browse the repository at this point in the history
fixed HTML change in tm_team_player_urls function
  • Loading branch information
JaseZiv authored Nov 12, 2023
2 parents 62ce06f + 6f89f4d commit 441ed6f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 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.4.0011
Version: 0.6.4.0012
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 @@ -9,6 +9,7 @@
* `fb_league_stats(team_or_player = "player")` returning wrong season's data for Australian league (0.6.4.0009) [#333](https://github.com/JaseZiv/worldfootballR/issues/333)
* `tm_player_market_values()` returing the player name and valuation on separate rows in the `player_name` column [#338] (https://github.com/JaseZiv/worldfootballR/issues/338) and also returning `NA`s for the `player_age` column (0.6.4.0010) [#336](https://github.com/JaseZiv/worldfootballR/issues/336)
* `fb_match_results()` returns `NA` goals due to inconsistent `iconv()` behvaior on different systems (0.6.4.0011) [#326](https://github.com/JaseZiv/worldfootballR/issues/326)
* `tm_team_player_urls()` html element changed on transfermarkt so stopped returning values (0.6.4.0012)


### Improvements
Expand Down
10 changes: 5 additions & 5 deletions R/worldfootballr_helpers.R
Original file line number Diff line number Diff line change
Expand Up @@ -201,16 +201,16 @@ tm_league_team_urls <- function(country_name, start_year, league_url = NA) {
#' @export
#'
tm_team_player_urls <- function(team_url) {

main_url <- "https://www.transfermarkt.com"

tryCatch({team_page <- xml2::read_html(team_url)}, error = function(e) {team_page <- c()})

player_urls <- team_page %>%
rvest::html_nodes(".data-link a") %>% rvest::html_attr("href") %>%
rvest::html_nodes("#yw1 td.posrela .hauptlink a") %>% rvest::html_attr("href") %>%
unique() %>%
paste0(main_url, .)

return(player_urls)
}

Expand Down

0 comments on commit 441ed6f

Please sign in to comment.