Closed athoik closed 11 years ago
Dear @chrippa,
I just wrote a plugin for mips.tv
from livestreamer.stream import RTMPStream from livestreamer.plugins import Plugin, PluginError, NoStreamsError from livestreamer.utils import urlget import re class Mips(Plugin): SWFURL = "http://mips.tv/content/scripts/eplayer.swf" PlayerURL = "http://mips.tv/embedplayer/{0}/1/500/400" BalancerURL = "http://www.mips.tv:1935/loadbalancer" @classmethod def can_handle_url(self, url): return "mips.tv" in url def _get_streams(self): channelname = self.url.rstrip("/").rpartition("/")[2].lower() self.logger.debug("Fetching stream info") headers = { "Referer": self.url } res = urlget(self.PlayerURL.format(channelname), headers=headers) match = re.search("'FlashVars', '(id=\d+)&", res.text) if not match: raise NoStreamsError(self.url) channelname += "?" + match.group(1) res = urlget(self.BalancerURL, headers=headers) match = re.search("redirect=(.+)", res.text) if not match: raise NoStreamsError(self.url) rtmp = match.group(1) streams = {} streams["live"] = RTMPStream(self.session, { "rtmp": "rtmp://{0}/live/{1}".format(rtmp, channelname), "pageUrl": self.url, "swfVfy": self.SWFURL, "live": True }) return streams __plugin__ = Mips
Are there any improvements before push the plugin?
Thanks
Test URL's found from here: http://livetvstreaming.ucoz.com/news/al_jazeera_sport/2012-09-02-1837 http://mips.tv/aflam4you1 http://mips.tv/aflam4you4
This looks good except that the exception when not finding the RTMP URL should probably be a PluginError with a message instead.
Dear @chrippa,
I just wrote a plugin for mips.tv
Are there any improvements before push the plugin?
Thanks