diff --git a/lib/streaming_providers/providers/rtlplus/channel_manager.py b/lib/streaming_providers/providers/rtlplus/channel_manager.py index 7d0074c..77b72b2 100644 --- a/lib/streaming_providers/providers/rtlplus/channel_manager.py +++ b/lib/streaming_providers/providers/rtlplus/channel_manager.py @@ -465,12 +465,15 @@ class RTLPlusChannelManager: if not upfront_token: return None - # Use the existing method from RTLPlusConfig + # Get headers from config (which now includes origin/referer) headers = self.cfg.get_drm_license_headers(upfront_token) # URL-encode headers for req_headers parameter req_headers = urllib.parse.urlencode(headers) + # Get unwrapper configuration from constants + unwrapper, unwrapper_params = self.cfg.get_drm_unwrapper_config() + return DRMConfig( system=DRMSystem.WIDEVINE, priority=3, @@ -480,6 +483,8 @@ class RTLPlusChannelManager: req_data="{CHA-RAW}", use_http_get_request=False, ), + unwrapper=unwrapper, + unwrapper_params=unwrapper_params, ) def _get_playready_config(self, upfront_token: str) -> Optional[DRMConfig]: diff --git a/lib/streaming_providers/providers/rtlplus/constants.py b/lib/streaming_providers/providers/rtlplus/constants.py index cd66170..2f60ffc 100644 --- a/lib/streaming_providers/providers/rtlplus/constants.py +++ b/lib/streaming_providers/providers/rtlplus/constants.py @@ -63,6 +63,16 @@ class RTLPlusDefaults: DRMTODAY_LICENSE_URL = "https://lic.drmtoday.com/license-proxy-widevine/cenc/" DRMTODAY_PLAYREADY_URL = "https://lic.drmtoday.com/license-proxy-headerauth/drmtoday/RightsManager.asmx" + # DRM License Response Parsing + DRM_LICENSE_UNWRAPPER = "json,base64" + DRM_LICENSE_UNWRAPPER_PARAMS = {"path_data": "license"} + + # DRM Request Headers (common for all DRM types) + DRM_COMMON_HEADERS = { + "origin": BETA_WEBSITE.rstrip("/"), + "referer": BETA_WEBSITE, + } + # Direct CDN ORIGIN_CDN_BASE = "https://origin.live.rtlde.bedrock.tech" @@ -371,14 +381,25 @@ class RTLPlusHeaders: @staticmethod def get_drm_license_headers(upfront_token: str, user_agent: str) -> dict: """Headers for DRM license request to DRMToday.""" - headers = dict(RTLPlusHeaders._COMMON_HEADERS) - headers.update({ + headers = { "content-type": "application/json", - "origin": RTLPlusDefaults.BASE_WEBSITE.rstrip("/"), - "referer": RTLPlusDefaults.BASE_WEBSITE, "user-agent": user_agent, "x-dt-auth-token": upfront_token, - }) + } + # Add common DRM headers + headers.update(RTLPlusDefaults.DRM_COMMON_HEADERS) + return headers + + @staticmethod + def get_playready_license_headers(upfront_token: str, user_agent: str = None) -> dict: + """Get headers for PlayReady license request to DRMToday.""" + headers = { + "Content-Type": "text/xml; charset=UTF-8", + "SOAPAction": RTLPlusDefaults.PLAYREADY_SOAP_ACTION, + "User-Agent": user_agent or RTLPlusDefaults.PLAYREADY_USER_AGENT, + "X-Dt-Auth-Token": upfront_token, # Note: Different case for PlayReady? + } + headers.update(RTLPlusDefaults.DRM_COMMON_HEADERS) return headers @staticmethod @@ -557,6 +578,19 @@ class RTLPlusConfig: user_agent=self.user_agent, ) + def get_playready_license_headers(self, upfront_token: str) -> dict: + return RTLPlusHeaders.get_playready_license_headers( + upfront_token=upfront_token, + user_agent=self.user_agent, + ) + + @staticmethod + def get_drm_unwrapper_config() -> tuple: + """Get unwrapper configuration for DRM license responses.""" + return ( + RTLPlusDefaults.DRM_LICENSE_UNWRAPPER, + RTLPlusDefaults.DRM_LICENSE_UNWRAPPER_PARAMS, + ) def get_drm_headers(self, access_token: str) -> dict: return RTLPlusHeaders.get_drm_headers( access_token=access_token, @@ -569,8 +603,3 @@ class RTLPlusConfig: access_token=access_token, device_id=self.device_id, ) - - @staticmethod - def get_playready_license_headers(upfront_token: str) -> dict: - """Get headers for PlayReady license request to DRMToday.""" - return RTLPlusHeaders.get_playready_drm_headers(upfront_token) \ No newline at end of file