Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix recommendations and drop usage of Popcorn V5 API #377

Merged
merged 1 commit into from
Feb 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions resources/lib/vtmgo/vtmgo.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def get_storefront_category(self, storefront, category):
result = json.loads(response.text)

items = []
for item in result.get('teasers'):
for item in result.get('row', {}).get('teasers'):
if item.get('target', {}).get('type') == CONTENT_TYPE_MOVIE:
items.append(self._parse_movie_teaser(item))

Expand All @@ -129,7 +129,7 @@ def get_mylist(self, content_filter=None, cache=CACHE_ONLY):
result = json.loads(response.text)

items = []
for item in result.get('teasers'):
for item in result.get('teasers', []):
if item.get('target', {}).get('type') == CONTENT_TYPE_MOVIE and content_filter in [None, Movie]:
items.append(self._parse_movie_teaser(item, cache=cache))

Expand Down
44 changes: 15 additions & 29 deletions resources/lib/vtmgo/vtmgostream.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
class VtmGoStream:
""" VTM GO Stream API """

_V5_API_KEY = '3vjmWnsxF7SUTeNCBZlnUQ4Z7GQV8f6miQ514l10'
_V6_API_KEY = 'r9EOnHOp1pPL5L4FuGzBPSIHwrQnPu5TBfW16y75'

def __init__(self, tokens=None):
Expand Down Expand Up @@ -160,34 +159,21 @@ 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)
# 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,
})
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
Loading