summaryrefslogtreecommitdiffstats
path: root/pyload/plugins/account/FilefactoryCom.py
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@gmail.com> 2014-10-03 19:58:02 +0200
committerGravatar Walter Purcaro <vuolter@gmail.com> 2014-10-03 19:58:02 +0200
commit43e6a6376625ac73067403ddae3b45a80618d6c8 (patch)
treeceb458c3da1f19e0a91731bc254ee3a158682d0b /pyload/plugins/account/FilefactoryCom.py
parent[ConfigParser] Remove IGNORE feature (diff)
downloadpyload-43e6a6376625ac73067403ddae3b45a80618d6c8.tar.xz
Rename accounts directory to account
Diffstat (limited to 'pyload/plugins/account/FilefactoryCom.py')
-rw-r--r--pyload/plugins/account/FilefactoryCom.py46
1 files changed, 46 insertions, 0 deletions
diff --git a/pyload/plugins/account/FilefactoryCom.py b/pyload/plugins/account/FilefactoryCom.py
new file mode 100644
index 000000000..047e7bb36
--- /dev/null
+++ b/pyload/plugins/account/FilefactoryCom.py
@@ -0,0 +1,46 @@
+# -*- coding: utf-8 -*-
+
+import re
+from time import mktime, strptime
+
+from pycurl import REFERER
+
+from pyload.plugins.base.Account import Account
+
+
+class FilefactoryCom(Account):
+ __name__ = "FilefactoryCom"
+ __type__ = "account"
+ __version__ = "0.14"
+
+ __description__ = """Filefactory.com account plugin"""
+ __author_name__ = ("zoidberg", "stickell")
+ __author_mail__ = ("zoidberg@mujmail.cz", "l.stickell@yahoo.it")
+
+ VALID_UNTIL_PATTERN = r'Premium valid until: <strong>(?P<d>\d{1,2})\w{1,2} (?P<m>\w{3}), (?P<y>\d{4})</strong>'
+
+
+ def loadAccountInfo(self, user, req):
+ html = req.load("http://www.filefactory.com/account/")
+
+ m = re.search(self.VALID_UNTIL_PATTERN, html)
+ if m:
+ premium = True
+ validuntil = re.sub(self.VALID_UNTIL_PATTERN, '\g<d> \g<m> \g<y>', m.group(0))
+ validuntil = mktime(strptime(validuntil, "%d %b %Y"))
+ else:
+ premium = False
+ validuntil = -1
+
+ return {"premium": premium, "trafficleft": -1, "validuntil": validuntil}
+
+ def login(self, user, data, req):
+ req.http.c.setopt(REFERER, "http://www.filefactory.com/member/login.php")
+
+ html = req.load("http://www.filefactory.com/member/signin.php", post={
+ "loginEmail": user,
+ "loginPassword": data['password'],
+ "Submit": "Sign In"})
+
+ if req.lastEffectiveURL != "http://www.filefactory.com/account/":
+ self.wrongPassword()