VideoHelp Forum


Try StreamFab Downloader and download from Netflix, Amazon, Youtube! Or Try DVDFab and copy Blu-rays! or rip iTunes movies!


Try StreamFab Downloader and download streaming video from Youtube, Netflix, Amazon! Download free trial.


+ Reply to Thread
Results 1 to 20 of 20
Thread
  1. Member
    Join Date
    Apr 2024
    Location
    Europe
    Search Comp PM
    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
    Quote Quote  
  2. 1080p

    Code:
    https://www.upload.ee/files/16476160/Learn_German_h264_1080.mkv.html
    Quote Quote  
  3. Member
    Join Date
    Apr 2024
    Location
    Europe
    Search Comp PM
    Originally Posted by lomero View Post
    1080p

    Code:
    https://www.upload.ee/files/16476160/Learn_German_h264_1080.mkv.html
    Hey, thanks a lot! If it isn't too much trouble, could you explain how you downloaded the video from the site?
    Quote Quote  
  4. rip cookies, save as cookies.txt, then:

    Code:
    yt-dlp "https://m3u8" --cookies cookies.txt -o video.mkv
    Quote Quote  
  5. 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"
    Quote Quote  
  6. Member aqzs's Avatar
    Join Date
    Mar 2024
    Location
    Paris
    Search Comp PM
    Originally Posted by mister_ nex View Post
    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 line
    Code:
    #EXT-X-KEY:METHOD=AES-128,URI="https://ucha.se/streaming/key/?ut=wqeoBtn2Hu2dCAgn68H7"
    and a request to this server give me :
    Code:
    длlН\fП└ЊюE9Г
    which im not able to parse to get
    Code:
     a6d06cd55c1966dd1cc0939c451239ad
    Could you help me to understand how you reverse-engined ?
    Quote Quote  
  7. Originally Posted by aqzs View Post
    I would like to understand how you got the key.
    I got the playlist.m3u8 then chunklist_b1054768_slbul.m3u8
    I got this line
    Code:
    #EXT-X-KEY:METHOD=AES-128,URI="https://ucha.se/streaming/key/?ut=wqeoBtn2Hu2dCAgn68H7"
    and a request to this server give me :
    Code:
    длlН\fП└ЊюE9Г
    which im not able to parse to get
    Code:
     a6d06cd55c1966dd1cc0939c451239ad
    Could you help me to understand how you reverse-engined ?
    See here: https://forum.videohelp.com/threads/413718-My-journey-with-AES-128-encrypted-HLS
    Quote Quote  
  8. Originally Posted by aqzs View Post
    Could you help me to understand how you reverse-engined ?
    Use the Firefox browser - it immediately shows base64 value
    Code:
    https://ucha.se/streaming/key/?ut=wqeoBtn2Hu2dCAgn68H7
    Image
    [Attachment 78121 - Click to enlarge]


    Code:
    ptBs1VwZZt0cwJOcRRI5rQ==
    then convert base64 to hex

    Code:
    https://base64.guru/converter/decode/hex]
    Last edited by mister_ nex; 3rd Apr 2024 at 11:43.
    Quote Quote  
  9. Member aqzs's Avatar
    Join Date
    Mar 2024
    Location
    Paris
    Search Comp PM
    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 :
    Code:
    binascii.hexlify(response.text.encode('utf-8')).decode('utf-8')
    and I get :
    Code:
    d0b4d0bb6cd09d5c1966d09f1ce29494d08ad18e451239d093
    Then :
    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
    Quote Quote  
  10. Member aqzs's Avatar
    Join Date
    Mar 2024
    Location
    Paris
    Search Comp PM
    (I'm not able to use
    Code:
    base64.standard_b64decode(response.text).hex())
    because I get :
    Code:
    ValueError: string argument should contain only ASCII characters
    but that's weird since im directly curling the server so the response should be in base64 ?
    Quote Quote  
  11. go to https://base64.guru/converter/decode/hex

    put base64 ptBs1VwZZt0cwJOcRRI5rQ==

    in hex you get a6d06cd55c1966dd1cc0939c451239ad

    Image
    [Attachment 78122 - Click to enlarge]
    Quote Quote  
  12. Or in Python:
    Code:
    import binascii, sys, base64
    print(binascii.hexlify(base64.b64decode(sys.argv[1])).decode())
    Quote Quote  
  13. Member aqzs's Avatar
    Join Date
    Mar 2024
    Location
    Paris
    Search Comp PM
    So I feel dumb I just sould use :
    Code:
    print(response.content.hex())
    Im finally getting a6d06cd55c1966dd1cc0939c451239ad ! Thank you to everyone, you've all been helpful !!
    Quote Quote  
  14. Originally Posted by aqzs View Post
    I get the response from the server with python so directly in base64
    Could you please explain what commands you use to get a response from the server?
    Code:
    https://ucha.se/streaming/key/?ut=wqeoBtn2Hu2dCAgn68H7
    Quote Quote  
  15. Member aqzs's Avatar
    Join Date
    Mar 2024
    Location
    Paris
    Search Comp PM
    Originally Posted by mister_ nex View Post
    Originally Posted by aqzs View Post
    I get the response from the server with python so directly in base64
    Could you please explain what commands you use to get a response from the server?
    Code:
    https://ucha.se/streaming/key/?ut=wqeoBtn2Hu2dCAgn68H7
    Yes so I copy the curl request from the web inspector as cURL
    Image
    [Attachment 78123 - Click to enlarge]

    The I paste in vscode so I get the headers and everything (using vscode extension from https://curlconverter.com/): Image
    [Attachment 78124 - Click to enlarge]


    Code:
    import requests
    headers = {......}
    response = requests.get('https://ucha.se/streaming/key/?s=....&ut=wqeoBtn2Hu2dCAgn68H7', headers=headers)
    print(response.content.hex())
    And it return the key !
    Quote Quote  
  16. Originally Posted by aqzs View Post
    Thank you for the explanation! I will try this method.
    Quote Quote  
  17. 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())
    .
    Quote Quote  
  18. Member aqzs's Avatar
    Join Date
    Mar 2024
    Location
    Paris
    Search Comp PM
    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 :

    Code:
    import requests
    headers = {'cookie': 'PHPSESSID=84rk8ea1ue8keod6i3muohepif',}
    response = requests.get('https://ucha.se/streaming/key/?s=VALUE', headers=headers)
    print(response.content.hex())
    VALUE = aaa23b05671b0b3babe682e6f08dd6f1 for this vid
    Quote Quote  
  19. Originally Posted by aqzs View Post
    Code:
    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.
    Image
    [Attachment 78128 - Click to enlarge]


    Originally Posted by aqzs View Post
    You have to provide s=... in the request.
    Apparently I was in a hurry and entered the wrong link.
    Last edited by mister_ nex; 3rd Apr 2024 at 15:53.
    Quote Quote  
  20. Originally Posted by Obo View Post
    Or in Python:
    Code:
    import binascii, sys, base64
    print(binascii.hexlify(base64.b64decode(sys.argv[1])).decode())
    Unfortunately, it was not possible to use your script.

    Image
    [Attachment 78146 - Click to enlarge]

    Tried another script
    Code:
    import base64
    text = 'ptBs1VwZZt0cwJOcRRI5rQ=='
    
    dec = base64.b64decode(text).hex()
    print(dec)
    v.Python 3.10
    Image
    [Attachment 78147 - Click to enlarge]
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!