magentaeu: more headers

This commit is contained in:
Nirvana
2026-06-30 13:35:46 +02:00
parent 188c95f45a
commit 2aee8df1fc
2 changed files with 30 additions and 21 deletions
@@ -243,20 +243,29 @@ def get_guest_headers(country: str, device_id: str, session_id: str) -> Dict[str
import uuid
headers = {
"User-Agent": USER_AGENT,
"X-User-Agent": X_USER_AGENT,
"X-Call-Type": "GUEST_USER",
"X-Tv-Flow": "START_UP",
"X-Tv-Step": "EPG_CHANNEL",
"accept": "application/json, text/plain, */*",
"accept-language": ACCEPT_LANGUAGE,
"app_key": get_app_key(country),
"app_version": APP_VERSION,
"bff_token": "",
"cache-control": "no-cache",
"device-density": DEVICE_DENSITY,
"device-id": device_id,
"device-name": DEVICE_NAME,
"origin": get_base_url(country),
"pragma": "akamai-x-cache-on,akamai-x-check-cacheable,akamai-x-get-cache-key",
"priority": "u=1, i",
"sec-ch-ua": '"Google Chrome";v="149", "Chromium";v="149", "Not)A;Brand";v="24"',
"sec-ch-ua-mobile": "?0",
"sec-ch-ua-platform": '"Linux"',
"sec-fetch-dest": "empty",
"sec-fetch-mode": "cors",
"sec-fetch-site": "cross-site",
"tenant": "tv",
"user-agent": USER_AGENT,
"x-call-type": "GUEST_USER",
"x-request-session-id": session_id,
"x-request-tracking-id": str(uuid.uuid4()),
"Tenant": "tv",
"Origin": get_base_url(country),
"App_key": get_app_key(country),
"App_version": APP_VERSION,
"Device-Id": device_id,
"Device-Name": DEVICE_NAME,
"Accept-Language": ACCEPT_LANGUAGE,
"Device-Density": DEVICE_DENSITY,
"x-user-agent": X_USER_AGENT,
}
return headers
@@ -382,13 +382,13 @@ class MagentaEUEpgManager:
logger.info(f"[MagentaEUEpgManager] Using session_id: {session_id}")
headers = get_guest_headers(self._country, device_id, session_id)
headers.update(
{
"X-Tv-Flow": flow,
"X-Tv-Step": step,
"x-request-tracking-id": str(uuid.uuid4()),
}
)
headers.update({
"x-call-time": str(int(time.time() * 1000)), # Unix timestamp in ms
"x-tv-flow": flow,
"x-tv-step": step,
"x-txn-id": uuid.uuid4().hex, # Transaction ID
"x-request-tracking-id": str(uuid.uuid4()),
})
logger.debug(f"[MagentaEUEpgManager] Request headers: {headers}")
return headers
@@ -411,7 +411,7 @@ class MagentaEUEpgManager:
conversion belongs here; do not reintroduce it.
"""
merged: Dict[str, Any] = {}
headers = self._guest_headers(flow="START_UP", step="EPG_SCHEDULES")
headers = self._guest_headers(flow="EPG", step="EPG_SCHEDULES")
utc_date = self._ensure_tz(date).astimezone(timezone.utc)
formatted = utc_date.strftime("%Y-%m-%d")