# -*- coding: utf-8 -*- import re from module.network.RequestFactory import getURL from module.plugins.Hoster import Hoster def getInfo(urls): result = [] for url in urls: html = getURL(url) if re.search(StreamCz.OFFLINE_PATTERN, html): # File offline result.append((url, 0, 1, url)) else: result.append((url, 0, 2, url)) yield result class StreamCz(Hoster): __name__ = "StreamCz" __type__ = "hoster" __version__ = "0.20" __pattern__ = r'https?://(?:www\.)?stream\.cz/[^/]+/\d+.*' __description__ = """Stream.cz hoster plugin""" __license__ = "GPLv3" __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] NAME_PATTERN = r'' OFFLINE_PATTERN = r'

Str.nku nebylo mo.n. nal.zt \(404\)

' CDN_PATTERN = r'\d+)(?:&cdnLQ=(?P\d*))?(?:&cdnHQ=(?P\d*))?(?:&cdnHD=(?P\d*))?&' def setup(self): self.resumeDownload = True self.multiDL = True def process(self, pyfile): self.html = self.load(pyfile.url, decode=True) if re.search(self.OFFLINE_PATTERN, self.html): self.offline() m = re.search(self.CDN_PATTERN, self.html) if m is None: self.error(_("CDN_PATTERN not found")) cdn = m.groupdict() self.logDebug(cdn) for cdnkey in ("cdnHD", "cdnHQ", "cdnLQ"): if cdnkey in cdn and cdn[cdnkey] > '': cdnid = cdn[cdnkey] break else: self.fail(_("Stream URL not found")) m = re.search(self.NAME_PATTERN, self.html) if m is None: self.error(_("NAME_PATTERN not found")) pyfile.name = "%s-%s.%s.mp4" % (m.group(2), m.group(1), cdnkey[-2:]) download_url = "http://cdn-dispatcher.stream.cz/?id=" + cdnid self.logInfo(_("STREAM: %s") % cdnkey[-2:], download_url) self.download(download_url)