From f5c4d4fc025c8508308fb3f313405cc196391403 Mon Sep 17 00:00:00 2001 From: Stefano Date: Mon, 11 Mar 2013 18:17:32 +0100 Subject: New account plugin for EgoFilesCom http://forum.pyload.org/viewtopic.php?f=13&t=1959 --- module/plugins/accounts/EgoFilesCom.py | 40 ++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 module/plugins/accounts/EgoFilesCom.py (limited to 'module') diff --git a/module/plugins/accounts/EgoFilesCom.py b/module/plugins/accounts/EgoFilesCom.py new file mode 100644 index 000000000..7ca3f3c1d --- /dev/null +++ b/module/plugins/accounts/EgoFilesCom.py @@ -0,0 +1,40 @@ +# -*- coding: utf-8 -*- + +from module.plugins.Account import Account +import re +from time import strptime, mktime +from module.utils import parseFileSize + +class EgoFilesCom(Account): + __name__ = "EgoFilesCom" + __version__ = "0.1" + __type__ = "account" + __description__ = """egofiles.com account plugin""" + __author_name__ = ("stickell") + __author_mail__ = ("l.stickell@yahoo.it") + + PREMIUM_ACCOUNT_PATTERN = '
\s*Premium: (?P

[^/]*) / Traffic left: (?P[\d.]*) (?P\w*)\s*\\n\s*
' + + def loadAccountInfo(self, user, req): + html = req.load("http://egofiles.com") + if 'You are logged as a Free User' in html: + return {"premium": False, "validuntil": None, "trafficleft": None} + + m = re.search(self.PREMIUM_ACCOUNT_PATTERN, html) + if m: + validuntil = int(mktime(strptime(m.group('P'), "%Y-%m-%d %H:%M:%S"))) + trafficleft = parseFileSize(m.group('T'), m.group('U')) / 1024 + return {"premium": True, "validuntil": validuntil, "trafficleft": trafficleft} + else: + self.logError('Unable to retrieve account information - Plugin may be out of date') + + def login(self, user, data, req): + # Set English language + req.load("https://egofiles.com/ajax/lang.php?lang=en", just_header=True) + + html = req.load("http://egofiles.com/ajax/register.php", + post={"log": 1, + "loginV": user, + "passV": data["password"]}) + if 'Login successful' not in html: + self.wrongPassword() -- cgit v1.2.3