Comments (3)
Hi @IvoVillanueva , I've gone ahead and revamped all the functions to use httr
proper so that it avoids the 503 errors.
get_nfl_teams()
works again!
get_nfl_teams()
Getting NFL teams!
# A tibble: 32 x 8
team_id team_name team_nickname team_abb team_full_name team_color
<chr> <chr> <chr> <chr> <chr> <chr>
1 22 Cardinals Arizona ARI Arizona Cardinals #A40227
2 1 Falcons Atlanta ATL Atlanta Falcons #000000
3 33 Ravens Baltimore BAL Baltimore Ravens #2B025B
4 2 Bills Buffalo BUF Buffalo Bills #04407F
5 29 Panthers Carolina CAR Carolina Panthers #2177B0
6 3 Bears Chicago CHI Chicago Bears #152644
7 4 Bengals Cincinnati CIN Cincinnati Bengals #FF2700
8 5 Browns Cleveland CLE Cleveland Browns #4C230E
9 6 Cowboys Dallas DAL Dallas Cowboys #002E4D
10 7 Broncos Denver DEN Denver Broncos #002E4D
# … with 22 more rows, and 2 more variables: team_alt_color <chr>,
# logo <chr>
from espnscraper.
Howdy! I'm going to have to refactor to httr::GET()
calls, thanks for heads up. The behavior is more consistent that way.
from espnscraper.
Hi Tom
With your permission I propose this code change so that the function works.
(sorry for my English)
get_nfl_teams <- function() {
message("Getting NFL teams!")
team_url <- "https://site.api.espn.com/apis/site/v2/sports/football/nfl/teams?&limit=50"
raw_teams <- jsonlite::read_json(team_url)
raw_teams$sports[[1]]$leagues[[1]]$teams%>%
tibble::enframe() %>%
dplyr::select(-name) %>%
tidyr::unnest_wider(value) %>%
tidyr::unnest_wider(team) %>%
dplyr::select(-links) %>%
dplyr::as_tibble() %>%
dplyr::mutate("logoDefault" = purrr::map_chr(logos, function(df) df[[1]][[1]]),
"logoDark" = purrr::map_chr(logos, function(df) df[[2]][[1]]),
"logoScoreboard" = purrr::map_chr(logos, function(df) df[[3]][[1]]),
"logoDarkScoreboard" = purrr::map_chr(logos, function(df) df[[4]][[1]])) %>%
dplyr::select(id, name:alternateColor,-shortDisplayName, logoDefault:logoDarkScoreboard) %>%
purrr::set_names(
nm = c(
"uid", "team_name", "team_nickname", "team_short_name", "full_name", "team_color",
"alternate_color", "logodefault", "logodark", "logoscoreboard", "logodarkscoreboard"
)) %>%
dplyr::mutate(
team_color = paste0("#", team_color),
alternate_color = paste0("#", alternate_color)
)
%>%
dplyr::mutate(
team_color = paste0("#", team_color),
alternate_color = paste0("#", alternate_color)
)
}
I hope you do not mind
from espnscraper.
Related Issues (20)
- Wrong team in ESPN API? HOT 4
- get_nfl_boxscore_players(game_id = "401220131") HOT 4
- Connection Error HOT 2
- get_college_qbr() only pulling 2020 data HOT 6
- get_athlete() Error: Not Found (HTTP 404) HOT 1
- List of Player ID's HOT 1
- Some boxscores do not appear HOT 1
- 2022 Pass Win Rates Update HOT 2
- Error in player name for players on multiple teams throughout the year HOT 1
- Installation Assistance HOT 1
- `scrape_team_stats_nfl` gives error when `role="defense"` HOT 2
- Defense type in scrape_espn_stats() HOT 1
- Add 2023 win rates? HOT 2
- ESPN Data inconsistent HOT 3
- Intragame win probability HOT 3
- Unable to pull 2020 College QBR HOT 2
- Two stray commas causing get_nfl_schedule to fail HOT 1
- College QBR Data missing HOT 6
- keep venue in get_schedule_data HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from espnscraper.