VideoHelp Forum



Support our site by donate $5 directly to us Thanks!!!

Try StreamFab Downloader and download streaming video from Netflix, Amazon!



+ Reply to Thread
Results 1 to 4 of 4
  1. I hope you're all doing well. I'm seeking some assistance with a Python script that I've been working on for decrypting video streams from 6play.fr. Unfortunately, I'm encountering some issues and would greatly appreciate any guidance or insights from the experts here.

    I've provided the code below, which is based on a script I found online (@CrymanChen) . The goal is to decrypt Widevine content, but it's not working as expected. I've ensured that all the necessary dependencies are installed, but I'm still facing difficulties.

    Code:
    import base64, requests, sys, xmltodict
    import headers
    import json
    from pywidevine.L3.cdm import cdm, deviceconfig
    from base64 import b64encode
    from pywidevine.L3.getPSSH import get_pssh
    from pywidevine.L3.decrypt.wvdecryptcustom import WvDecrypt
    
    pssh = "AAAAXHBzc2gAAAAA7e+LqXnWSs6jyCfc1R0h7QAAADwIARIQbhCH7zD3NmG+tfqL16SIUiIkZXlKaGMzTmxkRWxrSWpvaVpHRnphR05sYm1OZlRUWWlmUT09OAA="
    lic_url = "https://lic.drmtoday.com/license-proxy-widevine/cenc/?specConform=true"
    
    def WV_Function(pssh, lic_url, cert_b64=None):
        wvdecrypt = WvDecrypt(init_data_b64=pssh, cert_data_b64=cert_b64, device=deviceconfig.device_android_generic)
        widevine_license = requests.post(url=lic_url, data=wvdecrypt.get_challenge(), headers=headers.headers)
        license_b64 = widevine_license.json()["license"]
        wvdecrypt.update_license(license_b64)
        Correct, keyswvdecrypt = wvdecrypt.start_process()
        if Correct:
            return Correct, keyswvdecrypt   
    correct, keys = WV_Function(pssh, lic_url)
    
    print()
    for key in keys:
        print('--key ' + key)
    
    # 建立key_string字符串, 使得所有key进行如下变换: ①添加前缀"--key" ②使得每一个带有前缀的key以空格的形式连接起来(方便multi-keys时一键复制)
    key_string = ' '.join([f"--key {key}" for key in keys])
    # 使用导入的pyperclip库, 将key_string字符串复制至剪贴板, 省去手动选择"--key {key}"、复制、粘贴的麻烦
    print(key_string)
    And here are the Headers

    Code:
    headers={
        'Accept': '*/*',
        'Accept-Language': 'en-US,en;q=0.9,fr;q=0.8,ar;q=0.7,es;q=0.6,ja;q=0.5,pl;q=0.4,pt;q=0.3',
        'Connection': 'keep-alive',
        'Origin': 'https://www.6play.fr',
        'Referer': 'https://www.6play.fr/',
        'Sec-Fetch-Dest': 'empty',
        'Sec-Fetch-Mode': 'cors',
        'Sec-Fetch-Site': 'cross-site',
        'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36',
        'sec-ch-ua': '"Google Chrome";v="117", "Not;A=Brand";v="8", "Chromium";v="117"',
        'sec-ch-ua-mobile': '?0',
        'sec-ch-ua-platform': '"macOS"',
        'x-dt-auth-token': 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJvcHREYXRhIjoie1widXNlcklkXCI6XCI5ZGRmZjc0OTFjNmU0NDVkYTI0NGJiN2VjOTI4MmRiM1wiLFwibWVyY2hhbnRcIjpcIm02XCIsXCJzZXNzaW9uSWRcIjpcIjZwbGF5XCJ9IiwiY3J0IjoiW3tcImFjY291bnRpbmdJZFwiOlwiXCIsXCJhc3NldElkXCI6XCJkYXNoY2VuY19NNlwiLFwicHJvZmlsZVwiOntcInB1cmNoYXNlXCI6e319LFwib3V0cHV0UHJvdGVjdGlvblwiOntcImRpZ2l0YWxcIjpmYWxzZSxcImFuYWxvZ3VlXCI6ZmFsc2UsXCJlbmZvcmNlXCI6ZmFsc2V9LFwib3BcIjp7XCJjb25maWdcIjp7XCJIRFwiOntcIlBsYXlSZWFkeVwiOntcIm1pblNMXCI6MzAwMCxcImFuYWxvZ1ZpZGVvT1BMXCI6MjAwLFwiY29tcHJlc3NlZERpZ2l0YWxWaWRlb09QTFwiOjUwMCxcInVuY29tcHJlc3NlZERpZ2l0YWxWaWRlb09QTFwiOjMwMH0sXCJXaWRldmluZU1cIjp7XCJtaW5TTFwiOjUsXCJyZXF1aXJlSERDUFwiOlwiSERDUF9WMVwifX0sXCJTRFwiOntcIlBsYXlSZWFkeVwiOntcIm1pblNMXCI6MjAwMCxcImFuYWxvZ1ZpZGVvT1BMXCI6MjAwLFwiY29tcHJlc3NlZERpZ2l0YWxWaWRlb09QTFwiOjUwMCxcInVuY29tcHJlc3NlZERpZ2l0YWxWaWRlb09QTFwiOjI1MH0sXCJXaWRldmluZU1cIjp7XCJtaW5TTFwiOjEsXCJyZXF1aXJlSERDUFwiOlwiSERDUF9OT05FXCJ9fSxcIlZJREVPX0FVRElPXCI6e1wiUGxheVJlYWR5XCI6e1wibWluU0xcIjoyMDAwLFwiYW5hbG9nVmlkZW9PUExcIjoyMDAsXCJjb21wcmVzc2VkRGlnaXRhbFZpZGVvT1BMXCI6NTAwLFwidW5jb21wcmVzc2VkRGlnaXRhbFZpZGVvT1BMXCI6MjUwfSxcIldpZGV2aW5lTVwiOntcIm1pblNMXCI6MSxcInJlcXVpcmVIRENQXCI6XCJIRENQX05PTkVcIn19fX19XSIsImlhdCI6MTY5NjY4NzI2MCwianRpIjoiU2xPSlVoS05GSVAzMXVlNkxaWDdWZz09In0.khaIy_bi2-_J1S2ceFCdsodotusamnkFsog1Wz6cJUtOW7X5OGWZC6MtUm92I3Uvjl96M4j4azahYtXr5P0zEw',
        'Content-Type': 'application/x-www-form-urlencoded',
    }
    I've tried to understand the code and its dependencies, but I may have missed something crucial. If anyone here has experience with Widevine decryption or Python scripting in general, I would be immensely grateful for your input.

    Here is the error screen I'm getting:

    Image
    [Attachment 74253 - Click to enlarge]


    I've tried various approaches to debug the code, but I'm still struggling. Could someone kindly review the code and provide any suggestions or corrections that could help me move forward?

    Additionally, if there are any specific resources, tutorials, or documentation related to Widevine decryption that you recommend, please feel free to share them.

    Thank you all in advance for your time and expertise. I truly appreciate any assistance you can provide!
    Last edited by magixter; 8th Oct 2023 at 08:05.
    Quote Quote  
  2. the error is basically saying it cant decode the response as json format.

    you have a mismatch between the license url and the parsing of the license response.
    if you use "https://lic.drmtoday.com/license-proxy-widevine/cenc/" as the license server url, the response should be in json format and you need to parse out the license value (which is already in base64 format).
    if you use "https://lic.drmtoday.com/license-proxy-widevine/cenc/?specConform=true" as the license server url, the response should be in bytes so you just need to base64 encode it (same as the standard l3.py).

    either remove "?specConform=true" from the license url or remove the json parsing and base64 encode the response.

    what you should do in any case is add this line after the "widevine_license = requests.post....." line
    Code:
        print(widevine_license.text)
    this will show you what the response from the license server is and will allow you to properly debug your issues.
    Quote Quote  
  3. Banned
    Join Date
    Apr 2022
    Location
    Hong Kong
    Search Comp PM
    You are using one of scripts that I edited and posted on GitHub l3mubi.py, so I hope that you can just say the origin, rather than 'online'. It's not a shame.

    In fact, if you wipe your eyes and look again, you will find out that the filename is 'mubi', which is not compatible with the website you are looking for, so it's easy to meet problems even if they indeed use the same technique.
    Quote Quote  
  4. Karoolus' drmtoday script works - and it even comes with a free cdm
    https://forum.videohelp.com/threads/409776-Get-a-key-without-CDRM/page9#post2708456
    Quote Quote  



Similar Threads

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