reddit-habs / nhl-highlights

https://sbstp.ca/nhl/current/
zlib License
2 stars 1 forks source link

Research new API #7

Open sbstp opened 1 year ago

sbstp commented 1 year ago

Gamecenter Landing with more details https://api-web.nhle.com/v1/gamecenter/2023020070/landing

sbstp commented 1 year ago

Direct URL to videos are available at this endpoint https://edge.api.brightcove.com/playback/v1/accounts/6415718365001/videos/6339812143112

This uses the video ID from the game center landing API

The request must have a "policy key" in the accept header, i.e. Accept: application/json;pk=<policy key>

sbstp commented 1 year ago

Policy key from above is expired. Need to find a way to grab it.

Video links also have a fastly token which makes the URL expire: https://github.com/fastly/token-functions

The token is base64. The characters up to the underscore are a unix timestamp encoded in hex that indicate when the link will expire. The token looks to be signed with HMAC, so not tampering possible there.

sbstp commented 1 year ago

I'd rather just link to the official recap page https://www.nhl.com/video/topic/game-recaps/recap-blues-at-flames-10-26-23-6339948200112 but there's no such page for condensed games (extended recaps)

sbstp commented 1 year ago

The condensed game is available on a button here https://www.nhl.com/gamecenter/cbj-vs-mtl/2023/10/26/2023020103 but cannot be linked to directly.