aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Christopher Rosell <chrippa@tanuki.se>2012-08-03 23:59:08 +0200
committerGravatar Christopher Rosell <chrippa@tanuki.se>2012-08-03 23:59:08 +0200
commit9232721b1998665a55fcf6bebe46cc8eac57bf68 (patch)
tree8b07e9e66581654f8c2dfbb48aae6029f3b2ca0c /src
parent9485db4abf636e04b5f0732dfc4a99cee74a6361 (diff)
livestreamer.plugins.justintv: Only request metadata when needed.
Diffstat (limited to 'src')
-rw-r--r--src/livestreamer/plugins/justintv.py15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/livestreamer/plugins/justintv.py b/src/livestreamer/plugins/justintv.py
index 5fc7cc5..32348d2 100644
--- a/src/livestreamer/plugins/justintv.py
+++ b/src/livestreamer/plugins/justintv.py
@@ -9,8 +9,7 @@ from livestreamer import options
import xml.dom.minidom, re, sys, random
class JustinTV(Plugin):
- StreamInfoURL = "http://usher.justin.tv/find/{0}.xml?type=any&p={1}"
- StreamInfoURLSub = "http://usher.justin.tv/find/{0}.xml?type=any&p={1}&b_id=true&chansub_guid={2}&private_code=null&group=&channel_subscription={2}"
+ StreamInfoURL = "http://usher.justin.tv/find/{0}.xml?type=any&p={1}&b_id=true&chansub_guid={2}&private_code=null&group=&channel_subscription={2}"
MetadataURL = "http://www.justin.tv/meta/{0}.xml?on_site=true"
SWFURL = "http://www.justin.tv/widgets/live_embed_player.swf"
@@ -68,13 +67,13 @@ class JustinTV(Plugin):
else:
return tag
- metadata = self._get_metadata(channelname)
- randomp = int(random.random() * 999999)
+ chansub = None
+ if options.get("cookie"):
+ metadata = self._get_metadata(channelname)
+ chansub = metadata["chansub_guid"]
- if "chansub_guid" in metadata:
- url = self.StreamInfoURLSub.format(channelname, randomp, metadata["chansub_guid"])
- else:
- url = self.StreamInfoURL.format(channelname, randomp)
+ randomp = int(random.random() * 999999)
+ url = self.StreamInfoURL.format(channelname, randomp, chansub)
data = urlget(url)