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/OneFichierCom.py | 48 +++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 pyload/plugins/account/OneFichierCom.py (limited to 'pyload/plugins/account/OneFichierCom.py') diff --git a/pyload/plugins/account/OneFichierCom.py b/pyload/plugins/account/OneFichierCom.py new file mode 100644 index 000000000..efb563a60 --- /dev/null +++ b/pyload/plugins/account/OneFichierCom.py @@ -0,0 +1,48 @@ +# -*- coding: utf-8 -*- + +import re +from time import strptime, mktime +from pycurl import REFERER + +from pyload.plugins.base.Account import Account + + +class OneFichierCom(Account): + __name__ = "OneFichierCom" + __type__ = "account" + __version__ = "0.1" + + __description__ = """1fichier.com account plugin""" + __author_name__ = "Elrick69" + __author_mail__ = "elrick69[AT]rocketmail[DOT]com" + + VALID_UNTIL_PATTERN = r'You are a premium user until (?P\d{2})/(?P\d{2})/(?P\d{4})' + + + def loadAccountInfo(self, user, req): + + html = req.load("http://1fichier.com/console/abo.pl") + + 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 = int(mktime(strptime(validuntil, "%d/%m/%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://1fichier.com/login.pl?lg=en") + + html = req.load("http://1fichier.com/login.pl?lg=en", post={ + "mail": user, + "pass": data['password'], + "Login": "Login"}) + + if r'
Invalid username or password.
' in html: + self.wrongPassword() -- cgit v1.2.3