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_id, pssh)
# 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_id, licence.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)
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 highCode: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
+ Reply to Thread
Results 1 to 14 of 14
-
-
Read the error message. It tries to be helpful. It says you have made a bad request.
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 -
-
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
-
...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.
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.
-
Last edited by A_n_g_e_l_a; 14th Mar 2024 at 05:55.
-
[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. -
Noob Starter Pack. Just download every Widevine mpd! Not kidding!.
https://files.videohelp.com/u/301890/hellyes6.zip -
-
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
-
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 -
Noob Starter Pack. Just download every Widevine mpd! Not kidding!.
https://files.videohelp.com/u/301890/hellyes6.zip
Similar Threads
-
Download HLS. error 400 to download keys
By naturalc in forum Video Streaming DownloadingReplies: 28Last Post: 28th Oct 2022, 08:13 -
how can i fix this 403 Client Error: Forbidden for
By ahmedani in forum Video Streaming DownloadingReplies: 1Last Post: 19th Jul 2022, 04:38 -
FFmpeg does not add query string parameter to subsequent request URL
By eternal in forum Video Streaming DownloadingReplies: 9Last Post: 31st Dec 2021, 08:57 -
How to download a LIVE ZOOM Video from a web client
By hamada_mohamed in forum Video Streaming DownloadingReplies: 4Last Post: 4th Oct 2021, 22:35 -
License URL Request
By vfa1 in forum Video Streaming DownloadingReplies: 1Last Post: 29th Jun 2021, 11:12