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 30 of 30
  1. Banned
    Join Date
    Apr 2022
    Location
    Hong Kong
    Search Comp PM
    Guys, I uploaded a script for getting keys from those sites using DRM from drmtoday.

    Also on my GitHub, please enjoy yourself: https://github.com/CrymanChen/WKS-KEYS/blob/7b2cceafdce2727e345454763232a6d5cf131634/l3mubi.py

    I haven't tested other similar sites, but one thing I found is that we don't need to add the "specConform=true" anymore.

    (P.S. My intention is for those beginners who are trying to find a solution quickly. Tell me if I disobey the rules by accident.)
    Quote Quote  
  2. Banned
    Join Date
    Apr 2022
    Location
    Hong Kong
    Search Comp PM
    Quote Quote  
  3. Search, Learn, Download! Karoolus's Avatar
    Join Date
    Oct 2022
    Location
    Belgium
    Search Comp PM
    How do you handle the token it needs?
    I uploaded a script earlier today, also for DRMToday
    Quote Quote  
  4. Banned
    Join Date
    Apr 2022
    Location
    Hong Kong
    Search Comp PM
    I don't get it. Just a copy-and-paste stuff.
    Quote Quote  
  5. Search, Learn, Download! Karoolus's Avatar
    Join Date
    Oct 2022
    Location
    Belgium
    Search Comp PM
    Do you not need x-dt-auth-token in the headers?
    Quote Quote  
  6. It looks like it still needs the request headers to be copy and pasted into headers.py before running the main script.
    Quote Quote  
  7. Search, Learn, Download! Karoolus's Avatar
    Join Date
    Oct 2022
    Location
    Belgium
    Search Comp PM
    ah that makes sense
    Quote Quote  
  8. If you want to skip some manual labor, you can use pyperclip and uncurl libraries to curl the license and handle the parsing in the script rather than having to copy/paste a bunch of things.

    To grab any JWT token (not just for DRMtoday), you can look for the pattern and add it to a list:

    Code:
    def get_tokens(headers: dict) -> list:
        """Collect JWT tokens if present"""
    
        try:
            token_pairs = [
                (key, value)
                for key, value in headers.items()
                if isinstance(value, str)
                and (value.startswith("ey") or value.startswith("Bearer"))
            ]
            tokens = [token for pair in token_pairs for token in pair]
            return tokens
        except KeyError:
            return None
    And then use zip to pair and add any tokens to the headers:

    Code:
    headers = dict(zip(self.tokens[::2], self.tokens[1::2]))
    This will work for any service that uses JWT auth tokens as header. It'll even work for those few that use several. You might have to adjust it a little since these snippets are taken from the context of my own scripts.

    You can take this logic even further by automatically parsing JSON for license requests and responses, as well. In my own tools, I effectively get keys from 9/10 services without having to specify for each one because almost all of them use similar patterns.
    Quote Quote  
  9. [CODE]C:\Users\USER\Desktop\WKS_keys>l3mubi.py

    PSSH: AAAAMnBzc2gAAAAA7e+LqXnWSs6jyCfc1R0h7QAAABISEEzv8t 6gRUKMsEXKL6yzLVM=
    License URL: https://lic.drmtoday.com/license-proxy-widevine/cenc/
    Traceback (most recent call last):
    File "C:\Users\USER\AppData\Local\Programs\Python\Pytho n311\Lib\site-packages\requests\models.py", line 971, in json
    return complexjson.loads(self.text, **kwargs)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "C:\Users\USER\AppData\Local\Programs\Python\Pytho n311\Lib\json\__init__.py", line 346, in loads
    return _default_decoder.decode(s)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "C:\Users\USER\AppData\Local\Programs\Python\Pytho n311\Lib\json\decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "C:\Users\USER\AppData\Local\Programs\Python\Pytho n311\Lib\json\decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
    json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
    File "C:\Users\USER\Desktop\WKS_keys\l3mubi.py", line 31, in <module>
    correct, keys = WV_Function(pssh, lic_url)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "C:\Users\USER\Desktop\WKS_keys\l3mubi.py", line 26, in WV_Function
    license_b64 = widevine_license.json()["license"]
    ^^^^^^^^^^^^^^^^^^^^^^^
    File "C:\Users\USER\AppData\Local\Programs\Python\Pytho n311\Lib\site-packages\requests\models.py", line 975, in json
    raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
    requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
    [CODE]

    Had a problem running the script, any ideas on what went wrong
    Quote Quote  
  10. Search, Learn, Download! Karoolus's Avatar
    Join Date
    Oct 2022
    Location
    Belgium
    Search Comp PM
    Originally Posted by jaymen View Post
    [CODE]C:\Users\USER\Desktop\WKS_keys>l3mubi.py

    PSSH: AAAAMnBzc2gAAAAA7e+LqXnWSs6jyCfc1R0h7QAAABISEEzv8t 6gRUKMsEXKL6yzLVM=
    License URL: https://lic.drmtoday.com/license-proxy-widevine/cenc/
    Traceback (most recent call last):
    File "C:\Users\USER\AppData\Local\Programs\Python\Pytho n311\Lib\site-packages\requests\models.py", line 971, in json
    return complexjson.loads(self.text, **kwargs)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "C:\Users\USER\AppData\Local\Programs\Python\Pytho n311\Lib\json\__init__.py", line 346, in loads
    return _default_decoder.decode(s)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "C:\Users\USER\AppData\Local\Programs\Python\Pytho n311\Lib\json\decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "C:\Users\USER\AppData\Local\Programs\Python\Pytho n311\Lib\json\decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
    json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
    File "C:\Users\USER\Desktop\WKS_keys\l3mubi.py", line 31, in <module>
    correct, keys = WV_Function(pssh, lic_url)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "C:\Users\USER\Desktop\WKS_keys\l3mubi.py", line 26, in WV_Function
    license_b64 = widevine_license.json()["license"]
    ^^^^^^^^^^^^^^^^^^^^^^^
    File "C:\Users\USER\AppData\Local\Programs\Python\Pytho n311\Lib\site-packages\requests\models.py", line 975, in json
    raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
    requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
    [CODE]

    Had a problem running the script, any ideas on what went wrong
    Missing or invalid token most likely
    Quote Quote  
  11. Code:
    import requests
    
    headers = {
        'Accept': '*/*',
        'Accept-Language': 'en-US,en;q=0.6',
        'Connection': 'keep-alive',
        'Origin': 'https://mubi.com',
        'Referer': 'https://mubi.com/',
        'Sec-Fetch-Dest': 'empty',
        'Sec-Fetch-Mode': 'cors',
        'Sec-Fetch-Site': 'cross-site',
        'Sec-GPC': '1',
        'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36',
        'dt-custom-data': '',
        'Content-Type': 'application/x-www-form-urlencoded',
    }
    
    data = ''
    response = requests.post('https://lic.drmtoday.com/license-proxy-widevine/cenc/', headers=headers, data=data)
    my header looks something like this, could it be that something is wrong this header
    Quote Quote  
  12. Search, Learn, Download! Karoolus's Avatar
    Join Date
    Oct 2022
    Location
    Belgium
    Search Comp PM
    Originally Posted by jaymen View Post
    Code:
    import requests
    
    headers = {
        'Accept': '*/*',
        'Accept-Language': 'en-US,en;q=0.6',
        'Connection': 'keep-alive',
        'Origin': 'https://mubi.com',
        'Referer': 'https://mubi.com/',
        'Sec-Fetch-Dest': 'empty',
        'Sec-Fetch-Mode': 'cors',
        'Sec-Fetch-Site': 'cross-site',
        'Sec-GPC': '1',
        'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36',
        'dt-custom-data': '',
        'Content-Type': 'application/x-www-form-urlencoded',
    }
    
    data = ''
    response = requests.post('https://lic.drmtoday.com/license-proxy-widevine/cenc/', headers=headers, data=data)
    my header looks something like this, could it be that something is wrong this header
    Well yes, you need to enter the token in dt-custom-data and not leave it blank
    Quote Quote  
  13. Originally Posted by Karoolus View Post
    Originally Posted by jaymen View Post
    Code:
    import requests
    
    headers = {
        'Accept': '*/*',
        'Accept-Language': 'en-US,en;q=0.6',
        'Connection': 'keep-alive',
        'Origin': 'https://mubi.com',
        'Referer': 'https://mubi.com/',
        'Sec-Fetch-Dest': 'empty',
        'Sec-Fetch-Mode': 'cors',
        'Sec-Fetch-Site': 'cross-site',
        'Sec-GPC': '1',
        'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36',
        'dt-custom-data': '',
        'Content-Type': 'application/x-www-form-urlencoded',
    }
    
    data = ''
    response = requests.post('https://lic.drmtoday.com/license-proxy-widevine/cenc/', headers=headers, data=data)
    my header looks something like this, could it be that something is wrong this header
    Well yes, you need to enter the token in dt-custom-data and not leave it blank

    Well it wasn't blank when I ran the command, so could it be other reason as for why it might not have been working
    Quote Quote  
  14. Member
    Join Date
    Nov 2015
    Location
    Denmark
    Search Comp PM
    I'm testing this python script and it fails too. I attach debug output and headers.

    What's the problem?
    Thanks.
    Image Attached Files
    Quote Quote  
  15. Member
    Join Date
    Dec 2021
    Location
    england
    Search Comp PM
    no need full header, just like this...
    Code:
    import requests
    
    headers = {
        'dt-custom-data': 'eyJ1c2VySWQiOjE1OTk5MzA1LCJzZXNzaW9uSWQiOiJkODNmODYzNmEzMGRkMTBiNjkwZmEwNmU1MjJjMWMxMGY0MjE0OSIsIm1lcmNoYW50IjoibXViaSJ9',
    }
    Code:
    --key 5316ad62c1694cef884a65dc147c848f:c17ac38542d04be762f800e5cc32663c
    Image
    [Attachment 75856 - Click to enlarge]
    Last edited by iamghost; 31st Dec 2023 at 07:39.
    Quote Quote  
  16. Member
    Join Date
    Nov 2015
    Location
    Denmark
    Search Comp PM
    I re-downloaded the l3mubi.py script and WKS-KEYS.zip, mine were outdated.I have copied "device_client_id_blob", "device_private_key" and "google_sdk_gphone64_x86_64_16.1.0_0f2d0892_22596_l 3.wvd" to folder "pywidevine/L3/cdm/devices/android_generic/".
    I created a Python virtual environment and installed all the Python modules:
    Code:
    $ pip list
    Package            Version
    ------------------ ----------
    beautifulsoup4     4.12.2
    certifi            2023.11.17
    charset-normalizer 3.3.2
    idna               3.6
    pip                23.3.2
    protobuf           3.19.5
    pycryptodome       3.19.1
    pycryptodomex      3.19.1
    requests           2.31.0
    setuptools         69.0.2
    soupsieve          2.5
    urllib3            2.1.0
    wheel              0.42.0
    xmltodict          0.13.0
    But it still fails. Same error. What am I missing?
    Quote Quote  
  17. Member
    Join Date
    Nov 2015
    Location
    Denmark
    Search Comp PM
    I think I am missing a json file in the folder "pywidevine/L3/cdm/devices/android_generic/".
    How could I create this file?
    Quote Quote  
  18. Member
    Join Date
    Dec 2021
    Location
    england
    Search Comp PM
    there is no json file
    Image
    [Attachment 75859 - Click to enlarge]


    what is your python version?

    Image
    [Attachment 75860 - Click to enlarge]
    Quote Quote  
  19. Member
    Join Date
    Nov 2015
    Location
    Denmark
    Search Comp PM
    Python 3.11.7 on Arch Linux.
    Quote Quote  
  20. don't think it's that json file or python version issues, I remembered crymanchen's script requires urllib3 version<2, you can try downgrade to 1.26.17 and give a try.
    Quote Quote  
  21. Member
    Join Date
    Nov 2015
    Location
    Denmark
    Search Comp PM
    Originally Posted by shellcmd View Post
    don't think it's that json file or python version issues, I remembered crymanchen's script requires urllib3 version<2, you can try downgrade to 1.26.17 and give a try.
    thanks, I have reported the error and I think the problem is in the response: 406. The script was developed on Windows and I execute it on Linux. I think the problem is something with the encoding or a missing header.
    Quote Quote  
  22. Banned
    Join Date
    Apr 2022
    Location
    Hong Kong
    Search Comp PM
    Originally Posted by shellcmd View Post
    don't think it's that json file or python version issues, I remembered crymanchen's script requires urllib3 version<2, you can try downgrade to 1.26.17 and give a try.
    Hmm... I don't think so...
    My pip list returned a 'urllib3==2.1.0'. So my urllib version is the same as his.
    But mine's working properly.
    Image
    [Attachment 75870 - Click to enlarge]

    Although I replied @j1simon on GitHub, I still have no clue.
    Quote Quote  
  23. Originally Posted by CrymanChen View Post
    Originally Posted by shellcmd View Post
    don't think it's that json file or python version issues, I remembered crymanchen's script requires urllib3 version<2, you can try downgrade to 1.26.17 and give a try.
    Hmm... I don't think so...
    My pip list returned a 'urllib3==2.1.0'. So my urllib version is the same as his.
    But mine's working properly.
    Image
    [Attachment 75870 - Click to enlarge]

    Although I replied @j1simon on GitHub, I still have no clue.
    I and another people met this error before when run l3_nowE.py:
    Code:
    D:\N_m3u8DL-RE_Beta_win-x64\WKS-KEYS>l3_NowE.py
    Traceback (most recent call last):
      File "D:\N_m3u8DL-RE_Beta_win-x64\WKS-KEYS\l3_NowE.py", line 21, in <module>
        requests.packages.urllib3.util.ssl_.DEFAULT_CIPHERS += ':HIGH:!DH:!aNULL'
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    AttributeError: module 'urllib3.util.ssl_' has no attribute 'DEFAULT_CIPHERS'
    I made some search, and got the answer is urllib3 version too high, must downgrade to <2, so I downgrade to 1.26.17, it worked. I don't know the reason.
    Quote Quote  
  24. Member
    Join Date
    Nov 2015
    Location
    Denmark
    Search Comp PM
    In my case the problem is that somewhere in the pywidevine code some characters are injected that the server does not accept:
    Code:
                   HTTP Status 406 \xe2\x80\x93 Not Acceptable
    Quote Quote  
  25. Banned
    Join Date
    Apr 2022
    Location
    Hong Kong
    Search Comp PM
    Originally Posted by j1simon View Post
    In my case the problem is that somewhere in the pywidevine code some characters are injected that the server does not accept:
    Code:
                   HTTP Status 406 \xe2\x80\x93 Not Acceptable
    So "\xe2\x80\x93" means a dash...
    Will ya copy & paste the cURL (bash) of the license request, and then convert it to Python style, and paste the headers to headers.py.
    Then make some changes to l3mubi.py:
    1. delete Line 70
    Code:
    dt_custom_data = input('dt-custom-data: ')
    2. Go to Line 73-75
    Code:
        widevine_license = requests.post(url=lic_url, data=wvdecrypt.get_challenge(), headers={
            'dt-custom-data': dt_custom_data,
            })
    change it to:[CODE]
    3. In the end, add another line in the beginning "from headers import headers"
    4. So you've got a headers.py and a l3mubi.py running together.

    My intention is that to use the most traditional way to try to get the key, and some stuff may be missing in the headers, and let's make it full.
    I uploaded a script changed according to the steps above so you can make a comparison.
    Please rename it back to '.py' 'cause this site doesn't allow users to upload python scripts.
    If it also does not work, I won't 'investigate into' it I'm sorry. I got other things to do. But please let me know the result anyway.
    Image Attached Files
    Quote Quote  
  26. Member
    Join Date
    Nov 2015
    Location
    Denmark
    Search Comp PM
    Thanks @CrymanChen. I have been testing and the problem is not your code but the "custom" pywidevine it uses. I'm trying to figure out where the bug is.
    Quote Quote  
  27. Member
    Join Date
    Nov 2015
    Location
    Denmark
    Search Comp PM
    I installed Windows 11 in a virtual machine to test and same error!

    What version of python and libraries do you use?
    Quote Quote  
  28. Banned
    Join Date
    Apr 2022
    Location
    Hong Kong
    Search Comp PM
    Why not just ask others who have also used this script? Do they have the same issue as you do?

    As for the Python version, it worked under several different versions including the latest. And the libraries, just install the requirements.txt on the GitHub page.

    P.S. One more thing dear Juan, please do not duplicate your questions, I mean you have uploaded the same content on GitHub issues page and in this forum. Please, please just choose one of them, really appreciated.
    Quote Quote  
  29. Member
    Join Date
    Nov 2015
    Location
    Denmark
    Search Comp PM
    I'm debugging the code and in "widevine_license=requests.post(url=lic_url, data=wvdecrypt.get_challenge(), headers=headers.headers)" it doesn't send this code "\xe2\x80\x93".On Linux it does not send these codes either.
    Quote Quote  
  30. I used the script to get the keys without an issue today:

    Tested for both Python 3.11.7 and 3.12.1 versions.

    Code:
    PS C:\Python\MUBI-Keys>python l3mubi.py
    PSSH: AAAAMnBzc2gAAAAA7e+LqXnWSs6jyCfc1R0h7QAAABISEAq7c8KghU8svOti1U0yamg=
    License URL: https://lic.drmtoday.com/license-proxy-widevine/cenc/
    dt-custom-data: eyJ1c2VySWQiOjE1ODY0NTIzLCJzZXNzaW9uSWXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    
    --key 0abb73c2a0854f2cbceb62d54d326a68:2815a44504d5c87fc4d9083bf4d3fb17
    Last edited by Spectrumhsm; 5th Jan 2024 at 16:55.
    Quote Quote  



Similar Threads

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