diff options
author | Stefano <l.stickell@yahoo.it> | 2013-07-22 20:50:34 +0200 |
---|---|---|
committer | Stefano <l.stickell@yahoo.it> | 2013-07-22 20:50:34 +0200 |
commit | 2edeee0532ec6d6b4b26fd045a5971f67ca455da (patch) | |
tree | 8d656afc9c18f7dba7c05d6635f898fdf58d66d6 /module/plugins/hoster/StreamCz.py | |
parent | Fixed PEP 8 violations in Crypters (diff) | |
download | pyload-2edeee0532ec6d6b4b26fd045a5971f67ca455da.tar.xz |
Fixed PEP 8 violations in Hosters
Diffstat (limited to 'module/plugins/hoster/StreamCz.py')
-rw-r--r-- | module/plugins/hoster/StreamCz.py | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/module/plugins/hoster/StreamCz.py b/module/plugins/hoster/StreamCz.py index ca1033502..a575b205e 100644 --- a/module/plugins/hoster/StreamCz.py +++ b/module/plugins/hoster/StreamCz.py @@ -20,19 +20,21 @@ import re from module.plugins.Hoster import Hoster from module.network.RequestFactory import getURL + def getInfo(urls): result = [] - + for url in urls: - + html = getURL(url) if re.search(StreamCz.FILE_OFFLINE_PATTERN, html): # File offline result.append((url, 0, 1, url)) else: - result.append((url, 0, 2, url)) + result.append((url, 0, 2, url)) yield result - + + class StreamCz(Hoster): __name__ = "StreamCz" __type__ = "hoster" @@ -40,7 +42,7 @@ class StreamCz(Hoster): __version__ = "0.1" __description__ = """stream.cz""" __author_name__ = ("zoidberg") - + FILE_OFFLINE_PATTERN = r'<h1 class="commonTitle">Str.nku nebylo mo.n. nal.zt \(404\)</h1>' FILE_NAME_PATTERN = r'<link rel="video_src" href="http://www.stream.cz/\w+/(\d+)-([^"]+)" />' CDN_PATTERN = r'<param name="flashvars" value="[^"]*&id=(?P<ID>\d+)(?:&cdnLQ=(?P<cdnLQ>\d*))?(?:&cdnHQ=(?P<cdnHQ>\d*))?(?:&cdnHD=(?P<cdnHD>\d*))?&' @@ -49,28 +51,30 @@ class StreamCz(Hoster): self.multiDL = True self.resumeDownload = True - def process(self, pyfile): - + def process(self, pyfile): + self.html = self.load(pyfile.url, decode=True) - - if re.search(self.FILE_OFFLINE_PATTERN, self.html): + + if re.search(self.FILE_OFFLINE_PATTERN, self.html): self.offline() - + found = re.search(self.CDN_PATTERN, self.html) - if found is None: self.fail("Parse error (CDN)") + if found is None: + self.fail("Parse error (CDN)") cdn = found.groupdict() self.logDebug(cdn) for cdnkey in ("cdnHD", "cdnHQ", "cdnLQ"): - if cdn.has_key(cdnkey) and cdn[cdnkey] > '': + if cdnkey in cdn and cdn[cdnkey] > '': cdnid = cdn[cdnkey] break - else: + else: self.fail("Stream URL not found") - + found = re.search(self.FILE_NAME_PATTERN, self.html) - if found is None: self.fail("Parse error (NAME)") + if found is None: + self.fail("Parse error (NAME)") pyfile.name = "%s-%s.%s.mp4" % (found.group(2), found.group(1), cdnkey[-2:]) - + download_url = "http://cdn-dispatcher.stream.cz/?id=" + cdnid self.logInfo("STREAM (%s): %s" % (cdnkey[-2:], download_url)) self.download(download_url) |