from nba_api.stats.library import http as stats_http
from nba_api.library import http as base_http
stats_http.STATS_HEADERS = NBA_STATS_HEADERS # global constant
stats_http.NBAStatsHTTP.headers = NBA_STATS_HEADERS # class default
# Reset any existing session so stale connections are dropped
stats_http.NBAStatsHTTP._session = None
base_http.NBAHTTP._session = None
raw_data = videoeventsasset.VideoEventsAsset(game_id='0022400015', game_event_id='16')
videoURL = raw_data.get_dict()['resultSets']['Meta']['videoUrls']
The above code returns the entire videoURLs object. When I view the link for each video, it returns a 15 second video saying, "Video Not Available" instead of the actual play I'm wanting to view.
Is there something I'm missing with my code? Here are the headers.
NBA_STATS_HEADERS: dict[str, str] = {
"Accept": "application/json, text/plain, /",
"Accept-Encoding": "gzip, deflate, br",
"Accept-Language": "en-US,en;q=0.9",
"Cache-Control": "no-cache",
"Connection": "keep-alive",
"Host": "stats.nba.com",
"Origin": "https://www.nba.com",
"Pragma": "no-cache",
"Referer": "https://www.nba.com/",
"Sec-Ch-Ua": '"Google Chrome";v="131", "Chromium";v="131", "Not_A Brand";v="24"',
"Sec-Ch-Ua-Mobile": "?0",
"Sec-Ch-Ua-Platform": '"Windows"',
"Sec-Fetch-Dest": "empty",
"Sec-Fetch-Mode": "cors",
"Sec-Fetch-Site": "same-site",
"User-Agent": (
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) "
"AppleWebKit/537.36 (KHTML, like Gecko) "
"Chrome/131.0.0.0 Safari/537.36"
),
}
The above code returns the entire videoURLs object. When I view the link for each video, it returns a 15 second video saying, "Video Not Available" instead of the actual play I'm wanting to view.
Is there something I'm missing with my code? Here are the headers.