summaryrefslogtreecommitdiffstats
path: root/module/plugins/accounts
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-06-02 12:37:59 +0200
committerGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-06-02 12:37:59 +0200
commit3abd6df2b3df9cecdfd9aca298476e258b98a183 (patch)
tree9805bc3c8cb0d916b3d9c00f98f977b21ddd23fc /module/plugins/accounts
parent[UserAgentSwitcher] Update (diff)
downloadpyload-3abd6df2b3df9cecdfd9aca298476e258b98a183.tar.xz
[NitroflareCom] Premium support
Diffstat (limited to 'module/plugins/accounts')
-rw-r--r--module/plugins/accounts/CatShareNet.py2
-rw-r--r--module/plugins/accounts/NitroflareCom.py63
2 files changed, 64 insertions, 1 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()