-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- New upstream release. - Apply upstream patch for twitch.tv API change: chrippa/livestreamer#633 git-svn-id: file:///srv/repos/svn-community/svn@123798 9fca08f4-af9d-4005-b8df-a31f2cc04f65
- Loading branch information
foutrelis
authored and
svntogit
committed
Dec 12, 2014
1 parent
040a359
commit 9f7c999
Showing
2 changed files
with
67 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
From bbc6d0e7c1a8b6bf053345e88366cae115baa2d3 Mon Sep 17 00:00:00 2001 | ||
From: Christopher Rosell <chrippa@tanuki.se> | ||
Date: Fri, 12 Dec 2014 00:14:43 +0100 | ||
Subject: [PATCH] plugins.twitch: Update for API change. | ||
|
||
Resolves #633. | ||
--- | ||
src/livestreamer/plugins/twitch.py | 17 +++++++++-------- | ||
1 file changed, 9 insertions(+), 8 deletions(-) | ||
|
||
diff --git a/src/livestreamer/plugins/twitch.py b/src/livestreamer/plugins/twitch.py | ||
index ca0d2bd..0adc872 100644 | ||
--- a/src/livestreamer/plugins/twitch.py | ||
+++ b/src/livestreamer/plugins/twitch.py | ||
@@ -125,8 +125,8 @@ def time_to_offset(t): | ||
|
||
|
||
class UsherService(object): | ||
- def _create_url(self, endpoint, asset, **extra_params): | ||
- url = "http://usher.twitch.tv/{0}/{1}".format(endpoint, asset) | ||
+ def _create_url(self, endpoint, **extra_params): | ||
+ url = "http://usher.twitch.tv{0}".format(endpoint) | ||
params = { | ||
"player": "twitchweb", | ||
"p": int(random() * 999999), | ||
@@ -145,11 +145,12 @@ class UsherService(object): | ||
|
||
return req.url | ||
|
||
- def select(self, channel, **extra_params): | ||
- return self._create_url("select", channel, **extra_params) | ||
+ def channel(self, channel, **extra_params): | ||
+ return self._create_url("/api/channel/hls/{0}.m3u8".format(channel), | ||
+ **extra_params) | ||
|
||
- def vod(self, vod_id, **extra_params): | ||
- return self._create_url("vod", vod_id, **extra_params) | ||
+ def video(self, video_id, **extra_params): | ||
+ return self._create_url("/vod/{0}".format(video_id), **extra_params) | ||
|
||
|
||
class TwitchAPI(object): | ||
@@ -417,9 +418,9 @@ class Twitch(Plugin): | ||
self._authenticate() | ||
sig, token = self._access_token(type) | ||
if type == "live": | ||
- url = self.usher.select(self.channel, nauthsig=sig, nauth=token) | ||
+ url = self.usher.channel(self.channel, sig=sig, token=token) | ||
elif type == "video": | ||
- url = self.usher.vod(self.video_id, nauthsig=sig, nauth=token) | ||
+ url = self.usher.video(self.video_id, nauthsig=sig, nauth=token) | ||
|
||
try: | ||
streams = HLSStream.parse_variant_playlist(self.session, url) | ||
-- | ||
2.1.3 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters