diff options
-rw-r--r-- | module/plugins/accounts/NitroflareCom.py | 38 | ||||
-rw-r--r-- | module/plugins/hoster/ZahikiNet.py | 5 |
2 files changed, 32 insertions, 11 deletions
diff --git a/module/plugins/accounts/NitroflareCom.py b/module/plugins/accounts/NitroflareCom.py index 4f7ae90c5..d9b434504 100644 --- a/module/plugins/accounts/NitroflareCom.py +++ b/module/plugins/accounts/NitroflareCom.py @@ -9,20 +9,23 @@ from module.plugins.Account import Account class NitroflareCom(Account): __name__ = "NitroflareCom" __type__ = "account" - __version__ = "0.02" + __version__ = "0.03" __description__ = """Nitroflare.com account plugin""" __license__ = "GPLv3" __authors__ = [("Walter Purcaro", "vuolter@gmail.com" )] - VALID_UNTIL_PATTERN = r'>Time Left</label.*>(.+?)</' - LOGIN_FAIL_PATTERN = r'<ul class="errors">\s*<li>' + VALID_UNTIL_PATTERN = r'>Time Left</label><strong>(.+?)</' + TRAFFIC_LEFT_PATTERN = r'>Daily Limit</label><strong>([\d.,]+)' + LOGIN_FAIL_PATTERN = r'<ul class="errors">\s*<li>' + + TOKEN_PATTERN = r'name="token" value="(.+?)"' def loadAccountInfo(self, user, req): validuntil = -1 - trafficleft = None #@TODO: Implement traffic left check + trafficleft = None premium = False html = req.load("https://nitroflare.com/member", @@ -32,6 +35,7 @@ class NitroflareCom(Account): m = re.search(self.VALID_UNTIL_PATTERN, html) if m: expiredate = m.group(1).strip() + self.logDebug("Time Left: " + expiredate) try: validuntil = sum(int(v) * {'day': 24 * 3600, 'hour': 3600, 'minute': 60}[u.lower()] for v, u in @@ -40,23 +44,39 @@ class NitroflareCom(Account): self.logError(e) else: + self.logDebug("Valid until: %s" % validuntil) + if validuntil: validuntil += time.time() premium = True else: validuntil = -1 - return {'validuntil' : validuntil, - 'trafficleft' : trafficleft, - 'premium' : premium} + m = re.search(self.TRAFFIC_LEFT_PATTERN, html) + if m: + try: + trafficleft = self.parseTraffic(str(max(0, 50 - int(m.group(1)))) + " GB") + + except Exception, e: + self.logError(e) + else: + self.logDebug("TRAFFIC_LEFT_PATTERN not found") + + return {'validuntil' : validuntil, + 'trafficleft': trafficleft, + 'premium' : premium} def login(self, user, data, req): html = req.load("https://nitroflare.com/login", decode=True) + + token = re.search(self.TOKEN_PATTERN, html).group(1) + html = req.load("https://nitroflare.com/login", - post={'email' : user, + post={'login' : "", + 'email' : user, 'password': data['password'], - 'token' : re.search(r'name="token" value="(.+?)"', html).group(1)}, + 'token' : token}, decode=True) if re.search(self.LOGIN_FAIL_PATTERN, html): diff --git a/module/plugins/hoster/ZahikiNet.py b/module/plugins/hoster/ZahikiNet.py index ffcca2209..b2705662b 100644 --- a/module/plugins/hoster/ZahikiNet.py +++ b/module/plugins/hoster/ZahikiNet.py @@ -17,8 +17,9 @@ class ZahikiNet(SimpleHoster): DIRECT_LINK = True - NAME_PATTERN = r'/(?P<N>.+?) </title>' - OFFLINE_PATTERN = r'>(Not Found|Il file selezionato non esiste)' + NAME_PATTERN = r'/(?P<N>.+?) </title>' + OFFLINE_PATTERN = r'>(Not Found|Il file selezionato non esiste)' + LINK_FREE_PATTERN = r'file: "(.+?)"' |