feat(hls): license every content key of a FairPlay bridge playlist that rotates its key

This commit is contained in:
imSp4rky
2026-12-01 18:32:36 -07:00
parent e0880812d5
commit 41c2b3d86a
12 changed files with 478 additions and 76 deletions
+4 -4
View File
@@ -29,7 +29,7 @@ from unshackle.core.constants import DOWNLOAD_CANCELLED, DOWNLOAD_LICENCE_ONLY,
from unshackle.core.downloaders.requests import requests
from unshackle.core.drm import DRM_T, PlayReady, Widevine
from unshackle.core.drm.cbcs import SampleDecrypter
from unshackle.core.drm.cenc import cenc_key, drm_stub, init_kid
from unshackle.core.drm.cenc import cenc_key, init_kid
from unshackle.core.drm.verify import (
children,
find_child_box,
@@ -998,7 +998,7 @@ class Track:
"""Load the Widevine and PlayReady DRM of the EXT-X-KEY and EXT-X-SESSION-KEY tags of this track's playlist.
It skips a tag that gives no DRM, and raises ValueError when the fetch fails or when every such tag fails.
With ``bridge`` it builds both stubs for the key ID that ``HLS.get_bridge_kid`` finds when no tag gives a DRM.
With ``bridge`` it builds both stubs for the key IDs that ``HLS.get_bridge_kids`` finds when no tag gives a DRM.
"""
if self.drm:
self.needs_drm_loading = False
@@ -1032,8 +1032,8 @@ class Track:
segments = [
s for s in playlist.segments if not (callable(self.OnSegmentFilter) and self.OnSegmentFilter(s))
]
if kid := HLS.get_bridge_kid(playlist, segments, self, session):
drm_list = [drm_stub(system, [kid.hex]) for system in SYSTEMS]
if kids := HLS.get_bridge_kids(playlist, segments, self, session):
drm_list = [HLS.bridge_stub(system, kids) for system in SYSTEMS]
if drm_list:
self.drm = drm_list
self.needs_drm_loading = False