diff options
-rw-r--r-- | module/plugins/hoster/DepositfilesCom.py | 28 | ||||
-rw-r--r-- | module/plugins/hoster/MegauploadCom.py | 29 | ||||
-rw-r--r-- | module/plugins/hoster/ZippyshareCom.py | 29 |
3 files changed, 58 insertions, 28 deletions
diff --git a/module/plugins/hoster/DepositfilesCom.py b/module/plugins/hoster/DepositfilesCom.py index f4ccf45c8..45ba42544 100644 --- a/module/plugins/hoster/DepositfilesCom.py +++ b/module/plugins/hoster/DepositfilesCom.py @@ -14,12 +14,30 @@ class DepositfilesCom(Hoster): __author_name__ = ("spoob") __author_mail__ = ("spoob@pyload.org") - def __init__(self, parent): - Hoster.__init__(self, parent) - self.parent = parent - self.html = None - self.multi_dl = False + def setup(self): + self.multiDL = False + + def process(self, pyfile): + self.pyfile = pyfile + self.prepare() + pyfile.name = self.get_file_name() + self.download(self.get_file_url()) + def prepare(self): + self.html = self.load(self.pyfile.url) + if re.search(r'File is checked, please try again in a minute.', self.html) != None: + self.log.info("DepositFiles.com: The file is being checked. Waiting 1 minute.") + self.setWait(61) + self.wait() + + if re.search(r'Such file does not exist or it has been removed for infringement of copyrights', self.html) != None: + self.offline() + + self.html = self.load(self.pyfile.url, post={"gateway_result":"1"}) + wait_time = int(re.search(r'<span id="download_waiter_remain">(.*?)</span>', self.html).group(1)) + self.setWait(wait_time) + self.log.debug("DepositFiles.com: Waiting %d seconds." % wait_time) + def get_file_url(self): return urllib.unquote(re.search('<form action="(http://.+?\.depositfiles.com/.+?)" method="get"', self.html).group(1)) diff --git a/module/plugins/hoster/MegauploadCom.py b/module/plugins/hoster/MegauploadCom.py index a3c64c124..06a25f44b 100644 --- a/module/plugins/hoster/MegauploadCom.py +++ b/module/plugins/hoster/MegauploadCom.py @@ -17,33 +17,38 @@ class MegauploadCom(Hoster): __author_name__ = ("spoob") __author_mail__ = ("spoob@pyload.org") - def __init__(self, parent): - Hoster.__init__(self, parent) - self.parent = parent - self.time_plus_wait = None + def setup(self): self.html = [None, None] - self.init_ocr() - self.multi_dl = False + self.multiDL = False + + def process(self, pyfile): + self.pyfile = pyfile + self.download_html() + if not self.file_exists(): + self.offline() + + self.setWait(45) + self.wait() + + pyfile.name = self.get_file_name() + self.download(self.get_file_url()) def download_html(self): captcha_image = tempfile.NamedTemporaryFile(suffix=".gif").name for i in range(5): - self.html[0] = self.load(self.parent.url) + self.html[0] = self.load(self.pyfile.url) try: url_captcha_html = re.search('(http://www.{,3}\.megaupload\.com/gencap.php\?.*\.gif)', self.html[0]).group(1) except: continue self.pyfile.status.waituntil = time() + 10 - self.req.download(url_captcha_html, captcha_image) - captcha = self.ocr.get_captcha(captcha_image) - os.remove(captcha_image) + captcha = self.decryptCaptcha(url_captcha_html) captchacode = re.search('name="captchacode" value="(.*)"', self.html[0]).group(1) megavar = re.search('name="megavar" value="(.*)">', self.html[0]).group(1) - self.html[1] = self.load(self.parent.url, post={"captcha": captcha, "captchacode": captchacode, "megavar": megavar}) + self.html[1] = self.load(self.pyfile.url, post={"captcha": captcha, "captchacode": captchacode, "megavar": megavar}) if re.search(r"Waiting time before each download begins", self.html[1]) != None: break - self.time_plus_wait = time() + 45 def get_file_url(self): file_url_pattern = 'id="downloadlink"><a href="(.*)" onclick="' diff --git a/module/plugins/hoster/ZippyshareCom.py b/module/plugins/hoster/ZippyshareCom.py index fb2702ee7..3740f8c14 100644 --- a/module/plugins/hoster/ZippyshareCom.py +++ b/module/plugins/hoster/ZippyshareCom.py @@ -9,20 +9,27 @@ class ZippyshareCom(Hoster): __name__ = "ZippyshareCom" __type__ = "hoster" __pattern__ = r"(http://)?www?\d{0,2}\.zippyshare.com/v/" - __version__ = "0.1" + __version__ = "0.2" __description__ = """Zippyshare.com Download Hoster""" __author_name__ = ("spoob") __author_mail__ = ("spoob@pyload.org") - def __init__(self, parent): - Hoster.__init__(self, parent) - self.parent = parent + def setup(self): self.html = None - self.want_reconnect = False - self.multi_dl = False + self.wantReconnect = False + self.multiDL = False + + def process(self, pyfile): + self.pyfile = pyfile + self.download_html() + if not self.file_exists(): + self.offline() + + pyfile.name = self.get_file_name() + self.download(self.get_file_url()) def download_html(self): - url = self.parent.url + url = self.pyfile.url self.html = self.load(url, cookies=True) def get_file_url(self): @@ -36,18 +43,18 @@ class ZippyshareCom(Hoster): def get_file_name(self): if self.html == None: self.download_html() - if not self.want_reconnect: - file_name = re.search("<strong>Name: </strong>(.+?)</font>", self.html).group(1) + if not self.wantReconnect: + file_name = re.search(r'Name: </font> <font.*>(.*?)</font>', self.html).group(1) return file_name else: - return self.parent.url + return self.pyfile.url def file_exists(self): """ returns True or False """ if self.html == None: self.download_html() - if re.search(r"HTTP Status 404", self.html) != None: + if re.search(r'File does not exist on this server', self.html) != None: return False else: return True |