Skip to content

"Video Not Available" when I use VideoEventsAsset #682

Description

@possessionix
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"
),
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions