Hi all, I've had interest in downloading some study videos from a site but they all turned out to be encrypted HLS so I've been running into some difficulties. I read this thread which kind of got me in the right direction, but I couldn't find the key for the video. I also stumbled upon a GitHub project which apparently does exactly what I want, but I couldn't get it to work... So I turn to you! I appreciate any help I'll receive
Video link
		
			+ Reply to Thread
			
		
		
		
			
	
	
				Results 1 to 20 of 20
			
		- 
	
- 
	1080p 
 
 Code:https://www.upload.ee/files/16476160/Learn_German_h264_1080.mkv.html 
- 
	
- 
	rip cookies, save as cookies.txt, then: 
 
 Code:yt-dlp "https://m3u8" --cookies cookies.txt -o video.mkv 
- 
	Code:hlsdl -K "a6d06cd55c1966dd1cc0939c451239ad" "https://proxy2.ucha.se/uchase/_definist_/smil:videos/06082020-Zashto-da-ucha-nemski/stream.smil/chunklist_b1054768_slbul.m3u8?ut=wqeoBtn2Hu2dCAgn68H7" 
- 
	I would like to understand how you got the key. 
 I got the playlist.m3u8 then chunklist_b1054768_slbul.m3u8
 I got this lineand a request to this server give me :Code:#EXT-X-KEY:METHOD=AES-128,URI="https://ucha.se/streaming/key/?ut=wqeoBtn2Hu2dCAgn68H7" which im not able to parse to getCode:длlН\fП└ЊюE9Г Could you help me to understand how you reverse-engined ?Code:a6d06cd55c1966dd1cc0939c451239ad 
- 
	Use the Firefox browser - it immediately shows base64 value 
 Code:https://ucha.se/streaming/key/?ut=wqeoBtn2Hu2dCAgn68H7 
 [Attachment 78121 - Click to enlarge]
 
 then convert base64 to hexCode:ptBs1VwZZt0cwJOcRRI5rQ== 
 
 Code:https://base64.guru/converter/decode/hex] Last edited by mister_ nex; 3rd Apr 2024 at 12:43. 
- 
	Thank you @white_snake, i read the threads on 1st april and new messages arrived. 
 I get the response from the server with python so directly in base64, then I do :and I get :Code:binascii.hexlify(response.text.encode('utf-8')).decode('utf-8')Then :Code:d0b4d0bb6cd09d5c1966d09f1ce29494d08ad18e451239d093 Code:hlsdl -K "d0b4d0bb6cd09d5c1966d09f1ce29494d08ad18e451239d093" "https://proxy2.ucha.se/uchase/_definist_/smil:videos/06082020-Zashto-da-ucha-nemski/stream.smil/playlist.m3u8" Error: AES key value : 32 characters hexstring expected hlsdl v0.27 
- 
	(I'm not able to use because I get :Code:base64.standard_b64decode(response.text).hex()) but that's weird since im directly curling the server so the response should be in base64 ?Code:ValueError: string argument should contain only ASCII characters 
- 
	go to https://base64.guru/converter/decode/hex 
 
 put base64 ptBs1VwZZt0cwJOcRRI5rQ==
 
 in hex you get a6d06cd55c1966dd1cc0939c451239ad
 
 
 [Attachment 78122 - Click to enlarge]
- 
	Or in Python: 
 Code:import binascii, sys, base64 print(binascii.hexlify(base64.b64decode(sys.argv[1])).decode()) 
- 
	So I feel dumb  I just sould use : Im finally getting a6d06cd55c1966dd1cc0939c451239ad ! Thank you to everyone, you've all been helpful !!Code: I just sould use : Im finally getting a6d06cd55c1966dd1cc0939c451239ad ! Thank you to everyone, you've all been helpful !!Code:print(response.content.hex()) 
- 
	
- 
	Yes so I copy the curl request from the web inspector as cURL 
 
 [Attachment 78123 - Click to enlarge]
 The I paste in vscode so I get the headers and everything (using vscode extension from https://curlconverter.com/):
 [Attachment 78124 - Click to enlarge]
 
 And it return the key !Code:import requests headers = {......} response = requests.get('https://ucha.se/streaming/key/?s=....&ut=wqeoBtn2Hu2dCAgn68H7', headers=headers) print(response.content.hex())
- 
	
- 
	aqzs 
 I created a script, ran it, but no response
 
 .Code:import requests headers = {'accept': '*/*', # 'cookie': 'PHPSESSID=798qq6539631u3kesfr4k272lb; cookie_tooltip=2', 'referer': 'https://ucha.se/watch/10623/zashto-da-ucha-nemski', 'sec-ch-ua': '"Google Chrome";v="123", "Not:A-Brand";v="8", "Chromium";v="123"', 'sec-ch-ua-mobile': '?0', 'sec-ch-ua-platform': '"Windows"', 'sec-fetch-dest': 'empty', 'sec-fetch-mode': 'cors', 'sec-fetch-site': 'same-origin', 'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36',} response = requests.get('https://ucha.se/streaming/key/?ut=wqeoBtn2Hu2dCAgn68H7', headers=headers) print(response.content.hex())
- 
	You have to provide s=... in the request. The value is in the webpage in 'data-params' so can be parsed using python. 
 You also have to give the PHPSESSID in the header. The minimal code provider here should be working :
 
 VALUE = aaa23b05671b0b3babe682e6f08dd6f1 for this vidCode:import requests headers = {'cookie': 'PHPSESSID=84rk8ea1ue8keod6i3muohepif',} response = requests.get('https://ucha.se/streaming/key/?s=VALUE', headers=headers) print(response.content.hex())
- 
	
 Thanks for the clarifications and advices! The script produced the correct result.
 
 [Attachment 78128 - Click to enlarge]
 
 Apparently I was in a hurry and entered the wrong link.Last edited by mister_ nex; 3rd Apr 2024 at 16:53. 
- 
	Unfortunately, it was not possible to use your script. 
 
 
 [Attachment 78146 - Click to enlarge]
 Tried another script
 v.Python 3.10Code:import base64 text = 'ptBs1VwZZt0cwJOcRRI5rQ==' dec = base64.b64decode(text).hex() print(dec) 
 
 [Attachment 78147 - Click to enlarge]
Similar Threads
- 
  Trying to download a HLS encrypted videoBy zezgang in forum Video Streaming DownloadingReplies: 14Last Post: 1st Apr 2024, 04:54
- 
  Downloading encrypted M3U8 HLS videosBy MachineLearning in forum Video Streaming DownloadingReplies: 40Last Post: 10th Mar 2024, 07:54
- 
  How to find key of an offline encrypted videoBy nic030 in forum Video Streaming DownloadingReplies: 4Last Post: 18th Jul 2023, 11:52
- 
  How do I download AES encrypted video streamed over HLS?By Videogamer555 in forum Video Streaming DownloadingReplies: 1Last Post: 20th Jul 2022, 09:03
- 
  Help downloading AES-encrypted HLS video streamBy Woodswolf in forum Video Streaming DownloadingReplies: 26Last Post: 25th May 2019, 15:20


 
		
		 View Profile
				View Profile
			 View Forum Posts
				View Forum Posts
			 Private Message
				Private Message
			 
 
			
			


 Quote
 Quote
 
			