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 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 From db38a45f836b444f0bf19eddb493f1d1dae10618 Mon Sep 17 00:00:00 2001 From: Stefano Date: Mon, 11 Mar 2013 19:48:25 +0100 Subject: EgoFilesCom: added support for premium downloads http://forum.pyload.org/viewtopic.php?f=13&t=1959 --- module/plugins/hoster/EgoFilesCom.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/module/plugins/hoster/EgoFilesCom.py b/module/plugins/hoster/EgoFilesCom.py index 61203f9bd..2109c8ea7 100644 --- a/module/plugins/hoster/EgoFilesCom.py +++ b/module/plugins/hoster/EgoFilesCom.py @@ -13,7 +13,7 @@ class EgoFilesCom(SimpleHoster): __name__ = "EgoFilesCom" __type__ = "hoster" __pattern__ = r"https?://(www\.)?egofiles.com/(\w+)" - __version__ = "0.02" + __version__ = "0.03" __description__ = """Egofiles.com Download Hoster""" __author_name__ = ("stickell") __author_mail__ = ("l.stickell@yahoo.it") @@ -28,6 +28,12 @@ class EgoFilesCom(SimpleHoster): # Set English language self.load("https://egofiles.com/ajax/lang.php?lang=en", just_header=True) + def process(self, pyfile): + if self.premium: + self.handlePremium() + else: + self.handleFree() + def handleFree(self): self.html = self.load(self.pyfile.url, decode=True) @@ -60,4 +66,7 @@ class EgoFilesCom(SimpleHoster): self.download(downloadURL) + def handlePremium(self): + self.download(self.pyfile.url) + getInfo = create_getInfo(EgoFilesCom) -- cgit v1.2.3 From 6f1c809111689950374af8f6457ace99468e0480 Mon Sep 17 00:00:00 2001 From: Stefano Date: Mon, 11 Mar 2013 19:51:47 +0100 Subject: EgoFilesCom: fixed time import trouble --- module/plugins/accounts/EgoFilesCom.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/module/plugins/accounts/EgoFilesCom.py b/module/plugins/accounts/EgoFilesCom.py index 7ca3f3c1d..da1ed03ad 100644 --- a/module/plugins/accounts/EgoFilesCom.py +++ b/module/plugins/accounts/EgoFilesCom.py @@ -2,12 +2,12 @@ from module.plugins.Account import Account import re -from time import strptime, mktime +import time from module.utils import parseFileSize class EgoFilesCom(Account): __name__ = "EgoFilesCom" - __version__ = "0.1" + __version__ = "0.2" __type__ = "account" __description__ = """egofiles.com account plugin""" __author_name__ = ("stickell") @@ -22,7 +22,7 @@ class EgoFilesCom(Account): m = re.search(self.PREMIUM_ACCOUNT_PATTERN, html) if m: - validuntil = int(mktime(strptime(m.group('P'), "%Y-%m-%d %H:%M:%S"))) + validuntil = int(time.mktime(time.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: -- cgit v1.2.3