summaryrefslogtreecommitdiffstats
path: root/module/plugins/accounts/NowVideoSx.py
diff options
context:
space:
mode:
authorGravatar GammaC0de <GammaC0de@users.noreply.github.com> 2015-05-29 23:33:10 +0200
committerGravatar GammaC0de <GammaC0de@users.noreply.github.com> 2015-05-29 23:33:10 +0200
commit844dfd92f590e531ca2f7fd86305fcbc13a03721 (patch)
tree5303bd07749b362dab071ada6197fe37dda85b27 /module/plugins/accounts/NowVideoSx.py
parent[BitshareCom] Code cosmetics (diff)
parent[SimpleHoster] Fix DB error (diff)
downloadpyload-844dfd92f590e531ca2f7fd86305fcbc13a03721.tar.xz
Merge pull request #1 from pyload/stable
sync stable
Diffstat (limited to 'module/plugins/accounts/NowVideoSx.py')
-rw-r--r--module/plugins/accounts/NowVideoSx.py56
1 files changed, 56 insertions, 0 deletions
diff --git a/module/plugins/accounts/NowVideoSx.py b/module/plugins/accounts/NowVideoSx.py
new file mode 100644
index 000000000..2f7b033bd
--- /dev/null
+++ b/module/plugins/accounts/NowVideoSx.py
@@ -0,0 +1,56 @@
+# -*- coding: utf-8 -*-
+
+import re
+import time
+
+from module.plugins.Account import Account
+
+
+class NowVideoSx(Account):
+ __name__ = "NowVideoSx"
+ __type__ = "account"
+ __version__ = "0.03"
+
+ __description__ = """NowVideo.at account plugin"""
+ __license__ = "GPLv3"
+ __authors__ = [("Walter Purcaro", "vuolter@gmail.com")]
+
+
+ VALID_UNTIL_PATTERN = r'>Your premium membership expires on: (.+?)<'
+
+
+ def loadAccountInfo(self, user, req):
+ validuntil = None
+ trafficleft = -1
+ premium = None
+
+ html = req.load("http://www.nowvideo.sx/premium.php")
+
+ m = re.search(self.VALID_UNTIL_PATTERN, html)
+ if m:
+ expiredate = m.group(1).strip()
+ self.logDebug("Expire date: " + expiredate)
+
+ try:
+ validuntil = time.mktime(time.strptime(expiredate, "%Y-%b-%d"))
+
+ except Exception, e:
+ self.logError(e)
+
+ else:
+ if validuntil > time.mktime(time.gmtime()):
+ premium = True
+ else:
+ premium = False
+ validuntil = -1
+
+ return {"validuntil": validuntil, "trafficleft": trafficleft, "premium": premium}
+
+
+ def login(self, user, data, req):
+ html = req.load("http://www.nowvideo.sx/login.php",
+ post={'user': user, 'pass': data['password']},
+ decode=True)
+
+ if re.search(r'>Log In<', html):
+ self.wrongPassword()