diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2011-02-18 22:33:06 +0100 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2011-02-18 22:33:06 +0100 |
commit | d79c1b3a6d1a6481b77598edf71fcb53eb6bb655 (patch) | |
tree | 04746ec4511a4d3e134a3781cb7e68dc3974411c /module/plugins/hoster/MegauploadCom.py | |
parent | youtube fix, xdccrequest abort dl implemented (diff) | |
download | pyload-d79c1b3a6d1a6481b77598edf71fcb53eb6bb655.tar.xz |
Diffstat (limited to 'module/plugins/hoster/MegauploadCom.py')
-rw-r--r-- | module/plugins/hoster/MegauploadCom.py | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/module/plugins/hoster/MegauploadCom.py b/module/plugins/hoster/MegauploadCom.py index 20cff6e63..a7bc85856 100644 --- a/module/plugins/hoster/MegauploadCom.py +++ b/module/plugins/hoster/MegauploadCom.py @@ -9,6 +9,8 @@ from module.network.RequestFactory import getURL from module.unescape import unescape +from pycurl import error + def getInfo(urls): url = "http://megaupload.com/mgr_linkcheck.php" @@ -98,7 +100,24 @@ class MegauploadCom(Hoster): else: self.download_api() pyfile.name = self.get_file_name() - self.download(pyfile.url) + + try: + self.download(pyfile.url) + except error, e: + if e.args and e.args[0] == 33: + # undirect download and resume , not a good idea + page = self.load(pyfile.url) + self.download(re.search(r'href=\"(http://[^\"]*?)\" class=\"down_ad_butt1\">', page).group(1)) + return + else: + raise + + check = self.checkDownload({"dllink": re.compile(r'href=\"(http://[^\"]*?)\" class=\"down_ad_butt1\">')}) + if check == "dllink": + self.log.warning(_("You should enable direct Download in your Megaupload Account settings")) + + pyfile.size = 0 + self.download(self.lastCheck.group(1)) def download_html(self): for i in range(3): |