From 99fa11212c44125216358f74e49fdaffa50900e9 Mon Sep 17 00:00:00 2001 From: Nirvana Date: Sat, 29 Nov 2025 17:45:03 +0100 Subject: [PATCH] Add hrti --- .../providers/hrti/auth.py | 20 +++++++++++++++++-- .../providers/hrti/constants.py | 4 ++-- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/lib/streaming_providers/providers/hrti/auth.py b/lib/streaming_providers/providers/hrti/auth.py index db99963..0465d98 100644 --- a/lib/streaming_providers/providers/hrti/auth.py +++ b/lib/streaming_providers/providers/hrti/auth.py @@ -298,11 +298,17 @@ class HRTiAuthenticator(BaseAuthenticator): raise e def _register_device(self): - """Register device with HRTi using API headers""" + """Register device with HRTi using API headers with proper authorization""" try: + # Get the bearer token from current token bearer_token = self._current_token.access_token if self._current_token else '' + + # Use API headers with proper authorization and referer headers = self._get_api_headers(bearer_token) + # Update the referer to root path for device registration + headers['referer'] = f'{self.config.base_website}/' + payload = { "DeviceSerial": self._device_id, "DeviceReferenceId": self.config.device_reference_id, @@ -314,6 +320,13 @@ class HRTiAuthenticator(BaseAuthenticator): "ClientType": self.config.client_type } + # Log the request for debugging + safe_headers = headers.copy() + if 'authorization' in safe_headers: + safe_headers['authorization'] = f"{safe_headers['authorization'][:20]}..." + logger.debug(f"HRTi Device Registration Headers: {safe_headers}") + logger.debug(f"HRTi Device Registration Payload: {payload}") + response = self.http_manager.post( self.config.api_endpoints['register_device'], operation='api', @@ -327,11 +340,14 @@ class HRTiAuthenticator(BaseAuthenticator): logger.warning(f"HRTi device registration failed: {e}") def _get_initial_data(self): - """Get initial content rating and profiles using API headers""" + """Get initial content rating and profiles using API headers with proper authorization""" try: bearer_token = self._current_token.access_token if self._current_token else '' headers = self._get_api_headers(bearer_token) + # Update the referer to root path for these API calls + headers['referer'] = f'{self.config.base_website}/' + # Get content ratings content_response = self.http_manager.post( self.config.api_endpoints['content_ratings'], diff --git a/lib/streaming_providers/providers/hrti/constants.py b/lib/streaming_providers/providers/hrti/constants.py index c595b63..e02d625 100644 --- a/lib/streaming_providers/providers/hrti/constants.py +++ b/lib/streaming_providers/providers/hrti/constants.py @@ -42,9 +42,9 @@ class HRTiDefaults: OPERATOR_REFERENCE_ID = 'hrt' MERCHANT = 'aviion2' CONNECTION_TYPE = 'LAN/WiFi' - APPLICATION_VERSION = '5.62.5' + APPLICATION_VERSION = '5.97.6' OS_VERSION = 'Linux' - CLIENT_TYPE = 'Chrome 96' + CLIENT_TYPE = 'Chrome 142' # User Agent USER_AGENT = 'kodi plugin for hrti.hrt.hr (python)'