From 68d662e689cd42687341c550fb6ebb74e6968d21 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Mon, 8 Sep 2014 00:29:57 +0200 Subject: module -> pyload --- pyload/plugins/accounts/MegasharesCom.py | 46 ++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 pyload/plugins/accounts/MegasharesCom.py (limited to 'pyload/plugins/accounts/MegasharesCom.py') diff --git a/pyload/plugins/accounts/MegasharesCom.py b/pyload/plugins/accounts/MegasharesCom.py new file mode 100644 index 000000000..2032d0578 --- /dev/null +++ b/pyload/plugins/accounts/MegasharesCom.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- + +import re +from time import mktime, strptime + +from pyload.plugins.Account import Account + + +class MegasharesCom(Account): + __name__ = "MegasharesCom" + __type__ = "account" + __version__ = "0.02" + + __description__ = """Megashares.com account plugin""" + __author_name__ = "zoidberg" + __author_mail__ = "zoidberg@mujmail.cz" + + VALID_UNTIL_PATTERN = r'

Period Ends: (\w{3} \d{1,2}, \d{4})

' + + + def loadAccountInfo(self, user, req): + #self.relogin(user) + html = req.load("http://d01.megashares.com/myms.php", decode=True) + + premium = False if '>Premium Upgrade<' in html else True + + validuntil = trafficleft = -1 + try: + timestr = re.search(self.VALID_UNTIL_PATTERN, html).group(1) + self.logDebug(timestr) + validuntil = mktime(strptime(timestr, "%b %d, %Y")) + except Exception, e: + self.logError(e) + + return {"validuntil": validuntil, "trafficleft": -1, "premium": premium} + + def login(self, user, data, req): + html = req.load('http://d01.megashares.com/myms_login.php', post={ + "httpref": "", + "myms_login": "Login", + "mymslogin_name": user, + "mymspassword": data['password'] + }, decode=True) + + if not '%s' % user in html: + self.wrongPassword() -- cgit v1.2.3