diff options
author | GamaC0de <nitzo2001@yahoo.com> | 2016-05-09 11:42:33 +0200 |
---|---|---|
committer | GamaC0de <nitzo2001@yahoo.com> | 2016-05-09 11:42:33 +0200 |
commit | 09fdf0cba20578359ae381b20452504faac32e3b (patch) | |
tree | c46a2e872870d18fcda2ee63b0ceecdcccb15ac5 /module | |
parent | Merge pull request #2448 from OndrejIT/stable (diff) | |
download | pyload-09fdf0cba20578359ae381b20452504faac32e3b.tar.xz |
[StreamCz] Update
Diffstat (limited to 'module')
-rw-r--r-- | module/plugins/hoster/StreamCz.py | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/module/plugins/hoster/StreamCz.py b/module/plugins/hoster/StreamCz.py index 8e89d2109..10c5f5067 100644 --- a/module/plugins/hoster/StreamCz.py +++ b/module/plugins/hoster/StreamCz.py @@ -1,51 +1,51 @@ # -*- coding: utf-8 -*- import os -import re import time -import json import hashlib -from urlparse import urljoin +import urlparse +from module.plugins.internal.misc import json from module.plugins.internal.SimpleHoster import SimpleHoster def get_api_password(episode): - episode = "/episode/" + str(episode) api_key = "fb5f58a820353bd7095de526253c14fd" timestamp = int(round(time.time() * 1000 / 1e3 / 24 / 3600)) - api_pass = api_key + episode + str(timestamp) + api_pass = api_key + "/episode/" + episode + str(timestamp) m = hashlib.md5() m.update(api_pass) return m.hexdigest() + def get_all_link(data, container): videos = [] + for i in range(0, len(data["video_qualities"])): if len(data["video_qualities"][i]["formats"][1]) and container == "webm": - videos.append( - data["video_qualities"][i]["formats"][1]["source"], - ) + videos.append(data["video_qualities"][i]["formats"][1]["source"]) + else: - videos.append( - data["video_qualities"][i]["formats"][0]["source"], - ) + videos.append(data["video_qualities"][i]["formats"][0]["source"]) return videos + def get_link_quality(videos, quality): quality_index = ["240p", "360p", "480p", "720p", "1080p"] quality = quality_index.index(quality) + link = None while quality >= 0: if len(videos) >= quality + 1: link = videos[quality] break + else: - quality -= 1 + quality -= 1 return link @@ -53,10 +53,10 @@ def get_link_quality(videos, quality): class StreamCz(SimpleHoster): __name__ = "StreamCz" __type__ = "hoster" - __version__ = "0.35" + __version__ = "0.36" __status__ = "testing" - __pattern__ = r'https?://(?:www\.)?stream\.cz/[^/]+/(\d+).+' + __pattern__ = r'https?://(?:www\.)?stream\.cz/[^/]+/(?P<EP>\d+).+' __config__ = [("activated", "bool", "Activated", True), ("quality", "240p;360p;480p;720p;1080p", "Quality", "720p"), ("container", "mp4;webm", "Container", "mp4"),] @@ -70,10 +70,10 @@ class StreamCz(SimpleHoster): self.multiDL = True def process(self, pyfile): - episode = re.search(self.__pattern__, pyfile.url).group(1) + episode = self.info['pattern']['EP'] api_password = get_api_password(episode) - api_url = urljoin("https://www.stream.cz/API/episode/", str(episode)) + api_url = urlparse.urljoin("https://www.stream.cz/API/episode/", episode) self.req.putHeader("Api-Password", api_password) resp = self.load(api_url) @@ -85,8 +85,8 @@ class StreamCz(SimpleHoster): videos = get_all_link(data, container) link = get_link_quality(videos, quality) - link_name, container = os.path.splitext(link) - self.pyfile.name = data["name"] + container + if link: + link_name, container = os.path.splitext(link) + self.pyfile.name = data["name"] + container - self.log_info(_("Downloading file...")) - self.download(link) + self.link = link |