jthomasmock / espnscrapeR

Scrapes Or Collects NFL Data From ESPN
https://jthomasmock.github.io/espnscrapeR/
Other
51 stars 10 forks source link

get_athlete() Error: Not Found (HTTP 404) #16

Open StevenPlai opened 2 years ago

StevenPlai commented 2 years ago

get_athlete() function fails and returns the following: "Error: Not Found (HTTP 404)"

After browsing the source code the error is thrown after running this section of code:

  raw_get  <- base_url %>%
    glue::glue() %>%
    httr::GET()

  httr::stop_for_status(raw_get)

#Error: Not Found (HTTP 404).

It appears that the link for the API request is invalid, perhaps due to a change on ESPN's end. This function was working properly for me about two weeks ago, but has since stopped working.

jthomasmock commented 2 years ago

Hey @StevenPlai - thanks for your patience!

I'm not finding this error, 404 suggest a not found error so maybe it's the wrong ID?

See below:

packageVersion("espnscrapeR")
#> [1] '0.6.5'

# works
espnscrapeR::get_athlete("2580")
#> # A tibble: 1 × 21
#>   player_id player_guid          team_id pos   player_first_na… player_last_name
#>   <chr>     <chr>                <chr>   <chr> <chr>            <chr>           
#> 1 2580      a3d4f4473aef111aee5… <NA>    QB    Drew             Brees           
#> # … with 15 more variables: player_full_name <chr>, player_short_name <chr>,
#> #   weight <dbl>, height <dbl>, age <int>, dob <chr>, debut_year <int>,
#> #   headshot_url <chr>, jersey <chr>, nfl_exp <int>, draft_txt <chr>,
#> #   draft_year <int>, draft_round <int>, draft_slot <int>, draft_team_id <chr>

# not found
espnscrapeR::get_athlete("batman")
#> Error in espnscrapeR::get_athlete("batman"): Not Found (HTTP 404).

Created on 2022-05-13 by the reprex package (v2.0.1)