From 43e6a6376625ac73067403ddae3b45a80618d6c8 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Fri, 3 Oct 2014 19:58:02 +0200 Subject: Rename accounts directory to account --- pyload/plugins/account/FilefactoryCom.py | 46 ++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 pyload/plugins/account/FilefactoryCom.py (limited to 'pyload/plugins/account/FilefactoryCom.py') 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: (?P\d{1,2})\w{1,2} (?P\w{3}), (?P\d{4})' + + + 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 \g \g', 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() -- cgit v1.2.3