Skip to main content

Variable: helper_nba_pbp

const helper_nba_pbp: (game_id, pbp_txt) => PbpResult = NBA.pbp

Defined in: src/producers/espn_basketball_pbp.ts:1088

NBA cleaned game dict (sdv-py helper_nba_pbp(game_id, pbp_txt)): pickcenter -> game data -> play features, then the result keys in py's order.

Parameters​

game_id​

unknown

The ESPN event id; the result's gameId (a decimal string) and the plays' game_id.

pbp_txt​

any

The TRIMMED summary (what espn_nba_pbp(id, { raw: true }) returns): every output key must be present (winprobability, boxscore, header, format, broadcasts, videos, standings, article, leaders, seasonseries, pickcenter, againstTheSpread, odds, predictor, espnWP, gameInfo, season), plus plays when the game has play-by-play.

Returns​

PbpResult

The PbpResult. Without a plays key, or when header.competitions[0].playByPlaySource is "none", plays is [] and timeouts holds the two empty { "1": [], "2": [] } entries.

Throws​

Error prefixed KeyError: when an output key is absent from pbp_txt; plus everything helper_nba_pickcenter, helper_nba_game_data and helper_nba_pbp_features throw.

Throws​

TypeError when a play / team id is a JS number beyond Number.MAX_SAFE_INTEGER.

Example​

const trimmed = await sdv.nba.espn_nba_pbp(401360428, { raw: true });
const game = sdv.nba.helper_nba_pbp(401360428, trimmed);
game.timeouts[game.plays[0].homeTeamId]["2"]; // second-half home timeout play ids

Remarks​

Shared by all four leagues (the others @see this block): espn_<lg>_pbp fetches the summary, trims it and calls this; use that unless you already hold a trimmed payload. NBA / WNBA keep seasonseries; MBB / WBB do not and coerce gameId with int() first (a non-integer id raises ValueError:).