Hi, guys, I'm trying to get the MPD token from a Claro account using a script, but it's getting complicated. Could you help me? Thanks.
HTML Code:import httpx import time import base64 import json # CREDENCIALES Y CONFIGURACIÓN email = "cd@gmail.com" password = "reel19" authpn = "webclient" authpt = "tfg1h3j4k6fdg" region = "argentina" device_id = "web" device_model = "web" device_type = "web" device_so = "Chrome" device_manufacturer = "generic" api_version = "v5.94" user_agent = "Mozilla/5.0" # INFO DE CONTENIDO content_id = "766774" group_id = "766212" # Función para decodificar JWT def decodificar_jwt(token): payload = token.split(".")[1] padded = payload + "=" * (-len(payload) % 4) decoded = base64.urlsafe_b64decode(padded) return json.loads(decoded) # Función para login def iniciar_sesion(): url = "https://mfwkweb-api.clarovideo.net/services/user/login" payload = { "user": email, "password": password, } params = { "device_id": device_id, "device_category": device_type, "device_model": device_model, "device_type": device_type, "device_so": device_so, "device_manufacturer": device_manufacturer, "authpn": authpn, "authpt": authpt, "api_version": api_version, "region": region, "format": "json", "includpaywayprofile": "true" } with httpx.Client() as client: r = client.post(url, params=params, data=payload) r.raise_for_status() data = r.json() return { "user_token": data["response"]["user_token"], "user_hash": data["response"]["session_userhash"], "user_id": data["response"]["user_id"], "HKS": data["response"]["session_stringvalue"] } # Verifica si el token está vencido def token_valido(jwt): try: payload = decodificar_jwt(jwt) return int(time.time()) < int(payload["exp"]) except: return False # Función para obtener el MPD def obtener_mpd(info): url = "https://mfwkweb-api.clarovideo.net/services/player/getmedia" params = { "crDomain": "https://www.clarovideo.com", "api_version": api_version, "user_hash": info["user_hash"], "group_id": group_id, "user_id": info["user_id"], "device_id": device_id, "stream_type": "dashwv", "preview": "0", "css": "0", "content_id": content_id, "authpn": authpn, "authpt": authpt, "device_category": device_type, "device_manufacturer": device_manufacturer, "device_model": device_model, "device_type": device_type, "format": "json", "region": region, "HKS": info["HKS"] } headers = { "User-Agent": user_agent, "Authorization": f"Bearer {info['user_token']}" } with httpx.Client() as client: r = client.get(url, params=params, headers=headers) r.raise_for_status() data = r.json() if "response" in data: mpd_url = data["response"]["delivery"][0]["videos"]["video"]["url"] print("✅ MPD URL:") print(mpd_url) else: print("❌ Error al obtener el MPD.") print(data) # PROGRAMA PRINCIPAL def main(): print("🔐 Verificando token...") try: with open("credenciales.json", "r") as f: info = json.load(f) except FileNotFoundError: info = iniciar_sesion() with open("credenciales.json", "w") as f: json.dump(info, f) if not token_valido(info["user_token"]): print("🔁 Token vencido, iniciando sesión nuevamente...") info = iniciar_sesion() with open("credenciales.json", "w") as f: json.dump(info, f) obtener_mpd(info) if __name__ == "__main__": main()
Support our site by donate $5 directly to us Thanks!!!
Try StreamFab Downloader and download streaming video from Netflix, Amazon!
Try StreamFab Downloader and download streaming video from Netflix, Amazon!
+ Reply to Thread
Results 1 to 1 of 1
Similar Threads
-
Problem with Dazn MPD With token in OTT Navigator
By plusf1 in forum Video Streaming DownloadingReplies: 8Last Post: 10th Feb 2025, 23:29 -
how to get a fresh token
By ed8317 in forum Video Streaming DownloadingReplies: 4Last Post: 5th Jul 2024, 09:19 -
m3u8 with token
By piwi1 in forum Video Streaming DownloadingReplies: 5Last Post: 24th Mar 2024, 03:24 -
Where to start from? token+?
By pak0 in forum Video Streaming DownloadingReplies: 2Last Post: 22nd Nov 2023, 23:52 -
Convert drm mpd source to simple mpd or m3u8 without drm.
By alberto404 in forum Newbie / General discussionsReplies: 0Last Post: 5th Aug 2023, 11:05