converted to thisCode:if (i.decryptdata) { var f = new Uint8Array(t.data), v = f.subarray(0, 16), g = f.subarray(48, 64); (f = a( o(g), h( window.apkId.substring(0, 8) + window.apkId.substring(40) ),ERRORCode:def _decrypt_key(data): tmp1 = data[0:16] tmp2 = data[48:64] apk_Id2 = '62393432393963303832626562616234' dec1 = AES.new(bytes.fromhex(apk_Id2), AES.MODE_ECB) tmp3 = dec1.decrypt(tmp1) dec2 = AES.new(tmp3, AES.MODE_ECB) return dec2.decrypt(tmp2) result = _decrypt_key(data) hex_result = binascii.hexlify(result) base64key = (base64.b64encode(result).decode('utf-8'))can anyone helpCode:hlsdl -b -k 214050d145df223767baaf9cdf46913d https://dnqe0v482iyb1.cloudfront.net/spees/w/o/60e975430cf20278db21ff30/v/665abd11b31b884fc125383f/u/6225780a0cf29abe0345ee88/t/86a9c665cc3be9a04477165136957403/p/assets/videos/60e975430cf20278db21ff30/2024/06/01/665abd11b31b884fc125383f/index.m3u8 > START media_playlist_get_links > END media_playlist_get_links > START media_playlist_get_links > END media_playlist_get_links HLS Stream is AES-128 encrypted. File already exists. Overwrite? (y/n) y {"d_t":"vod"} {"t_d":4447,"d_d":0, "d_s":0} Downloading part 0 Error: Wrong length key-file. Expected 16 bytes but got 336. Error: AES128_CBC_DecryptUpdate failed: 0, in_size: 16176, out_size: 16160
+ Reply to Thread
Results 121 to 150 of 208
-
-
Code:
apkId = '623........' def _decrypt_key(data): tmp1 = data[0:16] tmp2 = data[48:64] apk_Id = apkId[0:8] + apkId[40:] dec1 = AES.new(bytes.fromhex(apk_Id), AES.MODE_ECB) tmp3 = dec1.decrypt(tmp1) dec2 = AES.new(tmp3, AES.MODE_ECB) return dec2.decrypt(tmp2)
-
slayer36 this is the
Code:url :https://dnqe0v482iyb1.cloudfront.net/spees/w/o/60e975430cf20278db21ff30/v/665abd11b31b884fc125383f/u/6225780a0cf29abe0345ee88/t/1c655b29dc23c37d7287acad018d9f96/p/assets/videos/60e975430cf20278db21ff30/2024/06/01/665abd11b31b884fc125383f/index.m3u8
Code:3263396632633966346163346637656462303432346163346637656462303432
-
-
Code:
if (i.decryptdata) { var f = new Uint8Array(t.data), v = f.subarray(0, 16), g = f.subarray(48, 64); (f = a( o(g), h( window.apkId.substring(0, 8) + window.apkId.substring(40)
[Attachment 79573 - Click to enlarge] apkidCode:6634623566346235346361623265353961633064346361623265353961633064
-
Try this script
Code:import re import base64 import requests from Crypto.Cipher import AES import binascii import os def _decrypt_key(data): tmp1 = data[0:16] tmp2 = data[48:64] apk_Id = apkId[0:8] + apkId[40:] dec1 = AES.new(bytes.fromhex(apk_Id), AES.MODE_ECB) tmp3 = dec1.decrypt(tmp1) dec2 = AES.new(tmp3, AES.MODE_ECB) return dec2.decrypt(tmp2) def dowload(): match = re.search(r"(https?://.*\/)", url_base) url_stream = match.group(1).strip() r=requests.get(url_base) matchs = re.findall(r"(h.*m3u8)", r.text) video = url_stream+matchs[-1] r=requests.get(video) matchs = re.search(r"AES-128,URI=\"(.*)\"", r.text) uri_url = url_stream+matchs.group(1).strip() res = requests.get(uri_url) res.encoding = "binary/octet-stream" key_data = _decrypt_key(res.content) base64_key = (base64.b64encode(key_data).decode('utf-8')) hex_key =(binascii.hexlify(key_data).decode('utf-8')) print(hex_key) os.system(f'hlsdl -K {hex_key} -o output.mp4 -b "{url_base}"') if __name__ == '__main__': apkId = input("Enter the apkId : ") url_base = input("Enter Index.m3u8url : ") dowload()
1. run the script
2. feed apkId & m3u8 url on terminal -
Running this on the previously downloaded timestamp file yields the wrong key. I'm guessing with the apkid, also the timestamp file changes/expires (in fact you can no longer download it from the same m3u8 as before). Basically, you should also provide a copy of the timestamp file that comes with the session (if apkid and function stay the same, then there's no need to copy-pasting them again).
Btw if you could provide an url where this video is freely accessible, it would make things easier. -
white_snake
https://dnqe0v482iyb1.cloudfront.net/spees/w/o/60e975430cf20278db21ff30/v/665abd11b31b...3f/k/timestamp
File 'timestamp'=985 Bt -
Code:
window.apkId.substring(0, 32)
Code:window.apkId.substring(0, 8) + window.apkId.substring(40)
Code:--custom-hls-key 9a9639f30f3d79c52be40c48e9923ac0
-
Major changes in the code, can someone help me with this? Thanks.
P.S.: I have everything working for the previous version. I feel we need to modify the decrypt_key function in the python script. But due to lack of JS knowledge, I cant figure it out
Code:(e.loadsuccess = function (t, e, r) { var i = r.frag, n = window.cjs, a = n.AES.decrypt, o = window.convertArrayToBase64, u = n.mode.ECB, d = n.enc, h = d.Hex.parse, c = n.pad.NoPadding; if (i.decryptdata) { var f = new Uint8Array(t.data), pp = t.url.split('/timestamp/')[1] ?? '', g = f.subarray(0, 16), v = f.subarray(48, 64); if (pp === 'aav') { g = f.subarray(0, 16); v = f.subarray(32, 48); } else if (pp === 'scw') { v = f.subarray(16, 32); g = f.subarray(48, 64); } else if (pp === 'scs') { g = f.subarray(0, 16); v = f.subarray(48, 64); } else if (pp === 'sdq') { v = f.subarray(0, 16); g = f.subarray(32, 48); } else if (pp === 'sxc') { g = f.subarray(16, 32); v = f.subarray(48, 64); } else if (pp === 'q1wq') { v = f.subarray(8, 24); g = f.subarray(32, 48); } else if (pp === 'w1q') { v = f.subarray(0, 16); g = f.subarray(48, 64); } (f = a(o(g), h(window.apkId.substring(0, 32)), { mode: u, padding: c, })), (f = d.u8array.stringify( a(o(v), f, { mode: u, padding: c }) )), (this.decryptkey = i.decryptdata.key = new Uint8Array(f.buffer)), (i.loader = null), delete this.loaders[i.type], this.hls.trigger(s.Events.KEY_LOADED, { frag: i }); } else l.logger.error("after key load, decryptdata unset"); })
-
-
-
Can you provide an HAR file of your session? (network tab -> right-click any request -> Save all as HAR)
-
Try with this android app:- https://play.google.com/store/search?q=lj+video+downloader&c=apps&redirect=0&redirect=0
-
which video ?
Any video from the free course link that I shared earlier. I need to know the procedure, so that I can replicate it for the paid courses. -
Code:
--custom-hls-key f9badf093868f00e1bc74e78f119b308
Code:tmp3 = dec1.decrypt(tmp1) dec2 = AES.new(tmp3, AES.MODE_ECB) return dec2.decrypt(tmp2)
-
-
You must take all the values from the same session, these are the values from your HAR session.
Code:import base64 from Crypto.Cipher import AES apkId = '3135636563313662626137633030653531356365633136626261376330306535' timestamp_b64 = 'Uz1lWmhAT3Jk3YzUxpM10qhP+XKNpBbXP1RnbS9IO04YEBL+/HVFHVLUKMgBugRD' timestamp = base64.b64decode(timestamp_b64) def decrypt_key(data, apkid): tmp1 = data[8:24] tmp2 = data[32:48] apkid = apkid[16:48] dec1 = AES.new(bytes.fromhex(apkid), AES.MODE_ECB) tmp3 = dec1.decrypt(tmp2) dec2 = AES.new(tmp3, AES.MODE_ECB) key = dec2.decrypt(tmp1) return key.hex() result = decrypt_key(timestamp, apkId) print('Hex key:', result)
-
Thanks a lot, its working now. The decrypt_key function I was using earlier, was't taking the timestamp_64 value into consideration. Just a couple more questions:
1. Do we need to get the timestamp_64 value from HAR file for each video separately? (In the previous method I could just iterate over the m3u8 links in the python script and download multiple videos in one go)
2. How do I locate the timestamp_64 value in the HAR file in a systematic manner?
Again, thank you very much. -
I just used the timestamp response in base64 because Chrome only lets you copy the response as such, but you could have downloaded the timestamp file and opened that as bytes in your code.
1. Both timestamp files and AES function values could change from video to video or from time to time for the same video.
2. You don't have to, as I said before this is just how Chrome lets you save the response, but you can grab it any way you like. Edit: to answer your question, you simply have to right click on the timestamp network request and select "Copy response" or w/e.Last edited by white_snake; 11th Jun 2024 at 16:09.
-
-
-
Similar Threads
-
howto deal with HLS 128 bit aes encrypted - the hard one
By code47 in forum Video Streaming DownloadingReplies: 63Last Post: 28th Dec 2023, 08:45 -
How do I download AES encrypted video streamed over HLS?
By Videogamer555 in forum Video Streaming DownloadingReplies: 1Last Post: 20th Jul 2022, 08:03 -
Help downloading AES-encrypted HLS video stream
By Woodswolf in forum Video Streaming DownloadingReplies: 26Last Post: 25th May 2019, 14:20 -
Help me with AES encrypted HLS downloading ?
By shraman in forum Video Streaming DownloadingReplies: 0Last Post: 30th Jul 2018, 06:54 -
Help downloading AES-encrypted HLS video stream
By vidder in forum Video Streaming DownloadingReplies: 3Last Post: 4th Jul 2018, 17:24