Skip to content

Commit

Permalink
Add Plugin for YYcast.com
Browse files Browse the repository at this point in the history
  • Loading branch information
Athanasios Oikonomou authored and chrippa committed Dec 1, 2012
1 parent 1431f68 commit 44b3c78
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions src/livestreamer/plugins/yycast.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
from livestreamer.stream import RTMPStream
from livestreamer.plugins import Plugin, PluginError, NoStreamsError
from livestreamer.utils import urlget

import re

class YYCast(Plugin):
SWFURL = "http://cdn.yycast.com/player/player.swf"

@classmethod
def can_handle_url(self, url):
return "yycast.com" in url

def _get_streams(self):
playpath = self.url.rstrip("/").rpartition("/")[2].lower()

self.logger.debug("Fetching stream info")
res = urlget(self.url)

match = re.search("'streamer':\s+'(.+?)'", res.text)
if not match:
raise NoStreamsError(self.url)

rtmp = match.group(1)

streams = {}

streams["live"] = RTMPStream(self.session, {
"rtmp": rtmp,
"pageUrl": self.url,
"swfVfy": self.SWFURL,
"playpath" : playpath,
"live": True
}, redirect=True)

return streams


__plugin__ = YYCast

0 comments on commit 44b3c78

Please sign in to comment.