From 230147695a21b447273b7207f1370358600dc494 Mon Sep 17 00:00:00 2001 From: zoidberg10 Date: Mon, 16 Jan 2012 23:41:31 +0100 Subject: megashares.com premium --- module/plugins/accounts/MegasharesCom.py | 42 ++++++++++++++++++++++++++++ module/plugins/hoster/MegasharesCom.py | 48 +++++++++++++++++++------------- 2 files changed, 70 insertions(+), 20 deletions(-) create mode 100644 module/plugins/accounts/MegasharesCom.py (limited to 'module/plugins') diff --git a/module/plugins/accounts/MegasharesCom.py b/module/plugins/accounts/MegasharesCom.py new file mode 100644 index 000000000..91601fc95 --- /dev/null +++ b/module/plugins/accounts/MegasharesCom.py @@ -0,0 +1,42 @@ +# -*- coding: utf-8 -*- + +from module.plugins.Account import Account +import re +from time import mktime, strptime + +class MegasharesCom(Account): + __name__ = "MegasharesCom" + __version__ = "0.02" + __type__ = "account" + __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() \ No newline at end of file diff --git a/module/plugins/hoster/MegasharesCom.py b/module/plugins/hoster/MegasharesCom.py index a1dd6e694..3fac633bc 100644 --- a/module/plugins/hoster/MegasharesCom.py +++ b/module/plugins/hoster/MegasharesCom.py @@ -19,20 +19,19 @@ import re from time import time from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo -from module.network.RequestFactory import getURL class MegasharesCom(SimpleHoster): __name__ = "MegasharesCom" __type__ = "hoster" __pattern__ = r"http://(\w+\.)?megashares.com/.*" - __version__ = "0.13" + __version__ = "0.21" __description__ = """megashares.com plugin - free only""" __author_name__ = ("zoidberg") __author_mail__ = ("zoidberg@mujmail.cz") FILE_NAME_PATTERN = '

]*title="(?P[^"]+)">' FILE_SIZE_PATTERN = 'Filesize: (?P[0-9.]+) (?P[kKMG])i?B
' - DOWNLOAD_URL_PATTERN = '