summaryrefslogtreecommitdiffstats
path: root/pyload/plugins/account/NowVideoAt.py
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@gmail.com> 2014-11-15 07:26:01 +0100
committerGravatar Walter Purcaro <vuolter@gmail.com> 2014-11-15 07:26:01 +0100
commiteb61d1bb0a30fd32f99b93f847346c610fbc91d2 (patch)
treef889dd1b19c0496f3f88c478445165abd98f9c7a /pyload/plugins/account/NowVideoAt.py
parent[HTTPRequest] Raise Fail if write response fails (diff)
downloadpyload-eb61d1bb0a30fd32f99b93f847346c610fbc91d2.tar.xz
Update plugins after merging
Diffstat (limited to 'pyload/plugins/account/NowVideoAt.py')
-rw-r--r--pyload/plugins/account/NowVideoAt.py56
1 files changed, 56 insertions, 0 deletions
diff --git a/pyload/plugins/account/NowVideoAt.py b/pyload/plugins/account/NowVideoAt.py
new file mode 100644
index 000000000..7af8bc4bc
--- /dev/null
+++ b/pyload/plugins/account/NowVideoAt.py
@@ -0,0 +1,56 @@
+# -*- coding: utf-8 -*-
+
+import re
+
+from time import gmtime, mktime, strptime
+
+from pyload.plugins.internal.Account import Account
+
+
+class NowVideoAt(Account):
+ __name__ = "NowVideoAt"
+ __type__ = "account"
+ __version__ = "0.01"
+
+ __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.at/premium.php")
+
+ m = re.search(self.VALID_UNTIL_PATTERN, html)
+ if m:
+ expiredate = m.group(1).strip()
+ self.logDebug("Expire date: " + expiredate)
+
+ try:
+ validuntil = mktime(strptime(expiredate, "%Y-%b-%d"))
+
+ except Exception, e:
+ self.logError(e)
+
+ else:
+ if validuntil > mktime(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.at/login.php",
+ post={'user': user, 'pass': data['password']})
+
+ if ">Invalid login details" is html:
+ self.wrongPassword()