diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2010-11-16 17:50:39 +0100 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2010-11-16 17:50:39 +0100 |
commit | ad274af55174570bd2e6e7db194e87007a13c5c7 (patch) | |
tree | 30b6799eec09fd1afd4e3a074d4e96805394be78 | |
parent | forgot to remove some debug prints (diff) | |
download | pyload-ad274af55174570bd2e6e7db194e87007a13c5c7.tar.xz |
closed #153
-rw-r--r-- | module/plugins/accounts/MegauploadCom.py | 6 | ||||
-rw-r--r-- | module/plugins/hoster/MegauploadCom.py | 24 |
2 files changed, 23 insertions, 7 deletions
diff --git a/module/plugins/accounts/MegauploadCom.py b/module/plugins/accounts/MegauploadCom.py index dce6fb088..e14cf7a28 100644 --- a/module/plugins/accounts/MegauploadCom.py +++ b/module/plugins/accounts/MegauploadCom.py @@ -33,13 +33,17 @@ class MegauploadCom(Account): def loadAccountInfo(self, user, req): page = req.load("http://www.megaupload.com/?c=account") + free = re.findall(r"Account type:</TD>\s*<TD><b>Regular</b>",page,re.IGNORECASE+re.MULTILINE) + if free: + return {"validuntil": -1, "trafficleft":-1, "premium": False} + if 'id="directdownloadstxt">Activate' in page: self.core.log.warning(_("Activate direct Download in your MegaUpload Account")) valid = re.search(r"(\d+) days remaining", page).group(1) valid = time()+ 60 * 60 * 24 * int(valid) - return {"validuntil": valid, "trafficleft": -1} + return {"validuntil": valid, "trafficleft": -1, "premium": True} def login(self, user, data, req): diff --git a/module/plugins/hoster/MegauploadCom.py b/module/plugins/hoster/MegauploadCom.py index 7993233dc..a16369784 100644 --- a/module/plugins/hoster/MegauploadCom.py +++ b/module/plugins/hoster/MegauploadCom.py @@ -56,23 +56,27 @@ class MegauploadCom(Hoster): def setup(self): self.html = [None, None] + if self.account: - self.multiDL = True - self.req.canContinue = True + self.premium = self.account.getAccountInfo(self.user)["premium"] + if self.premium: + self.multiDL = True + self.req.canContinue = True else: self.multiDL = False self.api = {} def process(self, pyfile): - if not self.account: + if not self.account or not self.premium: self.download_html() self.download_api() if not self.file_exists(): self.offline() - - self.setWait(45) + + time = self.get_wait_time() + self.setWait(time) self.wait() pyfile.name = self.get_file_name() @@ -88,7 +92,8 @@ class MegauploadCom(Hoster): self.log.info(_("Megaupload: waiting %d minutes") % int(wait)) self.setWait(int(wait)*60, True) self.wait() - self.req.clearCookies() + if not self.premium: + self.req.clearCookies() self.process(pyfile) else: self.download_api() @@ -169,6 +174,13 @@ class MegauploadCom(Hoster): else: return self.api["name"] + def get_wait_time(self): + time = re.search(r"count=(\d+);", self.html[1]) + if time: + return time.group(1) + else: + return 45 + def file_exists(self): #self.download_html() if re.search(r"Unfortunately, the link you have clicked is not available.", self.html[0]) is not None or \ |