diff options
author | synweap15 <shamdog+github@gmail.com> | 2014-12-30 20:21:23 +0100 |
---|---|---|
committer | synweap15 <shamdog+github@gmail.com> | 2014-12-30 20:21:23 +0100 |
commit | ac9ba34bd5e629ddfbe67dec88ff2e0653e80356 (patch) | |
tree | f77bc281bd083145b19e82bf0e5ff34f5cd6f01a /module/plugins/hoster/YourfilesTo.py | |
parent | [Oboom] new hoster and account (diff) | |
parent | Update some MultiHoster __pattern__ (diff) | |
download | pyload-ac9ba34bd5e629ddfbe67dec88ff2e0653e80356.tar.xz |
Merge pull request #1 from pyload/stable
Merge
Diffstat (limited to 'module/plugins/hoster/YourfilesTo.py')
-rw-r--r-- | module/plugins/hoster/YourfilesTo.py | 35 |
1 files changed, 23 insertions, 12 deletions
diff --git a/module/plugins/hoster/YourfilesTo.py b/module/plugins/hoster/YourfilesTo.py index c8c5c523c..83ab89110 100644 --- a/module/plugins/hoster/YourfilesTo.py +++ b/module/plugins/hoster/YourfilesTo.py @@ -1,24 +1,31 @@ # -*- coding: utf-8 -*- import re -import urllib + +from urllib import unquote + from module.plugins.Hoster import Hoster class YourfilesTo(Hoster): - __name__ = "YourfilesTo" - __type__ = "hoster" - __pattern__ = r'(http://)?(?:www\.)?yourfiles\.(to|biz)/\?d=[a-zA-Z0-9]+' + __name__ = "YourfilesTo" + __type__ = "hoster" __version__ = "0.21" + + __pattern__ = r'(http://)?(?:www\.)?yourfiles\.(to|biz)/\?d=\w+' + __description__ = """Youfiles.to hoster plugin""" - __author_name__ = ("jeix", "skydancer") - __author_mail__ = ("jeix@hasnomail.de", "skydancer@hasnomail.de") + __license__ = "GPLv3" + __authors__ = [("jeix", "jeix@hasnomail.de"), + ("skydancer", "skydancer@hasnomail.de")] + def process(self, pyfile): self.pyfile = pyfile self.prepare() self.download(self.get_file_url()) + def prepare(self): if not self.file_exists(): self.offline() @@ -27,11 +34,11 @@ class YourfilesTo(Hoster): wait_time = self.get_waiting_time() self.setWait(wait_time) - self.logDebug("%s: Waiting %d seconds." % (self.__name__, wait_time)) self.wait() + def get_waiting_time(self): - if self.html is None: + if not self.html: self.download_html() #var zzipitime = 15; @@ -43,31 +50,35 @@ class YourfilesTo(Hoster): return sec + def download_html(self): url = self.pyfile.url self.html = self.load(url) + def get_file_url(self): """ returns the absolute downloadable filepath """ url = re.search(r"var bla = '(.*?)';", self.html) if url: url = url.group(1) - url = urllib.unquote(url.replace("http://http:/http://", "http://").replace("dumdidum", "")) + url = unquote(url.replace("http://http:/http://", "http://").replace("dumdidum", "")) return url else: - self.fail("absolute filepath could not be found. offline? ") + self.error(_("Absolute filepath not found")) + def get_file_name(self): - if self.html is None: + if not self.html: self.download_html() return re.search("<title>(.*)</title>", self.html).group(1) + def file_exists(self): """ returns True or False """ - if self.html is None: + if not self.html: self.download_html() if re.search(r"HTTP Status 404", self.html) is not None: |