diff options
author | zoidberg10 <zoidberg@mujmail.cz> | 2012-11-09 23:14:33 +0100 |
---|---|---|
committer | zoidberg10 <zoidberg@mujmail.cz> | 2012-11-09 23:14:33 +0100 |
commit | 7e1d66ad5fdc3908e20d532d98ac819dd3437fe1 (patch) | |
tree | cc5504dbf49bf7345bd8cd3706033b155eff6ab2 /module | |
parent | share76.com plugin by R2D2 C3PO - closed #710 (diff) | |
download | pyload-7e1d66ad5fdc3908e20d532d98ac819dd3437fe1.tar.xz |
update XFileSharingPro & add billionuploads,sendmyway,sharebees plugins
Diffstat (limited to 'module')
-rw-r--r-- | module/plugins/hoster/BillionuploadsCom.py | 17 | ||||
-rw-r--r-- | module/plugins/hoster/SendmywayCom.py | 18 | ||||
-rw-r--r-- | module/plugins/hoster/SharebeesCom.py | 19 | ||||
-rw-r--r-- | module/plugins/hoster/XFileSharingPro.py | 139 |
4 files changed, 132 insertions, 61 deletions
diff --git a/module/plugins/hoster/BillionuploadsCom.py b/module/plugins/hoster/BillionuploadsCom.py new file mode 100644 index 000000000..5b053d547 --- /dev/null +++ b/module/plugins/hoster/BillionuploadsCom.py @@ -0,0 +1,17 @@ +# -*- coding: utf-8 -*- +from module.plugins.hoster.XFileSharingPro import XFileSharingPro, create_getInfo + +class BillionuploadsCom(XFileSharingPro): + __name__ = "BillionuploadsCom" + __type__ = "hoster" + __pattern__ = r"http://(?:\w*\.)*?billionuploads.com/\w{12}" + __version__ = "0.01" + __description__ = """billionuploads.com hoster plugin""" + __author_name__ = ("zoidberg") + __author_mail__ = ("zoidberg@mujmail.cz") + + FILE_NAME_PATTERN = r'<b>Filename:</b>(?P<N>.*?)<br>' + FILE_SIZE_PATTERN = r'<b>Size:</b>(?P<S>.*?)<br>' + HOSTER_NAME = "billionuploads.com" + +getInfo = create_getInfo(BillionuploadsCom) diff --git a/module/plugins/hoster/SendmywayCom.py b/module/plugins/hoster/SendmywayCom.py new file mode 100644 index 000000000..fcbac850a --- /dev/null +++ b/module/plugins/hoster/SendmywayCom.py @@ -0,0 +1,18 @@ +# -*- coding: utf-8 -*- +from module.plugins.hoster.XFileSharingPro import XFileSharingPro, create_getInfo + + +class SendmywayCom(XFileSharingPro): + __name__ = "SendmywayCom" + __type__ = "hoster" + __pattern__ = r"http://(?:\w*\.)*?sendmyway.com/\w{12}" + __version__ = "0.01" + __description__ = """SendMyWay hoster plugin""" + __author_name__ = ("zoidberg") + __author_mail__ = ("zoidberg@mujmail.cz") + + FILE_NAME_PATTERN = r'<p class="file-name" ><.*?>\s*(?P<N>.+)' + FILE_SIZE_PATTERN = r'<small>\((?P<S>\d+) bytes\)</small>' + HOSTER_NAME = "sendmyway.com" + +getInfo = create_getInfo(SendmywayCom) diff --git a/module/plugins/hoster/SharebeesCom.py b/module/plugins/hoster/SharebeesCom.py new file mode 100644 index 000000000..f5bacc5b0 --- /dev/null +++ b/module/plugins/hoster/SharebeesCom.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +from module.plugins.hoster.XFileSharingPro import XFileSharingPro, create_getInfo + + +class SharebeesCom(XFileSharingPro): + __name__ = "SharebeesCom" + __type__ = "hoster" + __pattern__ = r"http://(?:\w*\.)*?sharebees.com/\w{12}" + __version__ = "0.01" + __description__ = """ShareBees hoster plugin""" + __author_name__ = ("zoidberg") + __author_mail__ = ("zoidberg@mujmail.cz") + + FILE_NAME_PATTERN = r'<p class="file-name" ><.*?>\s*(?P<N>.+)' + FILE_SIZE_PATTERN = r'<small>\((?P<S>\d+) bytes\)</small>' + FORM_PATTERN = 'F1' + HOSTER_NAME = "sharebees.com" + +getInfo = create_getInfo(SharebeesCom) diff --git a/module/plugins/hoster/XFileSharingPro.py b/module/plugins/hoster/XFileSharingPro.py index 713198754..d58a7073e 100644 --- a/module/plugins/hoster/XFileSharingPro.py +++ b/module/plugins/hoster/XFileSharingPro.py @@ -3,7 +3,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, - or (at your option) any later version. + or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -34,7 +34,7 @@ class XFileSharingPro(SimpleHoster): __name__ = "XFileSharingPro" __type__ = "hoster" __pattern__ = r"^unmatchable$" - __version__ = "0.13" + __version__ = "0.14" __description__ = """XFileSharingPro common hoster base""" __author_name__ = ("zoidberg") __author_mail__ = ("zoidberg@mujmail.cz") @@ -52,21 +52,18 @@ class XFileSharingPro(SimpleHoster): RECAPTCHA_URL_PATTERN = r'http://[^"\']+?recaptcha[^"\']+?\?k=([^"\']+)"' CAPTCHA_DIV_PATTERN = r'<b>Enter code.*?<div.*?>(.*?)</div>' ERROR_PATTERN = r'class=["\']err["\'][^>]*>(.*?)</' - FORM_PATTERN = 'F1' - + def setup(self): - self.__pattern__ = self.core.pluginManager.hosterPlugins[self.__name__]['pattern'] - self.multiDL = True - self.chunkLimit = 1 + if self.__name__ == "XFileSharingPro": + self.__pattern__ = self.core.pluginManager.hosterPlugins[self.__name__]['pattern'] + self.multiDL = True + else: + self.resumeDownload = self.multiDL = self.premium + + self.chunkLimit = 1 def process(self, pyfile): - if not hasattr(self, "HOSTER_NAME"): - self.HOSTER_NAME = re.search(self.__pattern__, self.pyfile.url).group(1) - if not hasattr(self, "DIRECT_LINK_PATTERN"): - self.DIRECT_LINK_PATTERN = r'(http://(\w+\.%s|\d+\.\d+\.\d+\.\d+)(:\d+/d/|/files/\d+/\w+/)[^"\'<]+)' % self.HOSTER_NAME - - self.captcha = self.errmsg = None - self.passwords = self.getPassword().splitlines() + self.prepare() if not re.match(self.__pattern__, self.pyfile.url): if self.premium: @@ -79,58 +76,74 @@ class XFileSharingPro(SimpleHoster): self.file_info = self.getFileInfo() except PluginParseError: self.file_info = None - - self.req.http.lastURL = self.pyfile.url - - self.req.http.c.setopt(FOLLOWLOCATION, 0) - self.html = self.load(self.pyfile.url, cookies = True, decode = True) - self.header = self.req.http.header - self.req.http.c.setopt(FOLLOWLOCATION, 1) - self.location = None - found = re.search("Location\s*:\s*(.*)", self.header, re.I) - if found and re.match(self.DIRECT_LINK_PATTERN, found.group(1)): - self.location = found.group(1).strip() - + self.location = self.getDirectDownloadLink() + if not self.file_info: pyfile.name = html_unescape(unquote(urlparse(self.location if self.location else pyfile.url).path.split("/")[-1])) - - if self.location: + + if self.location: self.startDownload(self.location) elif self.premium: self.handlePremium() else: self.handleFree() + def prepare(self): + """ Initialize important variables """ + if not hasattr(self, "HOSTER_NAME"): + self.HOSTER_NAME = re.search(self.__pattern__, self.pyfile.url).group(1) + if not hasattr(self, "DIRECT_LINK_PATTERN"): + self.DIRECT_LINK_PATTERN = r'(http://(\w+\.%s|\d+\.\d+\.\d+\.\d+)(:\d+/d/|/files/\d+/\w+/)[^"\'<]+)' % self.HOSTER_NAME + + self.captcha = self.errmsg = None + self.passwords = self.getPassword().splitlines() + + def getDirectDownloadLink(self): + """ Get download link for premium users with direct download enabled """ + self.req.http.lastURL = self.pyfile.url + + self.req.http.c.setopt(FOLLOWLOCATION, 0) + self.html = self.load(self.pyfile.url, cookies = True, decode = True) + self.header = self.req.http.header + self.req.http.c.setopt(FOLLOWLOCATION, 1) + + location = None + found = re.search("Location\s*:\s*(.*)", self.header, re.I) + if found and re.match(self.DIRECT_LINK_PATTERN, found.group(1)): + location = found.group(1).strip() + + return location + def handleFree(self): url = self.getDownloadLink() self.logDebug("Download URL: %s" % url) self.startDownload(url) - + def getDownloadLink(self): for i in range(5): self.logDebug("Getting download link: #%d" % i) data = self.getPostParameters() - + self.req.http.c.setopt(FOLLOWLOCATION, 0) self.html = self.load(self.pyfile.url, post = data, ref = True, decode = True) self.header = self.req.http.header - self.req.http.c.setopt(FOLLOWLOCATION, 1) - + self.req.http.c.setopt(FOLLOWLOCATION, 1) + found = re.search("Location\s*:\s*(.*)", self.header, re.I) - if found: + if found: break - + found = re.search(self.DIRECT_LINK_PATTERN, self.html, re.S) - if found: - break + if found: + break else: - if self.errmsg and 'captcha' in self.errmsg: + if self.errmsg and 'captcha' in self.errmsg: self.fail("No valid captcha code entered") else: self.fail("Download link not found") - + return found.group(1) def handlePremium(self): @@ -138,7 +151,7 @@ class XFileSharingPro(SimpleHoster): found = re.search(self.DIRECT_LINK_PATTERN, self.html) if not found: self.parseError('DIRECT LINK') self.startDownload(found.group(1)) - + def handleOverriden(self): #only tested with easybytez.com self.html = self.load("http://www.%s/" % self.HOSTER_NAME) @@ -154,7 +167,7 @@ class XFileSharingPro(SimpleHoster): self.req.http.c.setopt(LOW_SPEED_TIME, 600) self.html = self.load(action, post = inputs) - action, inputs = self.parseHtmlForm(self.FORM_PATTERN) + action, inputs = self.parseHtmlForm('F1') if not inputs: self.parseError('TEXTAREA') self.logDebug(self.HOSTER_NAME, inputs) if inputs['st'] == 'OK': @@ -162,8 +175,8 @@ class XFileSharingPro(SimpleHoster): elif inputs['st'] == 'Can not leech file': self.retry(max_tries=20, wait_time=180, reason=inputs['st']) else: - self.fail(inputs['st']) - + self.fail(inputs['st']) + #get easybytez.com link for uploaded file found = re.search(self.OVR_DOWNLOAD_LINK_PATTERN, self.html) if not found: self.parseError('DIRECT LINK (OVR)') @@ -201,49 +214,53 @@ class XFileSharingPro(SimpleHoster): self.fail("File too large for free download") else: self.fail(self.errmsg) - + else: self.errmsg = None - + return self.errmsg def getPostParameters(self): for i in range(3): if not self.errmsg: self.checkErrors() - action, inputs = self.parseHtmlForm(input_names={"op": re.compile("^download")}) - if not inputs: + if hasattr(self,"FORM_PATTERN"): action, inputs = self.parseHtmlForm(self.FORM_PATTERN) - if not inputs: + else: + action, inputs = self.parseHtmlForm(input_names={"op": re.compile("^download")}) + + if not inputs: + action, inputs = self.parseHtmlForm('F1') + if not inputs: if self.errmsg: self.retry() else: self.parseError("Form not found") - + self.logDebug(self.HOSTER_NAME, inputs) - - if 'op' in inputs and inputs['op'] in ('download2', 'download3'): + + if 'op' in inputs and inputs['op'] in ('download2', 'download3'): if "password" in inputs: if self.passwords: inputs['password'] = self.passwords.pop(0) else: self.fail("No or invalid passport") - - if not self.premium: + + if not self.premium: found = re.search(self.WAIT_PATTERN, self.html) if found: wait_time = int(found.group(1)) + 1 self.setWait(wait_time, False) else: wait_time = 0 - + self.captcha = self.handleCaptcha(inputs) if wait_time: self.wait() - + self.errmsg = None return inputs - + else: inputs['referer'] = self.pyfile.url @@ -258,7 +275,7 @@ class XFileSharingPro(SimpleHoster): self.errmsg = None else: self.parseError('FORM: %s' % (inputs['op'] if 'op' in inputs else 'UNKNOWN')) - + def handleCaptcha(self, inputs): found = re.search(self.RECAPTCHA_URL_PATTERN, self.html) if found: @@ -274,14 +291,14 @@ class XFileSharingPro(SimpleHoster): inputs['code'] = self.decryptCaptcha(captcha_url) return 2 else: - found = re.search(self.CAPTCHA_DIV_PATTERN, self.html, re.S) + found = re.search(self.CAPTCHA_DIV_PATTERN, self.html, re.S) if found: captcha_div = found.group(1) - self.logDebug(captcha_div) + self.logDebug(captcha_div) numerals = re.findall('<span.*?padding-left\s*:\s*(\d+).*?>(\d)</span>', html_unescape(captcha_div)) inputs['code'] = "".join([a[1] for a in sorted(numerals, key = lambda num: int(num[0]))]) - self.logDebug("CAPTCHA", inputs['code'], numerals) - return 3 + self.logDebug("CAPTCHA", inputs['code'], numerals) + return 3 return 0 - + getInfo = create_getInfo(XFileSharingPro)
\ No newline at end of file |