diff options
author | spoob <spoob@gmx.de> | 2010-04-08 16:23:08 +0200 |
---|---|---|
committer | spoob <spoob@gmx.de> | 2010-04-08 16:23:08 +0200 |
commit | b31b2df26d5c21a2caf4d7877c484cceccf4e260 (patch) | |
tree | 67f98eade19c0ddc80efaacd6bae9a14ffa6675b | |
parent | Fixed #92 (diff) | |
download | pyload-b31b2df26d5c21a2caf4d7877c484cceccf4e260.tar.xz |
Cleaned Megaupload
-rwxr-xr-x | module/network/Request.py | 4 | ||||
-rw-r--r-- | module/plugins/hoster/MegauploadCom.py | 44 |
2 files changed, 12 insertions, 36 deletions
diff --git a/module/network/Request.py b/module/network/Request.py index 36cbbe91c..a074df7c4 100755 --- a/module/network/Request.py +++ b/module/network/Request.py @@ -95,7 +95,7 @@ class Request: "Connection: keep-alive", "Keep-Alive: 300"]) - def load(self, url, get={}, post={}, ref=True, cookies=False, just_header=False): + def load(self, url, get={}, post={}, ref=True, cookies=True, just_header=False): url = str(url) @@ -169,7 +169,7 @@ class Request: self.pycurl.setopt(pycurl.PROXY, adress.split(":")[0]) self.pycurl.setopt(pycurl.PROXYPORT, adress.split(":")[1]) - def download(self, url, file_name, get={}, post={}, ref=True, cookies=False): + def download(self, url, file_name, get={}, post={}, ref=True, cookies=True): url = str(url) diff --git a/module/plugins/hoster/MegauploadCom.py b/module/plugins/hoster/MegauploadCom.py index c282aa735..deeedc691 100644 --- a/module/plugins/hoster/MegauploadCom.py +++ b/module/plugins/hoster/MegauploadCom.py @@ -22,63 +22,39 @@ class MegauploadCom(Plugin): props['author_mail'] = ("spoob@pyload.org") self.props = props self.parent = parent - self.time_plus_wait = None #time() + wait in seconds - + self.time_plus_wait = None self.html = [None, None] - self.want_reconnect = False self.init_ocr() self.multi_dl = False def download_html(self): - url = self.parent.url - captcha_image = tempfile.NamedTemporaryFile(suffix=".gif").name for i in range(5): - self.html[0] = self.req.load(url, cookies=True) + self.html[0] = self.req.load(self.parent.url, cookies=True) url_captcha_html = re.search('(http://www.{,3}\.megaupload\.com/gencap.php\?.*\.gif)', self.html[0]).group(1) self.req.download(url_captcha_html, captcha_image, cookies=True) captcha = self.ocr.get_captcha(captcha_image) os.remove(captcha_image) captchacode = re.search('name="captchacode" value="(.*)"', self.html[0]).group(1) megavar = re.search('name="megavar" value="(.*)">', self.html[0]).group(1) - self.html[1] = self.req.load(url, post={"captcha": captcha, "captchacode": captchacode, "megavar": megavar}, cookies=True) + self.html[1] = self.req.load(self.parent.url, post={"captcha": captcha, "captchacode": captchacode, "megavar": megavar}, cookies=True) if re.search(r"Waiting time before each download begins", self.html[1]) != None: - print "got it" break self.time_plus_wait = time() + 45 def get_file_url(self): - """ returns the absolute downloadable filepath - """ - if self.html[0] == None: - self.download_html() - if not self.want_reconnect: - file_url_pattern = 'id="downloadlink"><a href="(.*)" onclick="' - search = re.search(file_url_pattern, self.html[1]) - return search.group(1).replace(" ", "%20") - else: - return False + file_url_pattern = 'id="downloadlink"><a href="(.*)" onclick="' + search = re.search(file_url_pattern, self.html[1]) + return search.group(1).replace(" ", "%20") def get_file_name(self): - if self.html[0] == None: - self.download_html() - if not self.want_reconnect: - file_name_pattern = 'id="downloadlink"><a href="(.*)" onclick="' - return re.search(file_name_pattern, self.html[1]).group(1).split("/")[-1] - else: - return self.parent.url + file_name_pattern = 'id="downloadlink"><a href="(.*)" onclick="' + return re.search(file_name_pattern, self.html[1]).group(1).split("/")[-1] def file_exists(self): - """ returns True or False - """ - if self.html[0] == None: - self.download_html() + self.download_html() if re.search(r"Unfortunately, the link you have clicked is not available.", self.html[0]) != None or \ re.search(r"Download limit exceeded", self.html[0]): return False - else: - return True - - def proceed(self, url, location): - self.req.download(url, location, cookies=True) + return True |