diff --git a/R/get_game_shifts.R b/R/get_game_shifts.R index bf25e81..7b4012c 100644 --- a/R/get_game_shifts.R +++ b/R/get_game_shifts.R @@ -11,8 +11,10 @@ #' @export #' #' @examples -#' \dontrun{ -#' get_game_shifts(2020020561) +#' \donttest{ +#' try({ +#' get_game_shifts(game_id = 2023020201) +#' }) #' } get_game_shifts <- function(game_id){ diff --git a/R/get_player_stats_hr.R b/R/get_player_stats_hr.R index 664ce72..5320aec 100644 --- a/R/get_player_stats_hr.R +++ b/R/get_player_stats_hr.R @@ -11,9 +11,10 @@ #' @export #' #' @examples -#' \dontrun{ -#' #' get_player_stats("Wayne Gretzky") -#' get_player_stats_hr(c("Wayne Gretzky","Mario Lemieux")) +#' \donttest{ +#' try({ +#' get_player_stats_hr("Connor Bedard") +#' }) #' } get_player_stats_hr <- function(player_name, season = "career", league = "NHL"){ @@ -46,7 +47,13 @@ get_player_stats_hr <- function(player_name, season = "career", league = "NHL"){ } player <- session %>% - rvest::html_element("table") + rvest::html_element("#stats_basic_plus_nhl") + + # check for missing table + if(length(player) == 0){ + player <- session %>% + rvest::html_element("#stats_basic_nhl") + } # skip players with no stats # likely linking to wrong player diff --git a/R/scrape_game.R b/R/scrape_game.R index c864c80..e21c218 100644 --- a/R/scrape_game.R +++ b/R/scrape_game.R @@ -115,8 +115,10 @@ #' @export #' #' @examples -#' \dontrun{ -#' pbp <- scrape_game(2020020420) +#' \donttest{ +#' try({ +#' pbp <- scrape_game(game_id = 2023020201) +#' }) #' } scrape_game <- function(game_id){ diff --git a/man/get_game_ids.Rd b/man/get_game_ids.Rd index 90417dc..6fcd53f 100644 --- a/man/get_game_ids.Rd +++ b/man/get_game_ids.Rd @@ -30,8 +30,10 @@ A tibble containing game IDs and basic info for specified time frame Fetch game IDs for a single day or a full season } \examples{ -\dontrun{ +\donttest{ +try({ get_game_ids(season = 2020) get_game_ids(day = "2015-03-12") +}) } }