VideoHelp Forum
+ Reply to Thread
Results 1 to 16 of 16
Thread
  1. I am following this post : https://forum.videohelp.com/threads/408196-howto-deal-with-HLS-128-bit-aes-encrypted-t...on#post2699930

    URL :
    Code:
    https://forum.videohelp.com/forums/48-Video-Streaming-Downloading
    Video Details (Contains Index.m3u8 link) :
    Code:
    https://www.goclasses.in/s/courses/60fdd8530cf2c7989e1f109d/videos/640c251ee4b04eb4af8fe5ec/get
    Timestamp :
    Code:
    https://drive.google.com/file/d/1BljbOfqGpFq8UuCADpNCuXaQOEvwqEqX/view?usp=sharing
    apkId :
    Code:
    '6636637376163356630333436353765660'
    Remove the first and last character from the above apkId to get the actual apkId (Source : https://forum.videohelp.com/threads/408196-howto-deal-with-HLS-128-bit-aes-encrypted-t...-version/page2)

    Python Script Decrypt (Change apkId and download timestamp file in script folder) :
    Code:
    import binascii
    from Crypto.Cipher import AES
    
    with open("timestamp", "rb") as file: 
        data = file.read()
    
    apkid = '63663737616335663033343635376566'
    
    def _decrypt_key(data, apkid):
        tmp1 = data[0:16]
        tmp2 = data[32:48]
        dec1 = AES.new(bytes.fromhex(apkid),AES.MODE_ECB)
        tmp3 = dec1.decrypt(tmp1)
        dec2 = AES.new(tmp3,AES.MODE_ECB)
        return dec2.decrypt(tmp2)
    
    result = _decrypt_key(data, apkid)
    hex_result = binascii.hexlify(result)
    print(hex_result.decode())
    Output :
    Code:
    59ace6010edd4ee2e5bf169e5f661863

    Download Command :
    Code:
    N_m3u8DL-RE.exe "https://d2qny97nu4rj64.cloudfront.net/spees/w/o/60e975430cf20278db21ff30/v/640c251ee4b04eb4af8fe5ec/u/64c41b63e4b0abe3bbd7fb51/t/b83a22f7c61e6715c78f5dba2835ad9f/p/assets/videos/60e975430cf20278db21ff30/2023/03/11/640c251ee4b04eb4af8fe5ec/index.m3u8" --custom-hls-key  "59ace6010edd4ee2e5bf169e5f661863"
    The above command gives me error :
    Code:
    11:19:06.053 ERROR: Padding is invalid and cannot be removed.
    Does someone know why this error occurs ?
    Quote Quote  
  2. nxhda
    Join Date
    Sep 2022
    Location
    United States
    Search Comp PM
    Your key is wrong,the correct key is :
    648dea11fe203008b24f492175fe674d

    command:
    N_m3u8DL-RE "https://d2qny97nu4rj64.cloudfront.net/spees/w/o/60e975430cf20278db21ff30/v/640c251ee4b04eb4af8fe5ec/u/64c41b63e4b0abe3bbd7fb51/t/b83a22f7c61e6715c78f5dba2835ad9f/p/assets/videos/60e975430cf20278db21ff30/2023/03/11/640c251ee4b04eb4af8fe5ec/index.m3u8" --custom-hls-key "648dea11fe203008b24f492175fe674d" -mt -M mp4 --save-name "test"
    Quote Quote  
  3. Member
    Join Date
    Aug 2023
    Location
    Mexico
    Search Comp PM
    Originally Posted by NBA456017 View Post
    Your key is wrong,the correct key is :
    648dea11fe203008b24f492175fe674d

    command:
    N_m3u8DL-RE "https://d2qny97nu4rj64.cloudfront.net/spees/w/o/60e975430cf20278db21ff30/v/640c251ee4b04eb4af8fe5ec/u/64c41b63e4b0abe3bbd7fb51/t/b83a22f7c61e6715c78f5dba2835ad9f/p/assets/videos/60e975430cf20278db21ff30/2023/03/11/640c251ee4b04eb4af8fe5ec/index.m3u8" --custom-hls-key "648dea11fe203008b24f492175fe674d" -mt -M mp4 --save-name "test"
    how did you get this key? while running provided script by sidman I also get the key which sidman got i.e. 59ace6010edd4ee2e5bf169e5f661863
    Quote Quote  
  4. nxhda
    Join Date
    Sep 2022
    Location
    United States
    Search Comp PM
    def _decrypt_key(data, apkId):
    tmp1 = data[16:32]
    tmp2 = data[48:64]
    dec1 = AES.new(bytes.fromhex(apkId[1:33]),AES.MODE_ECB)
    tmp3 = dec1.decrypt(tmp1)
    dec2 = AES.new(tmp3,AES.MODE_ECB)
    return dec2.decrypt(tmp2)
    Quote Quote  
  5. Member
    Join Date
    Aug 2023
    Location
    Mexico
    Search Comp PM
    thanks @NBA456017
    Quote Quote  
  6. Originally Posted by NBA456017 View Post
    Your key is wrong,the correct key is :
    648dea11fe203008b24f492175fe674d

    command:
    N_m3u8DL-RE "https://d2qny97nu4rj64.cloudfront.net/spees/w/o/60e975430cf20278db21ff30/v/640c251ee4b04eb4af8fe5ec/u/64c41b63e4b0abe3bbd7fb51/t/b83a22f7c61e6715c78f5dba2835ad9f/p/assets/videos/60e975430cf20278db21ff30/2023/03/11/640c251ee4b04eb4af8fe5ec/index.m3u8" --custom-hls-key "648dea11fe203008b24f492175fe674d" -mt -M mp4 --save-name "test"
    Can N_m3u8DL-RE automate this entire process. If not, can you provide some general steps to automate the process ?
    Quote Quote  
  7. why do i get this error,
    ValueError: Incorrect AES key length (17 bytes)

    i have tried the same script as this, import binascii
    from Crypto.Cipher import AES

    with open("timestamp", "rb") as file:
    data = file.read()

    apkid = '63663737616335663033343635376566'

    def _decrypt_key(data, apkid):
    tmp1 = data[0:16]
    tmp2 = data[32:48]
    dec1 = AES.new(bytes.fromhex(apkid),AES.MODE_ECB)
    tmp3 = dec1.decrypt(tmp1)
    dec2 = AES.new(tmp3,AES.MODE_ECB)
    return dec2.decrypt(tmp2)

    result = _decrypt_key(data, apkid)
    hex_result = binascii.hexlify(result)
    print(hex_result.decode())
    Quote Quote  
  8. code:

    ./N_m3u8DL-RE "https://d2qny97nu4rj64.cloudfront.net/spees/w/o/60e975430cf20278db21ff30/v/64bd9879e4b0f4c23037fa8c/u/6225780a0cf29abe0345ee88/t/7b32062cdb9a0c9e6005631d637919b3/p/assets/videos/60e975430cf20278db21ff30/2023/07/23/64bd9879e4b0f4c23037fa8c/index.m3u8" --custom-hls-key bbcca16ae752e8b21593b3e5b7122679 -mt -M mp4 --save-name "test"
    00:25:42.998 INFO : N_m3u8DL-RE (Beta version) 20230111
    00:25:43.005 INFO : Loading URL: https://d2qny97nu4rj64.cloudfront.net/spees/w/o/60e975430cf20278db21ff30/v/64bd9879e4b...a8c/index.m3u8
    00:25:43.140 INFO : Content Matched: HTTP Live Streaming
    00:25:43.141 INFO : Parsing streams...
    00:25:43.141 WARN : Master List detected, try parse all streams
    00:25:43.142 INFO : Extracted, there are 4 streams, with 3 basic streams, 1 audio streams, 0 subtitle streams
    00:25:43.142 INFO : Vid 1920x1080 | 1500 Kbps | avc1.640028
    00:25:43.142 INFO : Vid 1280x720 | 900 Kbps | avc1.64001f
    00:25:43.142 INFO : Vid 852x480 | 650 Kbps | avc1.64001f
    00:25:43.142 INFO : Aud audio-0 | eng | eng
    00:25:43.525 INFO : New version detected! v0.2.0-beta
    00:25:45.459 INFO : Parsing streams...
    00:25:45.538 INFO : Selected streams:
    00:25:45.538 INFO : Vid *AES_128 1920x1080 | 1500 Kbps | avc1.640028 | 599 Segments | ~19m56s
    00:25:45.538 INFO : Aud *AES_128 audio-0 | eng | eng | 598 Segments | ~19m55s
    00:25:45.538 INFO : Save Name: test
    00:25:45.539 INFO : Start downloading...Vid 1920x1080 | 1500 Kbps | avc1.640028
    00:25:45.539 INFO : Start downloading...Aud audio-0 | eng | eng
    00:25:45.540 ERROR: Padding is invalid and cannot be removed.

    apkId code: 64363433353038323162643935316565643634333530383231 62643935316565

    python code : import binascii
    from Crypto.Cipher import AES

    with open("timestamp", "rb") as file:
    data = file.read()

    apkid=input('\napkid:')
    def _decrypt_key(data, apkId):
    tmp1 = data[16:32]
    tmp2 = data[48:64]
    dec1 = AES.new(bytes.fromhex(apkid[1:33]),AES.MODE_ECB)
    tmp3 = dec1.decrypt(tmp1)
    dec2 = AES.new(tmp3,AES.MODE_ECB)
    return dec2.decrypt(tmp2)

    result = _decrypt_key(data, apkid)
    hex_result = binascii.hexlify(result)
    print(hex_result.decode())



    Finding error can anyone help
    Last edited by jora; 13th Oct 2023 at 13:59.
    Quote Quote  
  9. Earlier I used to download videos hosted on graphy but now I'm getting this error "ERROR: Padding is invalid and cannot be removed."
    How to get rid of this so that we can download videos from it.
    Quote Quote  
  10. Can anyone help me with the error, padding is invalid and cannot be removed, I tried 2-3 scripts and the key I got is different and I tried them all but everytime same error occurs.


    Earlier they used to work, but now I'm getting this error, kindly help me please.
    Quote Quote  
  11. If you need some help from here to solve your problem then please provide some necessary information

    1. ApkId
    2. m3u8 URL
    Quote Quote  
  12. Thanks a lot for your reply, but I was searching for it from last half an hour and just now it worked for me. Still thanks bro
    Quote Quote  
  13. @para8ox

    I am happy to hear that you got a solution on your own
    If you feel comfortable you can share here what you've figured out for future reference to everyone
    Quote Quote  
  14. Sure, I searched on the forum and found that the solution is already provided here, just we need to understand it.

    https://forum.videohelp.com/threads/408196-howto-deal-with-HLS-128-bit-aes-encrypted-t...e3#post2716234

    This is the link from where I got the solution,

    • In our script we simply have to change the range of apkID that needs to be processed to get the actual key.
    • So steps are very simple, go to above link and there is one SS attached by aadrl, go to the source tab and then open that .min.js file and inside that you'll find apkId range.
    • Put that range in the script and then run it. You'll surely get the working key.
    Quote Quote  
  15. Originally Posted by para8ox View Post
    Sure, I searched on the forum and found that the solution is already provided here, just we need to understand it.

    https://forum.videohelp.com/threads/408196-howto-deal-with-HLS-128-bit-aes-encrypted-t...e3#post2716234

    This is the link from where I got the solution,

    • In our script we simply have to change the range of apkID that needs to be processed to get the actual key.
    • So steps are very simple, go to above link and there is one SS attached by aadrl, go to the source tab and then open that .min.js file and inside that you'll find apkId range.
    • Put that range in the script and then run it. You'll surely get the working key.

    @para8ox Great Catch...

    Graphy often changes that range.

    When we use the Script posted by @NBA456017 it generates a wrong key and fails to decrypt the file

    I had also encountered the same problem in the past but I followed the same steps suggested by @aadrl and managed to get my videos
    Quote Quote  
  16. Originally Posted by LittleSoldier View Post
    Originally Posted by para8ox View Post
    Sure, I searched on the forum and found that the solution is already provided here, just we need to understand it.

    https://forum.videohelp.com/threads/408196-howto-deal-with-HLS-128-bit-aes-encrypted-t...e3#post2716234

    This is the link from where I got the solution,

    • In our script we simply have to change the range of apkID that needs to be processed to get the actual key.
    • So steps are very simple, go to above link and there is one SS attached by aadrl, go to the source tab and then open that .min.js file and inside that you'll find apkId range.
    • Put that range in the script and then run it. You'll surely get the working key.

    @para8ox Great Catch...

    Graphy often changes that range.

    When we use the Script posted by @NBA456017 it generates a wrong key and fails to decrypt the file

    I had also encountered the same problem in the past but I followed the same steps suggested by @aadrl and managed to get my videos


    Can you please upload the full python code and step by step guide
    Quote Quote  



Similar Threads

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