diff options
-rw-r--r-- | module/plugins/hooks/XFileSharingPro.py | 36 | ||||
-rw-r--r-- | module/plugins/hoster/HellspyCz.py | 6 | ||||
-rw-r--r-- | module/plugins/hoster/RapidgatorNet.py | 5 | ||||
-rw-r--r-- | module/plugins/hoster/WebshareCz.py | 5 | ||||
-rw-r--r-- | module/plugins/hoster/XFileSharingPro.py | 16 | ||||
-rw-r--r-- | module/plugins/internal/SimpleHoster.py | 55 |
6 files changed, 75 insertions, 48 deletions
diff --git a/module/plugins/hooks/XFileSharingPro.py b/module/plugins/hooks/XFileSharingPro.py index 3981db2d0..105c70113 100644 --- a/module/plugins/hooks/XFileSharingPro.py +++ b/module/plugins/hooks/XFileSharingPro.py @@ -5,7 +5,7 @@ import re class XFileSharingPro(Hook): __name__ = "XFileSharingPro" - __version__ = "0.03" + __version__ = "0.04" __type__ = "hook" __config__ = [ ("activated" , "bool" , "Activated" , "True"), ("loadDefault", "bool", "Include default (built-in) hoster list" , "True"), @@ -25,29 +25,25 @@ class XFileSharingPro(Hook): if self.getConfig('loadDefault'): hosterList |= set(( #WORKING HOSTERS: - "azsharing.com", "banashare.com", "fileband.com", "kingsupload.com", "migahost.com", "ryushare.com", "xfileshare.eu", - #NOT TESTED: - "aieshare.com", "amonshare.com", "asixfiles.com", - "bebasupload.com", "boosterking.com", "buckshare.com", "bulletupload.com", "crocshare.com", "ddlanime.com", "divxme.com", - "dopeshare.com", "downupload.com", "eyesfile.com", "eyvx.com", "fik1.com", "file4safe.com", "file4sharing.com", - "fileforth.com", "filemade.com", "filemak.com", "fileplaygroud.com", "filerace.com", "filestrack.com", - "fileupper.com", "filevelocity.com", "fooget.com", "4bytez.com", "freefilessharing.com", "glumbouploads.com", "grupload.com", - "heftyfile.com", "hipfile.com", "host4desi.com", "hulkshare.com", "idupin.com", "imageporter.com", "isharefast.com", - "jalurcepat.com", "laoupload.com", "linkzhost.com", "loombo.com", "maknyos.com", - "mlfat4arab.com", "movreel.com", "netuploaded.com", "ok2upload.com", "180upload.com", "1hostclick.com", "ovfile.com", - "putshare.com", "pyramidfiles.com", "q4share.com", "queenshare.com", "ravishare.com", "rockdizfile.com", "sendmyway.com", + "aieshare.com", "asixfiles.com", "banashare.com", "cyberlocker.ch", "eyesfile.co", "eyesfile.com", + "fileband.com", "filedwon.com", "filedownloads.org", "hipfile.com", "kingsupload.com", "mlfat4arab.com", + "netuploaded.com", "odsiebie.pl", "q4share.com", "ravishare.com", "uptobox.com", "verzend.be", + #NOT TESTED: + "bebasupload.com", "boosterking.com", "divxme.com", "filevelocity.com", "glumbouploads.com", "grupload.com", "heftyfile.com", + "host4desi.com", "laoupload.com", "linkzhost.com", "movreel.com", "rockdizfile.com", "limfile.com" "share76.com", "sharebeast.com", "sharehut.com", "sharerun.com", "shareswift.com", "sharingonline.com", "6ybh-upload.com", - "skipfile.com", "spaadyshare.com", "space4file.com", "speedoshare.com", "uploadbaz.com", "uploadboost.com", "uploadc.com", - "uploaddot.com", "uploadfloor.com", "uploadic.com", "uploadville.com", "uptobox.com", "vidbull.com", "zalaa.com", + "skipfile.com", "spaadyshare.com", "space4file.com", "uploadbaz.com", "uploadc.com", + "uploaddot.com", "uploadfloor.com", "uploadic.com", "uploadville.com", "vidbull.com", "zalaa.com", "zomgupload.com", "kupload.org", "movbay.org", "multishare.org", "omegave.org", "toucansharing.org", "uflinq.org", "banicrazy.info", "flowhot.info", "upbrasil.info", "shareyourfilez.biz", "bzlink.us", "cloudcache.cc", "fileserver.cc" - "farshare.to", "kingshare.to", "filemaze.ws", "filehost.ws", "goldfile.eu", "filestock.ru", "moidisk.ru" - "4up.me", "kfiles.kz", "odsiebie.pl", "upchi.co.il", "upit.in", "verzend.be" - )) - + "farshare.to", "filemaze.ws", "filehost.ws", "filestock.ru", "moidisk.ru", "4up.im", "100shared.com", + #WRONG FILE NAME: + "sendmyway.com", "upchi.co.il", "180upload.com", #NOT WORKING: - """ - """ + "amonshare.com", "imageporter.com", "file4safe.com", + #DOWN OR BROKEN: + "ddlanime.com", "fileforth.com", "loombo.com", "goldfile.eu", "putshare.com" + )) hosterList -= (excludeList) hosterList -= set(('', u'')) diff --git a/module/plugins/hoster/HellspyCz.py b/module/plugins/hoster/HellspyCz.py index 22838b481..ad0cccd54 100644 --- a/module/plugins/hoster/HellspyCz.py +++ b/module/plugins/hoster/HellspyCz.py @@ -22,15 +22,15 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class HellspyCz(SimpleHoster): __name__ = "HellspyCz" __type__ = "hoster" - __pattern__ = r"http://(?:\w*\.)*hellspy\.(?:cz|com|sk|hu)(/\S+/\d+)/?.*" - __version__ = "0.25" + __pattern__ = r"http://(?:\w*\.)*(?:hellspy\.(?:cz|com|sk|hu|pl)|sciagaj.pl)(/\S+/\d+)/?.*" + __version__ = "0.26" __description__ = """HellSpy.cz""" __author_name__ = ("zoidberg") __author_mail__ = ("zoidberg@mujmail.cz") FILE_INFO_PATTERN = '<span class="filesize right">(?P<S>[0-9.]+) <span>(?P<U>[kKMG])i?B</span></span>\s*<h1 title="(?P<N>.*?)"' FILE_OFFLINE_PATTERN = r'<h2>(404 - Page|File) not found</h2>' - FILE_URL_REPLACEMENTS = [(r"http://(?:\w*\.)*hellspy\.(?:cz|com|sk|hu)(/\S+/\d+)/?.*", r"http://www.hellspy.com\1")] + FILE_URL_REPLACEMENTS = [(__pattern__, r"http://www.hellspy.com\1")] CREDIT_LEFT_PATTERN = r'<strong>Credits: </strong>\s*(\d+)' DOWNLOAD_AGAIN_PATTERN = r'<a id="button-download-start"[^>]*title="You can download the file without deducting your credit.">' diff --git a/module/plugins/hoster/RapidgatorNet.py b/module/plugins/hoster/RapidgatorNet.py index ad23b5a33..f0d64cae1 100644 --- a/module/plugins/hoster/RapidgatorNet.py +++ b/module/plugins/hoster/RapidgatorNet.py @@ -29,7 +29,7 @@ class RapidgatorNet(SimpleHoster): __name__ = "RapidgatorNet" __type__ = "hoster" __pattern__ = r"http://(?:www\.)?(rapidgator.net)/file/(\d+)" - __version__ = "0.10" + __version__ = "0.11" __description__ = """rapidgator.net""" __author_name__ = ("zoidberg","chrox") @@ -61,6 +61,7 @@ class RapidgatorNet(SimpleHoster): if status == 200: return json['response'] elif status == 401: + self.account.relogin(self.user) self.retry() elif status == 423: self.account.empty(self.user) @@ -69,7 +70,7 @@ class RapidgatorNet(SimpleHoster): self.fail(msg) def handlePremium(self): - self.account.relogin(self.user) + #self.logDebug("ACCOUNT_DATA", self.account.getAccountData(self.user)) self.api_data = self.getAPIResponse('info') self.api_data['md5'] = self.api_data['hash'] self.pyfile.name = self.api_data['filename'] diff --git a/module/plugins/hoster/WebshareCz.py b/module/plugins/hoster/WebshareCz.py index b60fda7e4..195e65a93 100644 --- a/module/plugins/hoster/WebshareCz.py +++ b/module/plugins/hoster/WebshareCz.py @@ -24,7 +24,7 @@ class WebshareCz(SimpleHoster): __name__ = "WebshareCz" __type__ = "hoster" __pattern__ = r"http://(\w+\.)?webshare.cz/(stahnout/)?(?P<ID>\w{10})-.+" - __version__ = "0.11" + __version__ = "0.12" __description__ = """WebShare.cz""" __author_name__ = ("zoidberg") @@ -33,6 +33,9 @@ class WebshareCz(SimpleHoster): FILE_OFFLINE_PATTERN = r'<h3>Soubor ".*?" nebyl nalezen.</h3>' DOWNLOAD_LINK_PATTERN = r'id="download_link" href="(?P<url>.*?)"' + + def setup(self): + self.multiDL = True def handleFree(self): url_a = re.search(r"(var l.*)", self.html).group(1) diff --git a/module/plugins/hoster/XFileSharingPro.py b/module/plugins/hoster/XFileSharingPro.py index ef559a56f..713198754 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.12" + __version__ = "0.13" __description__ = """XFileSharingPro common hoster base""" __author_name__ = ("zoidberg") __author_mail__ = ("zoidberg@mujmail.cz") @@ -126,7 +126,7 @@ class XFileSharingPro(SimpleHoster): break else: - if captcha in self.err: + if self.errmsg and 'captcha' in self.errmsg: self.fail("No valid captcha code entered") else: self.fail("Download link not found") @@ -185,20 +185,20 @@ class XFileSharingPro(SimpleHoster): wait_time = sum([int(v) * {"hour": 3600, "minute": 60, "second": 1}[u] for v, u in re.findall('(\d+)\s*(hour|minute|second)?', self.errmsg)]) self.setWait(wait_time, True) self.wait() + elif 'captcha' in self.errmsg: + self.invalidCaptcha() + elif 'premium' in self.errmsg and 'require' in self.errmsg: + self.fail("File can be downloaded by premium users only") elif 'limit' in self.errmsg: self.setWait(3600, True) self.wait() self.retry(25) - elif 'captcha' in self.errmsg: - self.invalidCaptcha() elif 'countdown' in self.errmsg or 'Expired session' in self.errmsg: self.retry(3) elif 'maintenance' in self.errmsg: self.tempOffline() elif 'download files up to' in self.errmsg: self.fail("File too large for free download") - elif 'requires premium' in self.errmsg: - self.fail("File can be downloaded by premium users only") else: self.fail(self.errmsg) @@ -211,9 +211,9 @@ class XFileSharingPro(SimpleHoster): for i in range(3): if not self.errmsg: self.checkErrors() - action, inputs = self.parseHtmlForm(self.FORM_PATTERN) + action, inputs = self.parseHtmlForm(input_names={"op": re.compile("^download")}) if not inputs: - action, inputs = self.parseHtmlForm("action=(''|\"\")") + action, inputs = self.parseHtmlForm(self.FORM_PATTERN) if not inputs: if self.errmsg: self.retry() diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py index 6d7bb6284..a4a7c5efa 100644 --- a/module/plugins/internal/SimpleHoster.py +++ b/module/plugins/internal/SimpleHoster.py @@ -42,22 +42,47 @@ def parseHtmlTagAttrValue(attr_name, tag): m = re.search(r"%s\s*=\s*([\"']?)((?<=\")[^\"]+|(?<=')[^']+|[^>\s\"'][^>\s]*)\1" % attr_name, tag, re.I) return m.group(2) if m else None -def parseHtmlForm(attr_str, html): - inputs = {} - action = None - form = re.search(r"(?P<tag><form[^>]*%s[^>]*>)(?P<content>.*?)</(form|body|html)[^>]*>" % attr_str, html, re.S | re.I) - if form: +def parseHtmlForm(attr_str, html, input_names=None): + for form in re.finditer(r"(?P<tag><form[^>]*%s[^>]*>)(?P<content>.*?)</?(form|body|html)[^>]*>" % attr_str, html, re.S | re.I): + inputs = {} action = parseHtmlTagAttrValue("action", form.group('tag')) - for input in re.finditer(r'(<(input|textarea)[^>]*>)([^<]*(?=</\2)|)', form.group('content'), re.S | re.I): - name = parseHtmlTagAttrValue("name", input.group(1)) + for inputtag in re.finditer(r'(<(input|textarea)[^>]*>)([^<]*(?=</\2)|)', form.group('content'), re.S | re.I): + name = parseHtmlTagAttrValue("name", inputtag.group(1)) if name: - value = parseHtmlTagAttrValue("value", input.group(1)) + value = parseHtmlTagAttrValue("value", inputtag.group(1)) if value is None: - inputs[name] = input.group(3) or '' + inputs[name] = inputtag.group(3) or '' else: inputs[name] = value - - return action, inputs + + if isinstance(input_names, dict): + # check input attributes + for key, val in input_names.items(): + if key in inputs: + if isinstance(val, basestring) and inputs[key] == val: + print "MATCH STRING", val, inputs[key] + continue + elif isinstance(val, tuple) and inputs[key] in val: + print "MATCH TUPLE", val, inputs[key] + continue + elif hasattr(val, "search") and re.match(val, inputs[key]): + print "MATCH REGEXP", val, inputs[key] + continue + print "NO MATCH", inputs, input_names + break # attibute value does not match + else: + print "NO KEY", inputs, input_names + break # attibute name does not match + else: + print "ALL MATCH", inputs, input_names + return action, inputs # passed attribute check + else: + # no attribute check + print "NOCHECK", inputs, input_names, type(input_names) + return action, inputs + + print "NONE", inputs + return {}, None # no matching form found def parseFileInfo(self, url = '', html = ''): info = {"name" : url, "size" : 0, "status" : 3} @@ -129,7 +154,7 @@ class PluginParseError(Exception): class SimpleHoster(Hoster): __name__ = "SimpleHoster" - __version__ = "0.26" + __version__ = "0.27" __pattern__ = None __type__ = "hoster" __description__ = """Base hoster plugin""" @@ -217,11 +242,13 @@ class SimpleHoster(Hoster): self.wait() self.retry(max_tries = max_tries, reason="Download limit reached") - def parseHtmlForm(self, attr_str): - return parseHtmlForm(attr_str, self.html) + def parseHtmlForm(self, attr_str='', input_names=None): + return parseHtmlForm(attr_str, self.html, input_names) def checkTrafficLeft(self): traffic = self.account.getAccountInfo(self.user, True)["trafficleft"] + if traffic == -1: + return True size = self.pyfile.size / 1024 self.logInfo("Filesize: %i KiB, Traffic left for user %s: %i KiB" % (size, self.user, traffic)) return size <= traffic
\ No newline at end of file |