i am making a futurly course downloader, which can also work as an hls 128 aes downloader, only problem is that the keys it gives is wrong. can someone guide on how to get correct keys? Here's the code:
Code:from playwright.sync_api import sync_playwright import requests m3u8DL_RE = 'N_m3u8DL-RE' from playwright.sync_api import sync_playwright def get_apk_ids(url): with sync_playwright() as p: browser = p.chromium.launch() context = browser.new_context() page = context.new_page() page.goto(url) apk_ids = page.evaluate('''() => { const coursePlayerInit = document.body.outerHTML.split('coursePlayer.init("')[1].split('"')[0]; const dataId = document.querySelector('div.courseSubItem.enabled-true.selected').getAttribute('data-id'); return { coursePlayerInit, dataId, apkId}; }''') # Close the browser context.close() return apk_ids # Example usage (can be replaced for other sites too) website_url = 'https://www.futurly.com/s/preview/courses/blender-architecture#6337f80fe4b05a534f0e3d5a' apk_ids = get_apk_ids(website_url) apk_id = apk_ids['apkId'] if apk_ids: print("APK IDs:", apk_id) print("course-id:", apk_ids['coursePlayerInit']) print("video-id:", apk_ids['dataId']) url = f"https://www.futurly.com/s/preview/courses/{apk_ids['coursePlayerInit']}/videos/{apk_ids['dataId']}/get" response = requests.get(url) data = response.json() mpd = data["spayee:resource"]["spayee:streamUrl"] print(mpd) import requests import re import binascii from Crypto.Cipher import AES import subprocess def modify_url(original_url, segment_to_replace, replacement_segment): pattern = re.compile(f"(.*){re.escape(segment_to_replace)}.*") match = pattern.match(original_url) if match: new_url = f"{match.group(1)}{replacement_segment}" return new_url else: print("URL does not match the expected pattern.") return None original_url = mpd segment_to_replace = "index.m3u8" replacement_segment = "k/timestamp" # Modify the URL new_url = modify_url(original_url, segment_to_replace, replacement_segment) if new_url: # Download the modified URL and save as "timestamp" response = requests.get(new_url) with open("timestamp", "wb") as file: file.write(response.content) # Decryption code with open("timestamp", "rb") as file: data = file.read() def _decrypt_key(data, apk_id): tmp1 = data[0:16] tmp2 = data[32:48] dec1 = AES.new(bytes.fromhex(apk_id[1:33]), AES.MODE_ECB) tmp3 = dec1.decrypt(tmp1) dec2 = AES.new(tmp3, AES.MODE_ECB) return dec2.decrypt(tmp2) result = _decrypt_key(data, apk_id) hex_result = binascii.hexlify(result) key = hex_result.decode() print(key) ke_ys = ' '.join([f'--custom-hls-key {key}']).split() subprocess.run([m3u8DL_RE, '-M', 'format=mkv:muxer=ffmpeg', '--concurrent-download', '--log-level', 'INFO', '--save-name', 'video', mpd, *ke_ys])
+ Reply to Thread
Results 1 to 1 of 1
Similar Threads
-
Download how to download this download (m3u8)
By Starxx in forum Video Streaming DownloadingReplies: 34Last Post: 15th Aug 2023, 17:51 -
Download videos from a course app that doesn't allow to download videos?
By solarjunk in forum Video Streaming DownloadingReplies: 2Last Post: 3rd Jun 2023, 06:30 -
A GUI to download bulk download files through their respective M3U8 links
By UNforces885 in forum Video Streaming DownloadingReplies: 4Last Post: 4th May 2023, 14:04 -
Download HLS. error 400 to download keys
By naturalc in forum Video Streaming DownloadingReplies: 28Last Post: 28th Oct 2022, 08:13 -
How to download from zee5 site and download mpd link
By qasem1368 in forum Video Streaming DownloadingReplies: 7Last Post: 25th Nov 2021, 21:28