script to get mpd link from live channels
Code:import requests import json from urllib3.exceptions import InsecureRequestWarning headers = { 'Host': 'entitlement.tod.tv', 'Sec-Ch-Ua': '"Chromium";v="112", "Google Chrome";v="112", "Not:A-Brand";v="99"', 'Accept': 'application/json, text/plain, */*', 'Content-Type': 'application/json', 'Sec-Ch-Ua-Mobile': '?0', 'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36', 'Sec-Ch-Ua-Platform': '"Linux"', 'Origin': 'https://www.tod.tv', 'Referer': 'https://www.tod.tv/', 'Accept-Encoding': 'gzip, deflate', 'Accept-Language': 'en-US,en;q=0.9,ar;q=0.8', } json_data = { 'Type': 1, 'User': 'YOUR_TOKEN_HERE', 'VideoId': '0522e9b1-66ad-4e7d-b2b3-779ba106809a', 'VideoSource': 'https://live-d-main-beinmena.beincdn.com/ch10/59f4d245-04d1-460e-92e7-07714ddc7c3f/59f4d245-04d1-460e-92e7-07714ddc7c3f.ism/manifest(format=mpd-time-csf,filter=desktop-fullres,encryption=cenc)', 'VideoKind': '', 'AssetState': '2', 'PlayerType': 'HTML5', 'VideoSourceFormat': 'DASH', 'VideoSourceName': 'Desktop-DASH', 'DRMType': 'widevine', 'AuthType': 'Token', 'ContentKeyData': 'd3336025-54a5-44fe-93be-3a68991f4f0d', 'Other': '52346197-E22B-1470-C8E8-38F76BBC4AAD|HTML5|HTML5_Web|%2Fwatch%2Fsoccer-premier-league-newcastle-united-vs-tottenham-hotspur-199386|54d1b6e1-dbb4-4a5c-962f-b78d759a0333', } requests.packages.urllib3.disable_warnings(category=InsecureRequestWarning) response1 = requests.post( 'https://entitlement.tod.tv/entitlement/api/video/azure/diva/open', headers=headers, json=json_data, verify=False, ) body = json.loads(response1.text) headers2 = { 'Host': 'live-d-main-beinmena.beincdn.com', # 'Content-Length': '1534', 'Sec-Ch-Ua': '"Chromium";v="112", "Google Chrome";v="112", "Not:A-Brand";v="99"', 'Accept': 'application/json, text/plain, */*', 'Content-Type': 'application/json', 'Sec-Ch-Ua-Mobile': '?0', 'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36', 'Sec-Ch-Ua-Platform': '"Linux"', 'Origin': 'https://www.tod.tv', 'Sec-Fetch-Site': 'same-site', 'Sec-Fetch-Mode': 'cors', 'Sec-Fetch-Dest': 'empty', 'Referer': 'https://www.tod.tv/', # 'Accept-Encoding': 'gzip, deflate', 'Accept-Language': 'en-US,en;q=0.9,ar;q=0.8', } requests.packages.urllib3.disable_warnings(category=InsecureRequestWarning) response2 = requests.get( body["ContentUrl"], allow_redirects=False, headers=headers2, verify=False, ) print("TOD URL ## -->:") print(response2.headers["Location"]) exit()
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 10 of 10
			
		- 
	
- 
	if possible add request dynamic 'token' 'ContentKeyData' 'Other' Last edited by ORSA; 29th Dec 2023 at 12:50. 
- 
	@naim2007 
 they has been updated their site, and urls changed, could you make another one to get mpd link?
- 
	Code:import requests import json from http.cookiejar import MozillaCookieJar def get_cookies(cookiefile): cj = MozillaCookieJar(cookiefile, policy=False) cj.load(ignore_discard=True, ignore_expires=True) return {cookie.name: cookie.value for cookie in cj} req = requests.Session() req.cookies.update(get_cookies()) # update your cookies id = ''# channel id e.g. 5003195 url = "https://www.tod.tv/api/service" headers = { "Content-Type": "application/json" } payload = { "requestInit": { "method": "POST", "body": json.dumps({ "contentId":id, "playRequestType": "CHANNEL", "internetConnectionType": "WIFI", "streamFormatType": "DASH", "alternativeStreamFormat": "HLS", "contentType": "CHANNEL" }), }, "skipAPIKeyControl": False, "url": "http://tod2-mw-play-prod.mw-play.svc.cluster.local/api/v1/play/cdn" } response = req.post( url, json=payload, headers=headers) cdnUri = response.json()['data']['cdnInfos'][0]['cdnUri'] hashValue = response.json()['data']['hashValue'] licenseStartDate =response.json()['data']['licenseStartDate'] mediaId = response.json()['data']['cdnInfos'][0]['mediaId'] payload = { "requestInit": { "method": "POST", "body": json.dumps({ "contentId": id, "assetId": id, "cdnProvider": "Akamai", "cdnUri": cdnUri, "hashValue": hashValue, "playRequestType": "CHANNEL", "streamFormatType": "DASH", "alternativeStreamFormat": "HLS", "licenseStartDate":licenseStartDate , "rulesetModel": [ {"key": "downloadedDevices" , "value": "5" }, {"key": "maxactivestreams" , "value": "2" }, {"key": "maxvodstreams" , "value": "2" }, {"key": "maxliveandvodsports" , "value": "2" }, {"key": "defaultResolution" , "value": "1080" }, {"key": "audioQuality" , "value": "Standard"}, {"key": "videoQuality" , "value": "Better" }, {"key": "allowCasting" , "value": "True" }, {"key": "allowOfflineDownload" , "value": "True" }, {"key": "registeredDeviceLimit", "value": "5" } ], "packageTags": ["u-false", "e-false"], "cardType": "Total" }) }, "skipAPIKeyControl": False, "url": "http://tod2-mw-play-prod.mw-play.svc.cluster.local/api/v1/play/ticket" } response = req.post( url, json=payload, headers=headers) for tickets in response.json()['data']['tickets']: if tickets['ticketType'] == "CDN": ticket = tickets['ticket'] mpd = cdnUri+ f"?{ticket}" print(mpd)  Last edited by notaghost; 22nd Mar 2025 at 17:57. discord=notaghost9997
- 
	
- 
	After extensive reverse engineering, Ive successfully developed a Bash script that communicates with the TOD streaming backend to simulate a full channel play request flow. 
 
 ✅ What the script already achieves:
  Sends a fully authenticated request using a valid Bearer token and proper headers.
  Extracts key response data including:
  cdnUri
  cdnProvider
  hashValue
  rulesetModel
  licenseStartDate
  packageTags
  Modifies the rulesetModel to increase stream and device limits.
  Constructs and sends the second structured payload to request playback.
  Validates all JSON responses and ensures no missing critical data.
  Prepares all the necessary values that are used in FairPlay DRM sessions.
 
 🔐 Whats missing:
 To complete the streaming process, I still need to:
  Correctly initiate and handle FairPlay DRM playback.
  Pass the extracted ckc, sks, and DRM values to a working AVPlayer or compatible player.
  Emulate or handle the AVContentKeySession lifecycle, including fetching and decrypting the CKC (Content Key Context).
 
 🧠 If you have expertise in FairPlay integration or know how to securely inject DRM parameters into iOS/macOS,,, whatever ! players, Id appreciate any insight or collaboration.
 [Attachment 86877 - Click to enlarge]
Similar Threads
- 
  Generator m3u8 from Youtube LiveBy hencha in forum Video Streaming DownloadingReplies: 1Last Post: 11th Jun 2023, 14:20
- 
  Different PSSH in mpd, EME logger and PSSH Box GeneratorBy Kevste in forum Video Streaming DownloadingReplies: 4Last Post: 31st May 2023, 23:24
- 
  Downloading encrypted live MPD (again......)By qwertiio in forum Video Streaming DownloadingReplies: 0Last Post: 22nd Nov 2022, 05:45
- 
  How to download LIVE stream (.mpd)By andrewzhong in forum Video Streaming DownloadingReplies: 7Last Post: 16th Jun 2021, 23:42
- 
  Help decrypt MPD Live StreamBy Egn69217j_ in forum Video Streaming DownloadingReplies: 8Last Post: 13th Apr 2021, 08:21


 
		
		 View Profile
				View Profile
			 View Forum Posts
				View Forum Posts
			 Private Message
				Private Message
			 
 
			
			
 Quote
 Quote Visit Homepage
				Visit Homepage
			
