Skip to content

Commit

Permalink
Version 0.7.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Paco8 committed Dec 7, 2024
1 parent 62591c0 commit fe1660c
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 26 deletions.
2 changes: 1 addition & 1 deletion addon.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="plugin.video.skyott"
name="SkyOtt"
version="0.7.1"
version="0.7.2"
provider-name="Paco8">
<requires>
<!--- <import addon="xbmc.python" version="2.25.0"/> -->
Expand Down
28 changes: 9 additions & 19 deletions resources/lib/cdm.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ def get_pssh_from_manifest(url):
return pssh.group(1)
return None

def get_pssh_key(pssh, license_url, platform_id=None):
def get_pssh_key(pssh, license_url):
api_base_url = "https://cdm.drmtalks.com/"
api_cdm_device = "01JCP8Y4W3PHM7DRQ5HGTME2CQ"
api_headers = {'user-agent': user_agent, 'accept': '*/*'}
session.headers.update(api_headers)
headers = {'user-agent': user_agent, 'accept': '*/*'}
session.headers.update(headers)

open_session = session.get(api_base_url + api_cdm_device + '/open').json()
#LOG(open_session.content)
Expand All @@ -41,43 +41,33 @@ def get_pssh_key(pssh, license_url, platform_id=None):
#LOG(challenge_b64)
challenge_raw = base64.b64decode(challenge_b64)

license_headers = api_headers
if platform_id:
from .signature import Signature
path="/" + license_url.split("://", 1)[1].split("/", 1)[1]
#LOG(path)
sig = Signature(platform_id)
sig_header = sig.calculate_signature('POST', path, {}, challenge_raw)
license_headers.update(sig_header)
#LOG(headers)

license = requests.post(license_url, data=challenge_raw, headers=license_headers)
license = session.post(license_url, data=challenge_raw)
license.raise_for_status()
#LOG(license.content)

license_b64 = base64.b64encode(license.content).decode()
#LOG('license_b64: {}'.format(license_b64))
parse_license_data = {'session_id': session_id , 'license_message': license_b64}
license_api_request = session.post(api_base_url + api_cdm_device + '/parse_license', json=parse_license_data, headers=api_headers).json()
license_api_request = session.post(api_base_url + api_cdm_device + '/parse_license', json=parse_license_data).json()

keys_api_data = {'session_id': session_id}
keys_api_request = session.post(api_base_url + api_cdm_device + '/get_keys/CONTENT', json=keys_api_data, headers=api_headers).json()
keys_api_request = session.post(api_base_url + api_cdm_device + '/get_keys/CONTENT', json=keys_api_data).json()
keys = keys_api_request['data']['keys']
#LOG('keys: {}'.format(keys))
res = []
for key in keys:
res.append('{}:{}'.format(key['key_id'], key['key']))

close_session = session.get(api_base_url + api_cdm_device + '/close/' + session_id, headers=api_headers).text
close_session = session.get(api_base_url + api_cdm_device + '/close/' + session_id).text
return ",".join(res)

def get_cdm_keys(manifest_url, license_url, platform_id=None):
def get_cdm_keys(manifest_url, license_url):
pssh = get_pssh_from_manifest(manifest_url)
#LOG('pssh: {}'.format(pssh))
d = {}
if pssh:
try:
key = get_pssh_key(pssh, license_url, platform_id)
key = get_pssh_key(pssh, license_url)
d['key'] = key
except Exception as e:
d['error'] = str(e)
Expand Down
21 changes: 15 additions & 6 deletions resources/lib/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,21 @@ def play(params):
'/hw8CTCX0hhNaWOMp38Tiuj+mSsUmwkq/71R9VsY0EN+k+BDXpaJHIJO9Dk+mm08P0ILWT7/sMJy'
'225r81jyLmvsth4Kw47T4NqkJlP0/Tvs')


platform_id = addon.getSetting('platform_id').lower()
headers = 'User-Agent='+ user_agent(platform_id)
license_headers = headers + '&Content-Type=application/octet-stream'

play_item = xbmcgui.ListItem(path=url)
play_item.setProperty('inputstream.adaptive.manifest_type', 'mpd')
if 'license_url' in data:
extra_params = ''
if slug:
extra_params = '&content_id={}&provider_variant_id={}'.format(info['content_id'], info['provider_variant_id'])
license_url = '{}/license?url={}{}||R{{SSM}}|'.format(proxy, quote_plus(data['license_url']), extra_params)
if addon.getSettingBool('use_proxy_for_license'):
extra_params = ''
if slug:
extra_params = '&content_id={}&provider_variant_id={}'.format(info['content_id'], info['provider_variant_id'])
license_url = '{}/license?url={}{}||R{{SSM}}|'.format(proxy, quote_plus(data['license_url']), extra_params)
else:
license_url = '{}|{}|R{{SSM}}|'.format(data['license_url'], license_headers)
LOG('license_url: {}'.format(license_url))

key = None
Expand All @@ -144,7 +152,7 @@ def play(params):
play_item.setProperty('inputstream.adaptive.license_key', license_url)
play_item.setProperty('inputstream.adaptive.license_type', 'com.widevine.alpha')

play_item.setProperty('inputstream.adaptive.stream_headers', 'User-Agent=' + chrome_user_agent)
play_item.setProperty('inputstream.adaptive.stream_headers', headers)
play_item.setProperty('inputstream.adaptive.server_certificate', certificate)
#play_item.setProperty('inputstream.adaptive.license_flags', 'persistent_storage')
#play_item.setProperty('inputstream.adaptive.license_flags', 'force_secure_decoder')
Expand All @@ -155,6 +163,8 @@ def play(params):
play_item.setProperty('inputstream', 'inputstream.adaptive')

play_item.setMimeType('application/dash+xml')
play_item.setContentLookup(False)

try:
play_item.setInfo('video', info['info'])
play_item.setArt(info['art'])
Expand Down Expand Up @@ -229,7 +239,6 @@ def play(params):
subpaths.append(filename_srt)
play_item.setSubtitles(subpaths)

play_item.setContentLookup(False)
xbmcplugin.setResolvedUrl(_handle, True, listitem=play_item)

# Control player
Expand Down
1 change: 1 addition & 0 deletions resources/settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,6 @@
<setting label="30034" type="bool" id="fix_languages" default="true" enable="eq(-1,true)" subsetting="true"/>
<setting label="30035" type="bool" id="delete_ec3_audio" default="false" enable="eq(-2,true)" subsetting="true"/>
<setting label="30036" type="bool" id="delete_mp4a_audio" default="false" enable="eq(-3,true)" subsetting="true"/>
<setting label="30012" type="bool" id="use_proxy_for_license" default="true"/>
</category>
</settings>

0 comments on commit fe1660c

Please sign in to comment.