diff options
Diffstat (limited to 'module/plugins/hoster')
-rw-r--r-- | module/plugins/hoster/CzshareCom.py | 5 | ||||
-rw-r--r-- | module/plugins/hoster/EuroshareEu.py | 48 | ||||
-rw-r--r-- | module/plugins/hoster/NovafileCom.py | 24 | ||||
-rw-r--r-- | module/plugins/hoster/RapidgatorNet.py | 81 | ||||
-rw-r--r-- | module/plugins/hoster/XFileSharingPro.py | 11 |
5 files changed, 86 insertions, 83 deletions
diff --git a/module/plugins/hoster/CzshareCom.py b/module/plugins/hoster/CzshareCom.py index 356771ce4..8d035b64c 100644 --- a/module/plugins/hoster/CzshareCom.py +++ b/module/plugins/hoster/CzshareCom.py @@ -45,7 +45,7 @@ class CzshareCom(SimpleHoster): __name__ = "CzshareCom" __type__ = "hoster" __pattern__ = r"http://(\w*\.)*czshare\.(com|cz)/(\d+/|download.php\?).*" - __version__ = "0.89" + __version__ = "0.90" __description__ = """CZshare.com""" __author_name__ = ("zoidberg") @@ -142,6 +142,9 @@ class CzshareCom(SimpleHoster): self.html = self.load(parsed_url, cookies=True, post=inputs) + if re.search(self.MULTIDL_PATTERN, self.html): + self.waitForFreeSlot() + found = re.search("countdown_number = (\d+);", self.html) self.setWait(int(found.group(1)) if found else 50) diff --git a/module/plugins/hoster/EuroshareEu.py b/module/plugins/hoster/EuroshareEu.py index a0bfe0ab2..2c356f02a 100644 --- a/module/plugins/hoster/EuroshareEu.py +++ b/module/plugins/hoster/EuroshareEu.py @@ -17,51 +17,31 @@ """ import re -from module.plugins.Hoster import Hoster -from module.network.RequestFactory import getURL +from module.plugins.internal.SimpleHoster import SimpleHoster -def getInfo(urls): - result = [] - - for url in urls: - - html = getURL(url, decode=True) - if re.search(EuroshareEu.FILE_OFFLINE_PATTERN, html): - # File offline - result.append((url, 0, 1, url)) - else: - result.append((url, 0, 2, url)) - yield result - -class EuroshareEu(Hoster): +class EuroshareEu(SimpleHoster): __name__ = "EuroshareEu" __type__ = "hoster" - __pattern__ = r"http://(\w*\.)?euroshare.eu/file/.*" - __version__ = "0.2b" + __pattern__ = r"http://(\w*\.)?euroshare.(eu|sk|cz|hu|pl)/file/.*" + __version__ = "0.21" __description__ = """Euroshare.eu""" __author_name__ = ("zoidberg") - URL_PATTERN = r'<a class="free" href="([^"]+)"></a>' - FILE_OFFLINE_PATTERN = r'<h2>S.bor sa nena.iel</h2>' - ERR_PARDL_PATTERN = r'<h2>Prebieha s.ahovanie</h2>' - - def setup(self): - self.multiDL = False - - def process(self, pyfile): - self.html = self.load(pyfile.url, decode=True) - - if re.search(self.FILE_OFFLINE_PATTERN, self.html) is not None: - self.offline() + FILE_INFO_PATTERN = r'<span style="float: left;"><strong>(?P<N>.+?)</strong> \((?P<S>.+?)\)</span>' + FILE_OFFLINE_PATTERN = ur'<h2>S.bor sa nena.iel</h2>|Požadovaná stránka neexistuje!' + + FREE_URL_PATTERN = r'<a href="(/file/\d+/[^/]*/download/)"><div class="downloadButton"' + ERR_PARDL_PATTERN = r'<h2>Prebieha s.ahovanie</h2>' + def handleFree(self): if re.search(self.ERR_PARDL_PATTERN, self.html) is not None: self.waitForFreeSlot() - found = re.search(self.URL_PATTERN, self.html) + found = re.search(self.FREE_URL_PATTERN, self.html) if found is None: - self.fail("Parse error (URL)") - parsed_url = found.group(1) - + self.parseError("Parse error (URL)") + parsed_url = "http://euroshare.eu%s" % found.group(1) + self.logDebug("URL", parsed_url) self.download(parsed_url, disposition=True) def waitForFreeSlot(self): diff --git a/module/plugins/hoster/NovafileCom.py b/module/plugins/hoster/NovafileCom.py new file mode 100644 index 000000000..dfd18761c --- /dev/null +++ b/module/plugins/hoster/NovafileCom.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +from module.plugins.hoster.XFileSharingPro import XFileSharingPro, create_getInfo + +class NovafileCom(XFileSharingPro): + __name__ = "NovafileCom" + __type__ = "hoster" + __pattern__ = r"http://(?:\w*\.)*novafile\.com/\w{12}" + __version__ = "0.01" + __description__ = """novafile.com hoster plugin""" + __author_name__ = ("zoidberg") + __author_mail__ = ("zoidberg@mujmail.cz") + + FILE_SIZE_PATTERN = r'<div class="size">(?P<S>.+?)</div>' + #FILE_OFFLINE_PATTERN = '<b>"File Not Found"</b>|File has been removed due to Copyright Claim' + FORM_PATTERN = r'name="F\d+"' + ERROR_PATTERN = r'class="alert[^"]*alert-separate"[^>]*>\s*(?:<p>)?(.*?)\s*</' + DIRECT_LINK_PATTERN = r'<a href="(http://s\d+\.novafile\.com/.*?)" class="btn btn-green">Download File</a>' + + HOSTER_NAME = "novafile.com" + + def setup(self): + self.multiDL = False + +getInfo = create_getInfo(NovafileCom)
\ No newline at end of file diff --git a/module/plugins/hoster/RapidgatorNet.py b/module/plugins/hoster/RapidgatorNet.py index 678a3d707..291ba4c4b 100644 --- a/module/plugins/hoster/RapidgatorNet.py +++ b/module/plugins/hoster/RapidgatorNet.py @@ -21,55 +21,18 @@ from pycurl import HTTPHEADER from random import random from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo +from module.plugins.internal.CaptchaServices import ReCaptcha, SolveMedia, AdsCaptcha from module.common.json_layer import json_loads -from module.plugins.ReCaptcha import ReCaptcha - -class AdsCaptcha(): - def __init__(self, plugin): - self.plugin = plugin - - def challenge(self, src): - js = self.plugin.req.load(src, cookies=True) - - try: - challenge = re.search("challenge: '(.*?)',", js).group(1) - server = re.search("server: '(.*?)',", js).group(1) - except: - self.plugin.fail("adscaptcha error") - result = self.result(server,challenge) - - return challenge, result - - def result(self, server, challenge): - return self.plugin.decryptCaptcha("%sChallenge.aspx" % server, get={"cid": challenge, "dummy": random()}, cookies=True, imgtype="jpg") - -class SolveMedia(): - def __init__(self,plugin): - self.plugin = plugin - - def challenge(self, src): - html = self.plugin.req.load("http://api.solvemedia.com/papi/challenge.script?k=%s" % src, cookies=True) - try: - ckey = re.search("ckey:.*?'(.*?)',",html).group(1) - html = self.plugin.req.load("http://api.solvemedia.com/papi/_challenge.js?k=%s" % ckey, cookies=True) - challenge = re.search('"chid".*?: "(.*?)"',html).group(1) - except: - self.plugin.fail("solvmedia error") - result = self.result(challenge) - - return challenge, result - - def result(self,challenge): - return self.plugin.decryptCaptcha("http://api.solvemedia.com/papi/media?c=%s" % challenge,imgtype="gif") - class RapidgatorNet(SimpleHoster): __name__ = "RapidgatorNet" __type__ = "hoster" __pattern__ = r"http://(?:www\.)?(rapidgator.net)/file/(\d+)" - __version__ = "0.06" + __version__ = "0.08" __description__ = """rapidgator.net""" __author_name__ = ("zoidberg","chrox") + + API_URL = 'http://test.rapidgator.net/api/file' FILE_INFO_PATTERN = r'Downloading:(\s*<[^>]*>)*\s*(?P<N>.*?)(\s*<[^>]*>)*\s*File size:\s*<strong>(?P<S>.*?)</strong>' FILE_OFFLINE_PATTERN = r'<title>File not found</title>' @@ -79,6 +42,39 @@ class RapidgatorNet(SimpleHoster): RECAPTCHA_KEY_PATTERN = r'"http://api.recaptcha.net/challenge?k=(.*?)"' ADSCAPTCHA_SRC_PATTERN = r'(http://api.adscaptcha.com/Get.aspx[^"\']*)' SOLVEMEDIA_PATTERN = r'http:\/\/api\.solvemedia\.com\/papi\/challenge\.script\?k=(.*?)"' + + def process(self, pyfile): + self.pyfile = pyfile + if self.premium: + self.handlePremium() + else: + self.fail("NO FREE") + + def getAPIResponse(self, cmd): + json = self.load('%s/%s' % (self.API_URL, cmd), + get = {'sid': self.account.getAccountData(self.user).get('SID'), + 'url': self.pyfile.url}) + self.logDebug('API:%s' % cmd, json) + json = json_loads(json) + + status = json['response_status'] + if status == 200: + return json['response'] + elif status == 401: + self.account.relogin(self.user) + self.retry() + elif status == 423: + self.account.empty(self.user) + self.retry() + else: + self.fail(json['response_details']) + + def handlePremium(self): + self.api_data = self.getAPIResponse('info') + self.pyfile.name = self.api_data['filename'] + self.pyfile.size = self.api_data['size'] + url = self.getAPIResponse('download')['url'] + self.download(url) def handleFree(self): if "You can download files up to 500 MB in free mode" in self.html \ @@ -177,5 +173,4 @@ class RapidgatorNet(SimpleHoster): self.logDebug(url, response) return json_loads(response) -getInfo = create_getInfo(RapidgatorNet) - +getInfo = create_getInfo(RapidgatorNet)
\ No newline at end of file diff --git a/module/plugins/hoster/XFileSharingPro.py b/module/plugins/hoster/XFileSharingPro.py index 8e213e9bf..ef559a56f 100644 --- a/module/plugins/hoster/XFileSharingPro.py +++ b/module/plugins/hoster/XFileSharingPro.py @@ -34,7 +34,7 @@ class XFileSharingPro(SimpleHoster): __name__ = "XFileSharingPro" __type__ = "hoster" __pattern__ = r"^unmatchable$" - __version__ = "0.11" + __version__ = "0.12" __description__ = """XFileSharingPro common hoster base""" __author_name__ = ("zoidberg") __author_mail__ = ("zoidberg@mujmail.cz") @@ -51,7 +51,8 @@ class XFileSharingPro(SimpleHoster): CAPTCHA_URL_PATTERN = r'(http://[^"\']+?/captchas?/[^"\']+)' RECAPTCHA_URL_PATTERN = r'http://[^"\']+?recaptcha[^"\']+?\?k=([^"\']+)"' CAPTCHA_DIV_PATTERN = r'<b>Enter code.*?<div.*?>(.*?)</div>' - ERROR_PATTERN = r'class=["\']err["\'][^>]*>(.*?)</' + ERROR_PATTERN = r'class=["\']err["\'][^>]*>(.*?)</' + FORM_PATTERN = 'F1' def setup(self): self.__pattern__ = self.core.pluginManager.hosterPlugins[self.__name__]['pattern'] @@ -153,7 +154,7 @@ class XFileSharingPro(SimpleHoster): self.req.http.c.setopt(LOW_SPEED_TIME, 600) self.html = self.load(action, post = inputs) - action, inputs = self.parseHtmlForm('F1') + action, inputs = self.parseHtmlForm(self.FORM_PATTERN) if not inputs: self.parseError('TEXTAREA') self.logDebug(self.HOSTER_NAME, inputs) if inputs['st'] == 'OK': @@ -190,7 +191,7 @@ class XFileSharingPro(SimpleHoster): self.retry(25) elif 'captcha' in self.errmsg: self.invalidCaptcha() - elif 'countdown' or 'Expired session' in self.errmsg: + elif 'countdown' in self.errmsg or 'Expired session' in self.errmsg: self.retry(3) elif 'maintenance' in self.errmsg: self.tempOffline() @@ -210,7 +211,7 @@ class XFileSharingPro(SimpleHoster): for i in range(3): if not self.errmsg: self.checkErrors() - action, inputs = self.parseHtmlForm('F1') + action, inputs = self.parseHtmlForm(self.FORM_PATTERN) if not inputs: action, inputs = self.parseHtmlForm("action=(''|\"\")") if not inputs: |