diff options
author | Walter Purcaro <vuolter@users.noreply.github.com> | 2015-06-02 12:37:59 +0200 |
---|---|---|
committer | Walter Purcaro <vuolter@users.noreply.github.com> | 2015-06-02 12:37:59 +0200 |
commit | 3abd6df2b3df9cecdfd9aca298476e258b98a183 (patch) | |
tree | 9805bc3c8cb0d916b3d9c00f98f977b21ddd23fc /module | |
parent | [UserAgentSwitcher] Update (diff) | |
download | pyload-3abd6df2b3df9cecdfd9aca298476e258b98a183.tar.xz |
[NitroflareCom] Premium support
Diffstat (limited to 'module')
-rw-r--r-- | module/plugins/accounts/CatShareNet.py | 2 | ||||
-rw-r--r-- | module/plugins/accounts/NitroflareCom.py | 63 | ||||
-rw-r--r-- | module/plugins/hoster/NitroflareCom.py | 20 | ||||
-rw-r--r-- | module/plugins/internal/SimpleHoster.py | 3 |
4 files changed, 71 insertions, 17 deletions
diff --git a/module/plugins/accounts/CatShareNet.py b/module/plugins/accounts/CatShareNet.py index bb42f443f..3ddadca8e 100644 --- a/module/plugins/accounts/CatShareNet.py +++ b/module/plugins/accounts/CatShareNet.py @@ -11,7 +11,7 @@ class CatShareNet(Account): __type__ = "account" __version__ = "0.05" - __description__ = """CatShareNet account plugin""" + __description__ = """Catshare.net account plugin""" __license__ = "GPLv3" __authors__ = [("prOq", None)] diff --git a/module/plugins/accounts/NitroflareCom.py b/module/plugins/accounts/NitroflareCom.py new file mode 100644 index 000000000..1ff8d1876 --- /dev/null +++ b/module/plugins/accounts/NitroflareCom.py @@ -0,0 +1,63 @@ +# -*- coding: utf-8 -*- + +import re +import time + +from module.plugins.Account import Account + + +class NitroflareCom(Account): + __name__ = "NitroflareCom" + __type__ = "account" + __version__ = "0.01" + + __description__ = """Nitroflare.com account plugin""" + __license__ = "GPLv3" + __authors__ = [("Walter Purcaro", "vuolter@gmail.com" )] + + + VALID_UNTIL_PATTERN = r'>Time Left</label.*>(.+?)</strong>' + LOGIN_FAIL_PATTERN = r'<ul class="errors">\s*<li>' + + + def loadAccountInfo(self, user, req): + validuntil = -1 + trafficleft = None #@TODO: Implement traffic left check + premium = False + + html = req.load("https://nitroflare.com/member", + get={'s': "premium"}, + decode=True) + + m = re.search(self.VALID_UNTIL_PATTERN, html) + if m: + expiredate = m.group(1).strip() + + try: + validuntil = sum(int(v) * {'day': 24 * 3600, 'hour': 3600, 'minute': 60}[u.lower()] for v, u in + re.findall(r'(\d+)\s*(day|hour|minute)', expiredate, re.I)) + except Exception, e: + self.logError(e) + + else: + if validuntil: + validuntil += time.time() + premium = True + else: + validuntil = -1 + + return {'validuntil' : validuntil, + 'trafficleft' : trafficleft, + 'premium' : premium} + + + def login(self, user, data, req): + html = req.load("https://nitroflare.com/login", decode=True) + html = req.load("https://nitroflare.com/login", + post={'email' : user, + 'password': data['password'], + 'token' : re.search(r'name="token" value="(.+?)"', html).group(1)}, + decode=True) + + if re.search(self.LOGIN_FAIL_PATTERN, html): + self.wrongPassword() diff --git a/module/plugins/hoster/NitroflareCom.py b/module/plugins/hoster/NitroflareCom.py index a86d1af24..a0734d9b1 100644 --- a/module/plugins/hoster/NitroflareCom.py +++ b/module/plugins/hoster/NitroflareCom.py @@ -9,23 +9,21 @@ from module.plugins.internal.SimpleHoster import SimpleHoster class NitroflareCom(SimpleHoster): __name__ = "NitroflareCom" __type__ = "hoster" - __version__ = "0.13" + __version__ = "0.14" __pattern__ = r'https?://(?:www\.)?nitroflare\.com/view/(?P<ID>[\w^_]+)' __config__ = [("use_premium", "bool", "Use premium account if available", True)] __description__ = """Nitroflare.com hoster plugin""" __license__ = "GPLv3" - __authors__ = [("sahil", "sahilshekhawat01@gmail.com"), - ("Walter Purcaro", "vuolter@gmail.com"), - ("Stickell", "l.stickell@yahoo.it")] - - # URL_REPLACEMENTS = [("http://", "https://")] + __authors__ = [("sahil" , "sahilshekhawat01@gmail.com"), + ("Walter Purcaro", "vuolter@gmail.com" ), + ("Stickell" , "l.stickell@yahoo.it" )] INFO_PATTERN = r'title="(?P<N>.+?)".+>(?P<S>[\d.,]+) (?P<U>[\w^_]+)' OFFLINE_PATTERN = r'>File doesn\'t exist' - LINK_FREE_PATTERN = r'(https?://[\w\-]+\.nitroflare\.com/.+?)"' + LINK_PREMIUM_PATTERN = LINK_FREE_PATTERN = r'(https?://[\w\-]+\.nitroflare\.com/.+?)"' RECAPTCHA_KEY = "6Lenx_USAAAAAF5L1pmTWvWcH73dipAEzNnmNLgy" PREMIUM_ONLY_PATTERN = r'This file is available with Premium only' @@ -61,12 +59,4 @@ class NitroflareCom(SimpleHoster): 'recaptcha_challenge_field': challenge, 'recaptcha_response_field' : response}) - if "The captcha wasn't entered correctly" in self.html: - self.logWarning("The captcha wasn't entered correctly") - return - - if "You have to fill the captcha" in self.html: - self.logWarning("Captcha unfilled") - return - return super(NitroflareCom, self).handleFree(pyfile) diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py index 16e9c7f2e..33e7d3674 100644 --- a/module/plugins/internal/SimpleHoster.py +++ b/module/plugins/internal/SimpleHoster.py @@ -239,7 +239,7 @@ def secondsToMidnight(gmt=0): class SimpleHoster(Hoster): __name__ = "SimpleHoster" __type__ = "hoster" - __version__ = "1.52" + __version__ = "1.53" __pattern__ = r'^unmatchable$' __config__ = [("use_premium", "bool", "Use premium account if available" , True), @@ -630,6 +630,7 @@ class SimpleHoster(Hoster): elif re.search('captcha|code', errmsg, re.I): self.invalidCaptcha() + self.retry(10, reason=_("Wrong captcha")) elif re.search('countdown|expired', errmsg, re.I): self.retry(wait_time=60, reason=_("Link expired")) |