diff --git a/src/livestreamer/plugins/livecodingtv.py b/src/livestreamer/plugins/livecodingtv.py index 03a5d5ca..26b9a3e3 100644 --- a/src/livestreamer/plugins/livecodingtv.py +++ b/src/livestreamer/plugins/livecodingtv.py @@ -1,12 +1,12 @@ import re - from livestreamer.plugin import Plugin -from livestreamer.stream import RTMPStream +from livestreamer.stream import RTMPStream, HTTPStream from livestreamer.plugin.api import http +_vod_re = re.compile('\"(http(s)?://.*\.mp4\?t=.*)\"') _rtmp_re = re.compile('rtmp://[^"]+/(?P\w+)+[^/"]+') -_url_re = re.compile("http(s)?://(?:\w+.)?\livecoding\.tv") +_url_re = re.compile('http(s)?://(?:\w+.)?\livecoding\.tv') class LivecodingTV(Plugin): @@ -16,19 +16,18 @@ def can_handle_url(cls, url): def _get_streams(self): res = http.get(self.url) - match = _rtmp_re.search(res.text) - rtmp_url = match.group(0) - - if not match: + match = _rtmp_re.search(res.content) + if match: + params = { + "rtmp": match.group(0), + "pageUrl": self.url, + "live": True, + } + yield 'live', RTMPStream(self.session, params) return - stream = RTMPStream(self.session, { - "rtmp": rtmp_url, - "pageUrl": self.url, - "live": True, - }) - - return dict(live=stream) - + match = _vod_re.search(res.content) + if match: + yield 'vod', HTTPStream(self.session, match.group(1)) __plugin__ = LivecodingTV