Skip to content
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 addon.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="script.module.python.twitch" name="python-twitch for Kodi" version="2.0.6" provider-name="A Talented Community">
<addon id="script.module.python.twitch" name="python-twitch for Kodi" version="2.0.7" provider-name="A Talented Community">
<requires>
<import addon="xbmc.python" version="2.20.0"/>
<import addon="script.module.six" version="1.11.0"/>
Expand All @@ -9,7 +9,7 @@
<extension point="xbmc.addon.metadata">
<platform>all</platform>
<news>
[add] add missing helix api endpoints
[add] add platform parameter to usher
</news>
<assets>
<icon>icon.png</icon>
Expand Down
3 changes: 3 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
2.0.7
[add] add platform parameter to usher

2.0.6
[add] add missing helix api endpoints

Expand Down
24 changes: 12 additions & 12 deletions resources/lib/twitch/api/usher.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,21 +30,21 @@ def valid_video_id(video_id):


@query
def channel_token(channel):
def channel_token(channel, platform=keys.WEB):
q = HiddenApiQuery('channels/{channel}/access_token')
q.add_urlkw(keys.CHANNEL, channel)
q.add_param(keys.NEED_HTTPS, Boolean.TRUE)
q.add_param(keys.PLATFORM, keys.WEB)
q.add_param(keys.PLATFORM, platform)
q.add_param(keys.PLAYER_BACKEND, keys.MEDIAPLAYER)
return q


@query
def vod_token(video_id):
def vod_token(video_id, platform=keys.WEB):
q = HiddenApiQuery('vods/{vod}/access_token')
q.add_urlkw(keys.VOD, video_id)
q.add_param(keys.NEED_HTTPS, Boolean.TRUE)
q.add_param(keys.PLATFORM, keys.WEB)
q.add_param(keys.PLATFORM, platform)
q.add_param(keys.PLAYER_BACKEND, keys.MEDIAPLAYER)
return q

Expand All @@ -56,8 +56,8 @@ def _legacy_video(video_id):
return q


def live_request(channel):
token = channel_token(channel)
def live_request(channel, platform=keys.WEB):
token = channel_token(channel, platform=platform)
if keys.ERROR in token:
return token
else:
Expand Down Expand Up @@ -99,18 +99,18 @@ def _live(channel, token):


@m3u8
def live(channel):
token = channel_token(channel)
def live(channel, platform=keys.WEB):
token = channel_token(channel, platform=platform)
if keys.ERROR in token:
return token
else:
return _live(channel, token)


def video_request(video_id):
def video_request(video_id, platform=keys.WEB):
video_id = valid_video_id(video_id)
if video_id:
token = vod_token(video_id)
token = vod_token(video_id, platform=platform)
if keys.ERROR in token:
return token
else:
Expand Down Expand Up @@ -156,10 +156,10 @@ def _vod(video_id, token):


@m3u8
def video(video_id):
def video(video_id, platform=keys.WEB):
video_id = valid_video_id(video_id)
if video_id:
token = vod_token(video_id)
token = vod_token(video_id, platform=platform)
if keys.ERROR in token:
return token
else:
Expand Down