Files
unshackle/unshackle/services/EXAMPLE/config.yaml
T
imSp4rky 466bf610cc feat(drm): add native DASH ClearKey (org.w3.clearkey) support
unshackle's DASH parser only recognised Widevine and PlayReady ContentProtection, so services using W3C EME ClearKey had to fake a Widevine object and monkey-patch get_content_keys. Add a first-class ClearKeyCENC DRM type so services just implement a license callback.

- ClearKeyCENC (core/drm/clearkey_cenc.py): KID-based, no CDM/PSSH; builds the W3C JSON license request (unpadded base64url), parses the JWK Set response (dict/str/bytes), falls back to POSTing the manifest Laurl when the service returns None, decrypts via the same shaka/ mp4decrypt CENC path as Widevine
- DASH.get_drm emits ClearKeyCENC for scheme e2719d58-...; KID from own or sibling mp4protection cenc:default_KID, Laurl across dashif/legacy/ bare namespaces
- track.download dispatches prepare_drm for ClearKeyCENC; dl.prepare_drm gains a clearkey branch (cache/vault lookup, license-failure tolerated when content_keys pre-populated, vault push, export)
- Service.get_clearkey_license base callback (default None -> Laurl); drm_from_dict reconstructs ClearKeyCENC for export/import round-trip
- EXAMPLE service + config demo the callback
- Tests: tests/core/test_clearkey_cenc.py and an export round-trip case
- Docs: DRM_CONFIG.md ClearKey section
2026-06-11 12:26:57 -06:00

41 lines
1.5 KiB
YAML

# Reference config for the EXAMPLE showcase service.
# Access in code as self.config["endpoints"]["..."] — never hardcode URLs.
endpoints:
login: https://api.domain.com/v1/login
refresh: https://api.domain.com/v1/token/refresh
search: https://api.domain.com/v1/search
metadata: https://api.domain.com/v1/metadata/{title_id}.json
streams: https://api.domain.com/v1/streams
playback: https://api.domain.com/v1/playback/{title_id} # HLS alternate
widevine_license: https://api.domain.com/v1/license/widevine
playready_license: https://api.domain.com/v1/license/playready
clearkey_license: https://api.domain.com/v1/license/clearkey # DASH org.w3.clearkey (omit to use manifest Laurl)
# Base64 Widevine service certificate (enables privacy-mode license requests).
certificate: null
# Per-device client profiles, selected via -d/--device (click.Choice in cli()).
client:
android_tv:
user_agent: USER_AGENT
license_user_agent: LICENSE_USER_AGENT
type: DASH
web:
user_agent: USER_AGENT
license_user_agent: LICENSE_USER_AGENT
type: DASH
# Auto-selected when a PlayReady CDM is detected (see __init__ is_playready_cdm).
playready_tv:
user_agent: USER_AGENT
license_user_agent: LICENSE_USER_AGENT
type: DASH
ios:
user_agent: USER_AGENT
license_user_agent: LICENSE_USER_AGENT
type: HLS
# Optional: title_map remaps API titles to canonical filename titles (per-service, #106).
# title_map:
# "Show (US)": "Show"