VideoHelp Forum
+ Reply to Thread
Page 2 of 2
FirstFirst 1 2
Results 31 to 51 of 51
Thread
  1. I will write what actions I performed:
    1) First, I copied the folder with all the contents called "pywidevine" from the WKS-KEY folder to the folder "C:\Users\UserName\AppData\Local\Programs\Python\P ython312\Lib\site-packages\
    2) From the android_generic folder I copied 2 files named: device_private_key , and device_client_id_blob
    3) Then I wanted to create a WVD file by running on the command line:
    pywidevine create-device -k "C:\Users\UserName\AppData\Local\Programs\Python\P ython312\Lib\site-packages\pywidevine\device_private_key" -c "C:\Users\UserName\AppData\Local\Programs\ Python\Python312\Lib\site-packages\pywidevine\device_client_id_blob" -t "ANDROID" -l 3 -o "C:\Users\UserName\AppData\Local\Programs\Python\P ython312\Lib\site-packages\WVD"
    4) I received the message:
    "Traceback (most recent call last):
    File "<frozen runpy>", line 198, in _run_module_as_main
    File "<frozen runpy>", line 88, in _run_code
    File "C:\Users\UserName\AppData\Local\Programs\Python\P ython312\Scripts\pywidevine.exe\__main__.py", line 4, in <module>
    ModuleNotFoundError: No module named 'pywidevine.main'
    5) Please help for which I thank you in advance.
    Quote Quote  
  2. Feels Good Man 2nHxWW6GkN1l916N3ayz8HQoi's Avatar
    Join Date
    Jan 2024
    Location
    Pepe Island
    Search Comp PM
    Yeah, you're doing it entirely wrong. You don't use an existing pywidevine from I dunno where, you install it fresh using pip install.

    https://pypi.org/project/pywidevine/

    Delete the old one from where you copied and install new.
    --[----->+<]>.++++++++++++.---.--------.
    [*drm mass downloader: widefrog*]~~~[*how to make your own mass downloader: guide*]
    Quote Quote  
  3. Bad news again, I don't know what to do ://

    INFO:rootywidevine version 1.8.0 Copyright (c) 2022-2024 rlaphoenix
    INFO:root:https://github.com/devine-dl/pywidevine
    Traceback (most recent call last):
    File "<frozen runpy>", line 198, in _run_module_as_main
    File "<frozen runpy>", line 88, in _run_code
    File "C:\Users\UserName\AppData\Local\Programs\Python\P ython312\Scripts\pywidevine.exe\__main__.py", line 7, in <module>
    File "C:\Users\UserName\AppData\Local\Programs\Python\P ython312\Lib\site-packages\click\core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "C:\Users\UserName\AppData\Local\Programs\Python\P ython312\Lib\site-packages\click\core.py", line 1078, in main
    rv = self.invoke(ctx)
    ^^^^^^^^^^^^^^^^
    File "C:\Users\UserName\AppData\Local\Programs\Python\P ython312\Lib\site-packages\click\core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "C:\Users\UserName\AppData\Local\Programs\Python\P ython312\Lib\site-packages\click\core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "C:\Users\UserName\AppData\Local\Programs\Python\P ython312\Lib\site-packages\click\core.py", line 783, in invoke
    return __callback(*args, **kwargs)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "C:\Users\UserName\AppData\Local\Programs\Python\P ython312\Lib\site-packages\click\decorators.py", line 33, in new_func
    return f(get_current_context(), *args, **kwargs)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "C:\Users\UserName\AppData\Local\Programs\Python\P ython312\Lib\pywidevine\main.py", line 197, in create_device
    device = Device(
    ^^^^^^^
    File "C:\Users\UserName\AppData\Local\Programs\Python\P ython312\Lib\pywidevine\device.py", line 108, in __init__
    self.private_key = RSA.importKey(private_key)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "C:\Users\UserName\AppData\Local\Programs\Python\P ython312\Lib\site-packages\Crypto\PublicKey\RSA.py", line 853, in import_key
    raise ValueError("RSA key format is not supported")
    ValueError: RSA key format is not supported
    Quote Quote  
  4. Feels Good Man 2nHxWW6GkN1l916N3ayz8HQoi's Avatar
    Join Date
    Jan 2024
    Location
    Pepe Island
    Search Comp PM
    Originally Posted by PepeForEver View Post
    Bad news again, I don't know what to do ://
    Dump your own CDM and try with those. All the steps are detailed on the stickies.
    --[----->+<]>.++++++++++++.---.--------.
    [*drm mass downloader: widefrog*]~~~[*how to make your own mass downloader: guide*]
    Quote Quote  
  5. Thank you for help, unfortunately, I have another problem and questions,
    In your code "
    WVD_FILE = "device_wvd_file.wvd" "should I give the path or just the file name? Should I change the name of this file to e.g. "google google_android_sdk_built_for_x86_v4.1.0-android_xxxxxxxx_xxxx_l3.wvd" i.e. the one that was generated? Because unfortunately I have problems again :/ thanks for answer.
    Where should the .wvd file be placed?
    Quote Quote  
  6. With a lot of help from 2nHxWW6GkN1l916N3ayz8HQoi I did some important things, but I managed to get something that is close to the final solution, i.e. I got PSSH, License URL, Manifest, link to .MPD file ,but unfortunately I get an error:
    Traceback (most recent call last):
    File "C:\Users\UserName\Downloads\DRM-xxxxx\DRM\CDA.py", line 141, in <module>
    print(get_download_command(s))
    ^^^^^^^^^^^^^^^^^^^^^^^^
    File "C:\Users\UserName\\Downloads\DRM-xxxxx\DRM\CDA.py", line 124, in get_download_command
    keys = get_keys(pssh, license_url, custom_data)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "C:\Users\UserName\\Downloads\DRM-xxxxx\DRM\CDA.py", line 81, in get_keys
    license.raise_for_status()
    File "C:\Users\UserName\\AppData\Local\Programs\Python\ Python312\Lib\site-packages\requests\models.py", line 1021, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
    requests.exceptions.HTTPError: 406 Client Error: for url: https://lic.drmtoday.com/license-proxy-widevine/cenc/?specConform=true

    I am very close to the solution, but please tell me what may cause the above errors and how to fix it, thanks again!
    Last edited by PepeForEver; 10th Apr 2024 at 19:57.
    Quote Quote  
  7. Member aqzs's Avatar
    Join Date
    Mar 2024
    Location
    Paris
    Search Comp PM
    Originally Posted by PepeForEver View Post
    Thank you for help, unfortunately, I have another problem and questions,
    In your code "
    WVD_FILE = "device_wvd_file.wvd" "should I give the path or just the file name? Should I change the name of this file to e.g. "google google_android_sdk_built_for_x86_v4.1.0-android_xxxxxxxx_xxxx_l3.wvd" i.e. the one that was generated? Because unfortunately I have problems again :/ thanks for answer.
    Where should the .wvd file be placed?
    place the .wvd file in the same directory as the python script, rename it to device.wvd and in the script put 'devide.wvd' : device = Device.load(r"device.wvd")
    Quote Quote  
  8. Member
    Join Date
    Mar 2024
    Location
    Poland
    Search PM
    I'm trying to use the script and I have the following information:


    Code:
    C:\Users\grzech67>python D:\CDA\cda.py
    Need local CDM (in WVD format) for https://www.cda.pl/video/1670572f2/vfilm
    Need local CDM (in WVD format) for https://www.cda.pl/video/250188864/vfilm
    Need local CDM (in WVD format) for https://www.cda.pl/video/2508939fb/vfilm
    Need local CDM (in WVD format) for https://www.cda.pl/video/161441361/vfilm
    Need local CDM (in WVD format) for https://www.cda.pl/video/153780264/vfilm
    What am I doing wrong ?
    Quote Quote  
  9. Member aqzs's Avatar
    Join Date
    Mar 2024
    Location
    Paris
    Search Comp PM
    Originally Posted by grzech67 View Post
    I'm trying to use the script and I have the following information:


    Code:
    C:\Users\grzech67>python D:\CDA\cda.py
    Need local CDM (in WVD format) for https://www.cda.pl/video/1670572f2/vfilm
    Need local CDM (in WVD format) for https://www.cda.pl/video/250188864/vfilm
    Need local CDM (in WVD format) for https://www.cda.pl/video/2508939fb/vfilm
    Need local CDM (in WVD format) for https://www.cda.pl/video/161441361/vfilm
    Need local CDM (in WVD format) for https://www.cda.pl/video/153780264/vfilm
    What am I doing wrong ?
    If you named your CDM 'device.wvd' and placed it in the python code as 'device.wvd', then from the directory where you run the script you have to place the CDM.

    You should have something like that :
    device.wvd, cda.py in the same folder, open a cmd in this folder and run : python cda.py
    Quote Quote  
  10. psaframe
    Join Date
    Mar 2021
    Location
    Algeria
    Search PM
    Originally Posted by grzech67 View Post
    I'm trying to use the script and I have the following information:


    Code:
    C:\Users\grzech67>python D:\CDA\cda.py
    Need local CDM (in WVD format) for https://www.cda.pl/video/1670572f2/vfilm
    Need local CDM (in WVD format) for https://www.cda.pl/video/250188864/vfilm
    Need local CDM (in WVD format) for https://www.cda.pl/video/2508939fb/vfilm
    Need local CDM (in WVD format) for https://www.cda.pl/video/161441361/vfilm
    Need local CDM (in WVD format) for https://www.cda.pl/video/153780264/vfilm
    What am I doing wrong ?
    Need local CDM

    you have to set wvd file in path bro
    Quote Quote  
  11. Originally Posted by 2nHxWW6GkN1l916N3ayz8HQoi View Post
    Here is a downloader for https://www.cda.pl . It works only for free DRM content. No account needed. Only Polish IP.

    Code:
    import html
    import json
    import re
    
    import requests
    from cf_clearance import sync_cf_retry, sync_stealth
    from playwright.sync_api import sync_playwright
    from pywidevine.cdm import Cdm
    from pywidevine.device import Device
    from pywidevine.pssh import PSSH
    
    WVD_FILE = "device_wvd_file.wvd"
    
    MAIN_URL = "https://www.cda.pl"
    CF_RETRIES = 8
    
    
    def bypass_cloudflare():
        user_agent, cf_clearance = None, None
        retry = 0
        failure = False
    
        with sync_playwright() as spw:
            browser = spw.firefox.launch(headless=True)
            page = browser.new_page()
    
            sync_stealth(page)
            page.goto(MAIN_URL)
            while True:
                if sync_cf_retry(page):
                    for cookie in page.context.cookies():
                        if cookie.get('name') == 'cf_clearance':
                            cf_clearance = cookie.get('value')
                            break
                    user_agent = page.evaluate('() => {return navigator.userAgent}')
    
                    if cf_clearance is not None:
                        break
                else:
                    retry = CF_RETRIES
    
                retry += 1
                if retry >= CF_RETRIES:
                    failure = True
                    break
            browser.close()
    
        if failure:
            print("Failed to bypass cloudflare")
            exit(0)
        return user_agent, cf_clearance
    
    
    def check_cloudflare():
        if "Just a moment..." in requests.get(MAIN_URL).content.decode():
            user_agent, cf_clearance = bypass_cloudflare()
            return {"User-Agent": user_agent, "cf_clearance": cf_clearance}
        return {"User-Agent": None, "cf_clearance": None}
    
    
    CLOUDFLARE = check_cloudflare()
    
    
    def get_keys(pssh_value, license_url, custom_data):
        if pssh_value is None:
            return []
        try:
            device = Device.load(WVD_FILE)
        except:
            return []
    
        pssh_value = PSSH(pssh_value)
        cdm = Cdm.from_device(device)
        cdm_session_id = cdm.open()
    
        challenge = cdm.get_license_challenge(cdm_session_id, pssh_value)
        licence = requests.post(
            license_url, data=challenge,
            headers={'x-dt-custom-data': custom_data}
        )
        licence.raise_for_status()
        cdm.parse_license(cdm_session_id, licence.content)
    
        keys = []
        for key in cdm.get_keys(cdm_session_id):
            if "CONTENT" in key.type:
                keys += [f"{key.kid.hex}:{key.key.hex()}"]
        cdm.close(cdm_session_id)
        return keys
    
    
    def get_video_data(source_url):
        response = requests.get(
            source_url, cookies={'cf_clearance': CLOUDFLARE['cf_clearance']},
            headers={'User-Agent': CLOUDFLARE['User-Agent']}
        ).content.decode()
        if "player_data" not in response:
            print("VPN error")
            exit(0)
    
        content = json.loads(html.unescape(re.findall(
            r'player_data="([^"]*)"',
            response
        )[0]))["video"]
        manifest = content["manifest"]
        license_url = content["manifest_drm_proxy"]
        custom_data = content["manifest_drm_header"]
    
        try:
            pssh_value = str(min(re.findall(
                r'<cenc:pssh\b[^>]*>(.*?)</cenc:pssh>',
                requests.get(manifest).content.decode()
            ), key=len))
        except:
            return manifest, None, None, None
        return manifest, pssh_value, license_url, custom_data
    
    
    def get_download_command(source_url):
        manifest, pssh, license_url, custom_data = get_video_data(source_url)
        if manifest is None:
            return f"No manifest found for {source_url}"
    
        keys = get_keys(pssh, license_url, custom_data)
        if len(keys) == 0:
            if pssh is not None:
                return f"Need local CDM (in WVD format) for {source_url}"
            return f'N_m3u8DL-RE.exe "{manifest}" -M format=mkv'
        return f'N_m3u8DL-RE.exe "{manifest}" {" ".join([f"--key {k}" for k in keys])} -M format=mkv'
    
    
    SOURCE_URLS = [
        "https://www.cda.pl/video/1670572f2/vfilm",
        "https://www.cda.pl/video/250188864/vfilm",
        "https://www.cda.pl/video/2508939fb/vfilm",
        "https://www.cda.pl/video/161441361/vfilm",
        "https://www.cda.pl/video/153780264/vfilm",
    ]
    
    for s in SOURCE_URLS:
        print(get_download_command(s))
    Output:
    Code:
    N_m3u8DL-RE.exe "https://vcze133.cda.pl/1670572/1670572.mpd" --key 65393535653839613762613264653965:61313762326463356164353236313733 -M format=mkv
    N_m3u8DL-RE.exe "https://vcze132.cda.pl/2501888/2501888.mpd" --key 61613231316161643435373634633964:66373332396336306463303230643834 -M format=mkv
    N_m3u8DL-RE.exe "https://vcze134.cda.pl/2508939/2508939.mpd" --key 31323139303536666134663734373337:66656633633631623466396665636334 -M format=mkv
    N_m3u8DL-RE.exe "https://vcze804.cda.pl/1614413/1614413.mpd" --key 33646461333363393134353838643932:35623262336231363562663331356237 -M format=mkv
    N_m3u8DL-RE.exe "https://vcze801.cda.pl/1537802/1537802.mpd" --key 33356535653566373663643734313536:30313135616230306632306139643832 -M format=mkv
    The download command can be used without a VPN to avoid wasting data. The site uses Cloudflare protection but that can be bypassed by generating a cf_clearance cookie using an automated browser. The non-DRM content can be easily downloaded by looking at the network requests for a mp4 file.
    What browser did you use to extract the mpd links?

    In most browsers I have an mpd vp9 link - where I download files in webp format - which is useless.
    Quote Quote  
  12. Feels Good Man 2nHxWW6GkN1l916N3ayz8HQoi's Avatar
    Join Date
    Jan 2024
    Location
    Pepe Island
    Search Comp PM
    Originally Posted by Kadio View Post
    What browser did you use to extract the mpd links?

    In most browsers I have an mpd vp9 link - where I download files in webp format - which is useless.
    If the script is not working for a specific case, provide the URL you are attempting. I have no idea what you're asking me.
    --[----->+<]>.++++++++++++.---.--------.
    [*drm mass downloader: widefrog*]~~~[*how to make your own mass downloader: guide*]
    Quote Quote  
  13. Many thanks !!! to 2nHxWW6GkN1l916N3ayz8HQoi for his kind help! , brilliant script that works perfectly.
    I have a question, is it possible to use the website https://cdrm-project.com/ , having PSSH, license URL, headers, custom data obtaining keys without your own CDM ( Free DRM content from CDA.PL ) ?
    Quote Quote  
  14. Feels Good Man 2nHxWW6GkN1l916N3ayz8HQoi's Avatar
    Join Date
    Jan 2024
    Location
    Pepe Island
    Search Comp PM
    Originally Posted by PepeForEver View Post
    is it possible to use the website https://cdrm-project.com/ , having PSSH, license URL, headers, custom data obtaining keys without your own CDM?
    Yes, it is possible. But out of principle, I won't add "magical" external APIs that make the job easier for the end-user. There will be more points where stuff could break unexpectedly and also people won't even care how to dump a CDM anymore, so I won't do that. If anyone else wants to modify this script to add that, then feel free to do it.
    --[----->+<]>.++++++++++++.---.--------.
    [*drm mass downloader: widefrog*]~~~[*how to make your own mass downloader: guide*]
    Quote Quote  
  15. Thanks for the detailed explanations!
    Quote Quote  
  16. Originally Posted by 2nHxWW6GkN1l916N3ayz8HQoi View Post
    Originally Posted by Kadio View Post
    What browser did you use to extract the mpd links?

    In most browsers I have an mpd vp9 link - where I download files in webp format - which is useless.
    If the script is not working for a specific case, provide the URL you are attempting. I have no idea what you're asking me.

    MPD H264 can be obtained in the browser: Iridium browser, Microsoft Edge (Windows) / Mozilla Firefox (Linux). In other cases, the video loads from mpd webp.

    Movies : https://www.cda.pl/video/18723067d0/vfilm

    MPD H264 : https://vcze190.cda.pl/18723067/18723067.mpd - obtained from Microsoft edge
    MPD WEBP (vp9) : https://vcze190.cda.pl/18723067vp9/18723067.mpd - obtained from Google chrome

    Supposedly the same movie, but different MPD - depending on the browser or operating system.

    Webp is more difficult to decrypt, connect and recreate.
    Last edited by Kadio; 21st Apr 2024 at 04:34.
    Quote Quote  
  17. Feels Good Man 2nHxWW6GkN1l916N3ayz8HQoi's Avatar
    Join Date
    Jan 2024
    Location
    Pepe Island
    Search Comp PM
    Originally Posted by Kadio View Post
    MPD H264 can be obtained in the browser: Iridium browser, Microsoft Edge (Windows) / Mozilla Firefox (Linux). In other cases, the video loads from mpd webp.
    If you take a look at the script you'll notice this line
    Code:
    browser = spw.firefox.launch(headless=True)
    So I'm using firefox.
    --[----->+<]>.++++++++++++.---.--------.
    [*drm mass downloader: widefrog*]~~~[*how to make your own mass downloader: guide*]
    Quote Quote  
  18. Member
    Join Date
    Sep 2024
    Location
    TX, USA
    Search PM
    How about this movie?
    https://www.cda.pl/video/32591265d

    I've tried extracting to no avail
    Quote Quote  
  19. Feels Good Man 2nHxWW6GkN1l916N3ayz8HQoi's Avatar
    Join Date
    Jan 2024
    Location
    Pepe Island
    Search Comp PM
    Originally Posted by peabody70 View Post
    How about this movie?
    https://www.cda.pl/video/32591265d

    I've tried extracting to no avail
    Open network requests. Filter for mp4. Select 720p quality. Take last request and copy the URL in a new tab. Right click save as video. It doesn't even use DRM.

    Edit: I checked yt-dlp also. It works directly with that as well
    Code:
    yt-dlp "https://www.cda.pl/video/32591265d"
    Last edited by 2nHxWW6GkN1l916N3ayz8HQoi; 5th Sep 2024 at 14:58.
    --[----->+<]>.++++++++++++.---.--------.
    [*drm mass downloader: widefrog*]~~~[*how to make your own mass downloader: guide*]
    Quote Quote  
  20. Member aqzs's Avatar
    Join Date
    Mar 2024
    Location
    Paris
    Search Comp PM
    Originally Posted by peabody70 View Post
    How about this movie?
    https://www.cda.pl/video/32591265d

    I've tried extracting to no avail
    Code:
    https://vwaw673.cda.pl/h/b/b/24/na/20ANhamYK_FG0QpODIdbEA/33/1725609394/sd23d4893f304f266834ea3749e66d248ac3c1321f2d28547f285cc5c306fc7700.mp4
    https://gofile.io/d/8FMFs0
    Quote Quote  
  21. Member
    Join Date
    Sep 2024
    Location
    TX, USA
    Search PM
    Thank you! That worked
    Quote Quote  



Similar Threads

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