Skip to content

Commit

Permalink
Merge pull request #105 from toddrob99/develop
Browse files Browse the repository at this point in the history
v1.6.1
  • Loading branch information
toddrob99 authored Mar 6, 2023
2 parents ecf58c8 + 88c64be commit 78b2ae1
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 11 deletions.
26 changes: 16 additions & 10 deletions statsapi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1038,15 +1038,21 @@ def game_highlight_data(gamePk):
"fields": "dates,date,games,gamePk,content,highlights,items,headline,type,value,title,description,duration,playbacks,name,url",
},
)
if not len(
r["dates"][0]["games"][0]["content"]["highlights"]["highlights"]["items"]
):
return ""

items = r["dates"][0]["games"][0]["content"]["highlights"]["highlights"]["items"]
gameHighlights = (
r["dates"][0]["games"][0]
.get("content", {})
.get("highlights", {})
.get("highlights", {})
)
if not gameHighlights or not len(gameHighlights.get("items", [])):
return []

unorderedHighlights = {}
for v in (x for x in items if isinstance(x, dict) and x["type"] == "video"):
for v in (
x
for x in gameHighlights["items"]
if isinstance(x, dict) and x["type"] == "video"
):
unorderedHighlights.update({v["date"]: v})

sortedHighlights = []
Expand Down Expand Up @@ -1493,10 +1499,10 @@ def standings_data(
"wc_rank": x.get("wildCardRank", "-"),
"wc_gb": x.get("wildCardGamesBack", "-"),
"wc_elim_num": x.get("wildCardEliminationNumber", "-"),
"elim_num": x["eliminationNumber"],
"elim_num": x.get("eliminationNumber", "-"),
"team_id": x["team"]["id"],
"league_rank": x["leagueRank"],
"sport_rank": x["sportRank"],
"league_rank": x.get("leagueRank", "-"),
"sport_rank": x.get("sportRank", "-"),
}
divisions[x["team"]["division"]["id"]]["teams"].append(team)

Expand Down
2 changes: 1 addition & 1 deletion statsapi/version.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/usr/bin/env python

VERSION = "1.6"
VERSION = "1.6.1"

0 comments on commit 78b2ae1

Please sign in to comment.