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 14 of 14
  1. Member
    Join Date
    Mar 2024
    Location
    bejing
    Search Comp PM
    I want to download this video from “https://www.nba.com/watch/video/2016-dunk-contest-lavine-vs-gordon-best-ever” ,With the help of our forum friends I already know the key is “964f42e46638932b33427461f136459f:06ee868164f7d156 637fde3fa500a671”
    But I still want to try running my code to get the key,I got the WVD from the Android emulator ,Then run the following code using pywidevine-1.8.0 and keep getting 400 errors:

    PHP Code:
    from pywidevine.cdm import Cdm
    from pywidevine
    .device import Device
    from pywidevine
    .pssh import PSSH

    import requests

    # prepare pssh
    pssh PSSH("AAAAgHBzc2gAAAAA7e+LqXnWSs6jyCfc1R0h7QAAAGAIARIQlk9C5GY4kyszQnRh8TZFnxoMbWVkaWFraW5kbmJhIjpOQkFfMjAyMzAxMjkwOTM3TkJBX19fX19WSURFT1NfX05CQUVfMjYzMDk0MV9KaXRwX1JlYWNoX0hEMgA=")

    # load device
    device Device.load("/Users/czm/Downloads/m3u8tools/pywidevine-master/pywidevine/WVD/google_android_sdk_built_for_arm64_15.0.0_0882c76f_22586_l3.wvd")

    # load cdm
    cdm Cdm.from_device(device)

    # open cdm session
    session_id cdm.open()

    # get license challenge
    challenge cdm.get_license_challenge(session_idpssh)

    # send license challenge (assuming a generic license server SDK with no API front)
    licence requests.post("https://ottapp-appgw-amp.nba.com/v1/client/get-widevine-license?ownerUid=azuki&mediaId=NBA_202301290937NBA_____VIDEOS__NBAE_2630941_Jitp_Reach_HD&sessionId=984a7c92-ceb3-4842-9a02-b95e368a2f54&is_dvr=false"data=challenge)
    licence.raise_for_status()

    # parse license challenge
    cdm.parse_license(session_idlicence.content)

    # print keys
    for key in cdm.get_keys(session_id):
        print(
    f"[{key.type}] {key.kid.hex}:{key.key.hex()}")

    # close session, disposes of session data
    cdm.close(session_id
    Code:
    error code:
    
    (env) czm@czmdeMac-Studio pywidevine % python3 nba.py         
    /Users/czm/Downloads/m3u8tools/pywidevine-1.8.0/pywidevine/env/lib/python3.9/site-packages/urllib3/__init__.py:35: NotOpenSSLWarning: urllib3 v2 only supports OpenSSL 1.1.1+, currently the 'ssl' module is compiled with 'LibreSSL 2.8.3'. See: https://github.com/urllib3/urllib3/issues/3020
      warnings.warn(
    Traceback (most recent call last):
      File "/Users/czm/Downloads/m3u8tools/pywidevine-1.8.0/pywidevine/nba.py", line 24, in <module>
        licence.raise_for_status()
      File "/Users/czm/Downloads/m3u8tools/pywidevine-1.8.0/pywidevine/env/lib/python3.9/site-packages/requests/models.py", line 1021, in raise_for_status
        raise HTTPError(http_error_msg, response=self)
    requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://ottapp-appgw-amp.nba.com/v1/client/get-widevine-license?ownerUid=azuki&mediaId=NBA_202301290937NBA_____VIDEOS__NBAE_2630941_Jitp_Reach_HD&sessionId=984a7c92-ceb3-4842-9a02-b95e368a2f54&is_dvr=false
    Could you please tell me the cause of this problem? By the way, the python version is 3.12. I don't know if this version is too high
    Quote Quote  
  2. Member
    Join Date
    Feb 2022
    Location
    Search the forum first!
    Search PM
    Read the error message. It tries to be helpful. It says you have made a bad request.

    That simply means you have not sent the required data in the correct format to the the license server.

    There is a remarkable lack of header or other data sent to the license server in your code - doesn't it need any? If that is true then try by hand with l3.py. If not use httptoolkit to watch the transaction from a browser and make sure you can see all the header an data information sent to the license server. Your job then is to do that process via code.
    Noob Starter Pack. Just download every Widevine mpd! Not kidding!.
    https://files.videohelp.com/u/301890/hellyes6.zip
    Quote Quote  
  3. Member
    Join Date
    Mar 2024
    Location
    bejing
    Search Comp PM
    Originally Posted by A_n_g_e_l_a View Post
    Read the error message. It tries to be helpful. It says you have made a bad request.

    That simply means you have not sent the required data in the correct format to the the license server.

    There is a remarkable lack of header or other data sent to the license server in your code - doesn't it need any? If that is true then try by hand with l3.py. If not use httptoolkit to watch the transaction from a browser and make sure you can see all the header an data information sent to the license server. Your job then is to do that process via code.
    Pywidevin 1.8.0 does not require header files
    Quote Quote  
  4. my god, who told you pywidevine 1.8.0 no need headers? if the server requires headers, you must provide headers, either in your script or call a headers.py file separately
    Quote Quote  
  5. Originally Posted by A_n_g_e_l_a View Post
    Read the error message. It tries to be helpful. It says you have made a bad request.

    That simply means you have not sent the required data in the correct format to the the license server.

    There is a remarkable lack of header or other data sent to the license server in your code - doesn't it need any? If that is true then try by hand with l3.py. If not use httptoolkit to watch the transaction from a browser and make sure you can see all the header an data information sent to the license server. Your job then is to do that process via code.
    ...which I've already pointed out to him here. He then actually added the three required headers to his script, but has now removed them once again.

    Originally Posted by jay_670 View Post
    Pywidevin 1.8.0 does not require header files
    Oh well, then good luck making it work without headers.

    Jokes apart, you probably just need fresh headers (don't use headers from days ago) and a non-banned CDM.

    Edit: I hope you probably just mean that the newest version of the L3 script is not setup to use an external headers.py file. That's because the headers are defined inside the main script, it doesn't mean that requests don't require headers.
    Last edited by white_snake; 14th Mar 2024 at 05:51.
    Quote Quote  
  6. Member
    Join Date
    Feb 2022
    Location
    Search the forum first!
    Search PM
    Originally Posted by jay_670 View Post
    pywidevin 1.8.0 does not require header files


    That's the spirit! Don't be told!

    There are nine million bicycles in Beijing
    That's a fact
    It's a thing we can't deny
    Like the fact that I will love you till I die
    Last edited by A_n_g_e_l_a; 14th Mar 2024 at 05:55.
    Quote Quote  
  7. Member
    Join Date
    Mar 2024
    Location
    bejing
    Search Comp PM
    Originally Posted by shellcmd View Post
    my god, who told you pywidevine 1.8.0 no need headers? if the server requires headers, you must provide headers, either in your script or call a headers.py file separately
    Image
    [Attachment 77681 - Click to enlarge]


    https://forum.videohelp.com/threads/412404-%5BfriDay-Video%5D-Max-retries-exceeded-wit...y-SSL-error%29 #9

    with new pywidevine(1.5.3), just input pssh and license url, no header needed, it worked.no ssl problem.
    Image
    [Attachment 75014 - Click to enlarge]
    Last edited by shellcmd; 23rd Nov 2023 at 17:59.
    Quote Quote  
  8. Member
    Join Date
    Feb 2022
    Location
    Search the forum first!
    Search PM
    Originally Posted by jay_670 View Post
    with new pywidevine(1.5.3), just input pssh and license url, no header needed, it worked.no ssl problem.
    That is not a statement that refers to pywidevine generally BUT to that particular website (whatever it was).
    Noob Starter Pack. Just download every Widevine mpd! Not kidding!.
    https://files.videohelp.com/u/301890/hellyes6.zip
    Quote Quote  
  9. Member
    Join Date
    Mar 2024
    Location
    bejing
    Search Comp PM
    Originally Posted by A_n_g_e_l_a View Post
    Originally Posted by jay_670 View Post
    with new pywidevine(1.5.3), just input pssh and license url, no header needed, it worked.no ssl problem.
    That is not a statement that refers to pywidevine generally BUT to that particular website (whatever it was).
    That was my misunderstanding and I'm sorry
    Quote Quote  
  10. alright, finally found that is my faults, i think i must apolpgize and delete that reply to prevent misleading more people.
    Quote Quote  
  11. Member
    Join Date
    Mar 2024
    Location
    bejing
    Search Comp PM
    Originally Posted by shellcmd View Post
    alright, finally found that is my faults, i think i must apolpgize and delete that reply to prevent misleading more people.
    It's okay. I already added the header file, but now I get a new error result. I hope you can check it for me

    Code:
    Traceback (most recent call last):
      File "nbatest2.py", line 35, in <module>
        licence.raise_for_status()
      File "D:\pywidevine-1.8.0\pywidevine\env\lib\site-packages\requests\models.py", line 1021, in raise_for_status
        raise HTTPError(http_error_msg, response=self)
    requests.exceptions.HTTPError: 469 Client Error: Unknown for url: https://ottapp-appgw-amp.nba.com/v1/client/get-widevine-license?ownerUid=azuki&mediaId=NBA_202301290937NBA_____VIDEOS__NBAE_2630941_Jitp_Reach_HD&sessionId=23709fc5-98ea-4108-b65d-801f29bf4195&is_dvr=false
    Quote Quote  
  12. Member
    Join Date
    Mar 2024
    Location
    bejing
    Search Comp PM
    Originally Posted by white_snake View Post
    Originally Posted by A_n_g_e_l_a View Post
    Read the error message. It tries to be helpful. It says you have made a bad request.

    That simply means you have not sent the required data in the correct format to the the license server.

    There is a remarkable lack of header or other data sent to the license server in your code - doesn't it need any? If that is true then try by hand with l3.py. If not use httptoolkit to watch the transaction from a browser and make sure you can see all the header an data information sent to the license server. Your job then is to do that process via code.
    ...which I've already pointed out to him here. He then actually added the three required headers to his script, but has now removed them once again.

    Originally Posted by jay_670 View Post
    Pywidevin 1.8.0 does not require header files
    Oh well, then good luck making it work without headers.

    Jokes apart, you probably just need fresh headers (don't use headers from days ago) and a non-banned CDM.

    Edit: I hope you probably just mean that the newest version of the L3 script is not setup to use an external headers.py file. That's because the headers are defined inside the main script, it doesn't mean that requests don't require headers.

    I tried to extract and generate the wvd file from Android Studio, and adding the header file still encountered the following error
    Traceback (most recent call last):
    File "nbatest2.py", line 35, in <module>
    licence.raise_for_status()
    File "D:\pywidevine-1.8.0\pywidevine\env\lib\site-packages\requests\models.py", line 1021, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
    requests.exceptions.HTTPError: 469 Client Error: Unknown for url: https://ottapp-appgw-amp.nba.com/v1/client/get-widevine-license?ownerUid=azuki&mediaId...5&is_dvr=false
    Quote Quote  
  13. Member
    Join Date
    Feb 2022
    Location
    Search the forum first!
    Search PM
    Originally Posted by jay_670 View Post
    I tried to extract and generate the wvd file from Android Studio
    You use the word 'tried'. Did you succeed? Did you recover two files client_id_key and client_id_blob? (We call these your CDM. ) Have you tested your CDM against the bitmovin.com website to check they work?
    Noob Starter Pack. Just download every Widevine mpd! Not kidding!.
    https://files.videohelp.com/u/301890/hellyes6.zip
    Quote Quote  
  14. Member
    Join Date
    Mar 2024
    Location
    bejing
    Search Comp PM
    Originally Posted by A_n_g_e_l_a View Post
    Originally Posted by jay_670 View Post
    I tried to extract and generate the wvd file from Android Studio
    You use the word 'tried'. Did you succeed? Did you recover two files client_id_key and client_id_blob? (We call these your CDM. ) Have you tested your CDM against the bitmovin.com website to check they work?
    of course,it work.
    Quote Quote  



Similar Threads

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