Skip to content

Commit

Permalink
Fix livestreams on Kodi 19 (#354)
Browse files Browse the repository at this point in the history
  • Loading branch information
mediaminister authored Feb 9, 2023
1 parent 3ca4b38 commit 96fe804
Showing 1 changed file with 30 additions and 16 deletions.
46 changes: 30 additions & 16 deletions resources/lib/vtmgo/vtmgostream.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
class VtmGoStream:
""" VTM GO Stream API """

_API_KEY = 'r9EOnHOp1pPL5L4FuGzBPSIHwrQnPu5TBfW16y75'
_V5_API_KEY = '3vjmWnsxF7SUTeNCBZlnUQ4Z7GQV8f6miQ514l10'
_V6_API_KEY = 'r9EOnHOp1pPL5L4FuGzBPSIHwrQnPu5TBfW16y75'

def __init__(self, tokens=None):
""" Initialise object """
Expand Down Expand Up @@ -159,21 +160,34 @@ def _get_video_info(self, strtype, stream_id, player_token):
"""
url = 'https://videoplayer-service.dpgmedia.net/config/%s/%s' % (strtype, stream_id)
_LOGGER.debug('Getting video info from %s', url)
response = util.http_post(url,
params={
'startPosition': '0.0',
'autoPlay': 'true',
},
data={
'deviceType': 'android-tv',
'zone': 'vtmgo',
},
headers={
'Accept': 'application/json',
'x-api-key': self._API_KEY,
'Popcorn-SDK-Version': '6',
'Authorization': 'Bearer ' + player_token,
})
# Live channels: Fallback to old Popcorn SDK 5 for Kodi 19 and lower, because new livestream format is not supported
if kodiutils.kodi_version_major() <= 19 and strtype == 'channels':
response = util.http_get(url,
params={
'startPosition': '0.0',
'autoPlay': 'true',
},
headers={
'Accept': 'application/json',
'x-api-key': self._V5_API_KEY,
'Popcorn-SDK-Version': '5',
})
else:
response = util.http_post(url,
params={
'startPosition': '0.0',
'autoPlay': 'true',
},
data={
'deviceType': 'android-tv',
'zone': 'vtmgo',
},
headers={
'Accept': 'application/json',
'x-api-key': self._V6_API_KEY,
'Popcorn-SDK-Version': '6',
'Authorization': 'Bearer ' + player_token,
})

info = json.loads(response.text)
return info
Expand Down

0 comments on commit 96fe804

Please sign in to comment.