xbmc / inputstream.adaptive

kodi inputstream addon for several manifest types
Other
452 stars 241 forks source link

Failed to generate Widevine license #926

Closed Vikassm73 closed 2 years ago

Vikassm73 commented 2 years ago

Getting following Error

{"code":-7008,"message":"[-7008] Failed to generate Widevine license"}

Used below code

`

lic_url='https://wv.service.expressplay.com/hms/wv/rights/? ExpressPlayToken=BQA2T1gfKbEAJDFhZWU2MmNiLTA2YzQtNDFmZC1iZjdkLWRhZDg2NWFlNWNmYwAAAGAEG4NJ8ieotdjr2q4LTC25ScrNnzwZw0SgnLUoYSdoHROENN9IQjw6c1GStYsbvX_kRQct5T8dzOh_YhcYZKA7eDeSf-8w5Tzsv93ibApFBqd076oNVdpnANdToFCI2bWT_vXVdzkgjDhQHqR1zpoFbxDysQ'

license_key = '%s|%s|R{SSM}|' % (lic_url,urllib_parse.urlencode(header)) play_item.setProperty('inputstream.adaptive.license_key', license_key)

`

Found some additional Information but don't know how to use this in the code

checksum: "OrI/z/NJC6g=" drm_video_kid: "d207816247ec43429c56e4497d72" kid_mss: "YoEH0uxHQkOcVuRJfXIAAA==" signature: "07857f0a77df2c86a54a41a5ddb7b43a55db83091dc5cf3c8b059c88c66ff49bfb9669d27c64f0f9e4894fb9e1808665768dc219901d4a5bd637524b74f2d3bab12bf3c8e958e97dc6798f7131448229dda0c71a5ed51bc8fdd0de55c2de868c226f3c95170beabe6eb4170ac48de59cdfc8948b33ea3ce88852d8f247ed9ffc"

Please advise

Error Log : kodi.log

URL Manifest: https://pastebin.com/8RWLXdZp

CastagnaIT commented 2 years ago

by reading this: https://www.expressplay.com/developer/restapi/#widevine-license-token-request seems that GET request is accepted, then you could try as:

license_key = '%s|%s||' % (lic_url,urllib_parse.urlencode(header))

and you have to remove the inputstream.adaptive.pre_init_data property, because you have not integrated a proxy in the addon to handle these data

Vikassm73 commented 2 years ago

Tried various combination. Removed pre_init_data but result is the same. But now error message

{"error":{"code":-6005,"message":"[-6005] Invalid key data specified"}}

kodi.log

request details which I got from mitProxy are as below

POST
 
https://wv.service.expressplay.com/hms/wv/rights/?ExpressPlayToken=BQA2T1gfKaMAJDFhZWU2MmNiLTA2YzQtNDFmZC1iZjdkLWRhZDg2NWFlNWNmYwAAAGALHgB1MPlXTevSY1uRdxhbnL3u4o2qBEcfNz9kO68qid5K6roSLjrovNK0YYyjk-BrR06b5ZQZsqQ1WaGY0taUdIUw5SqTmxOP2kMxxMXN9M38Nt_qBhpypv8qQQtkiWiiYXbuCg7FsRL8crIeWCzp1ANbuQ
 
HTTP/2.0
content-length: | 4206 -- | -- sec-ch-ua: | " Not A;Brand";v="99", "Chromium";v="100", "Google Chrome";v="100" sec-ch-ua-mobile: | ?0 user-agent: | Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.60 Safari/537.36 sec-ch-ua-platform: | "Windows" accept: | */* origin: | https://www.sonyliv.com sec-fetch-site: | cross-site sec-fetch-mode: | cors sec-fetch-dest: | empty referer: | https://www.sonyliv.com/ accept-encoding: | gzip, deflate, br accept-language: | en-US,en;q=0.9
glennguy commented 2 years ago

All I can suggest is to run mitmproxy on both your browser and Kodi and compare the requests side by side. The content length in Kodi will be smaller as it won't include a certificate (only happens automatically on VMP capable clients)

By the way, happy to try and help but this isn't an issue with inputstream.adaptive. You need to figure out the correct info to generate a valid license response (if it is possible on your Windows device, again VMP...) and we can only do so much to help from our position with no access to the streaming service ourselves.

Vikassm73 commented 2 years ago

Will you please try to play below link. Don't know will it play at your region. It's a free link. Just need to do OTP login by giving your mobile number. (Make sure that add block is off).

https://www.sonyliv.com/shows/tabbar-1700000804/karam-din-1000139592?watch=true

glennguy commented 2 years ago

Thanks for the link, very helpful.

Playback is fine: image

The .strm file used:

#KODIPROP:inputstream=inputstream.adaptive
#KODIPROP:inputstream.adaptive.manifest_type=mpd
#KODIPROP:inputstream.adaptive.license_type=com.widevine.alpha
#KODIPROP:inputstream.adaptive.license_key=https://wv.service.expressplay.com/hms/wv/rights/?ExpressPlayToken=BQA2T1gfKcwAJDFhZWU2MmNiLTA2YzQtNDFmZC1iZjdkLWRhZDg2NWFlNWNmYwAAAGCt8X6s3--cJEC0nEH98Xh3gKB3SoAEPSnVCL02Mp0iypLys7BjcMp3a5hDAGaj7usSSGigvOUTJ-SUrv8nI_B-jmFPcdrP_l0V5k4EUysp72v8xJHHXMg1f1ftrA3jvuQvPoXobvL4YbQ6Z6im9MOsovpVqQ|Content-Type=|R{SSM}|
https://drm.sonyliv.com/DASH/40cb132c-7751-42f7-b1f8-4b27498e3e4c/show_original_tabbar_ep01_20211014T155116.mpd?hdnea=exp=1649109043~acl=/DASH/40cb132c-7751-42f7-b1f8-4b27498e3e4c/show_original_tabbar_ep01_20211014T155116.mpd*~id=893d7907c7814c6fbdded3e0e0de68ea-1649065774913-2204040950252761329~hmac=4c5e382036bbc849a74a9463b841c1794fddb643f8e863e285f107c12ce98923&c3.ri=6905184441801560315|x-playback-session-id=4cdd183a00bc4264b48fb39ecabc955c-1649066038633

The license URL comes from the POST to https://apiv2.sonyliv.com/AGL/1.4/R/ENG/WEB/AU/CONTENT/GETLAURL

I'm not sure what you've been trying but the license URL will be different for each video and possibly each user.

Vikassm73 commented 2 years ago

Thanks for your help. Mistake was there in only one line. I got proper format now. Once again thanks

license_key = '%s|Content-Type=|R{SSM}|' % (lic_url)