diff options
| author | 2009-12-17 19:12:25 +0100 | |
|---|---|---|
| committer | 2009-12-17 19:12:25 +0100 | |
| commit | d39d51044b8b36a0dae2bda3214f5be554654b9a (patch) | |
| tree | aa066dd1af463a08b841f83c47a84702a77e5ac4 /module | |
| parent | fixed QueueManager (diff) | |
| download | pyload-d39d51044b8b36a0dae2bda3214f5be554654b9a.tar.xz | |
Fixed Megaupload, need better captcha detection
Diffstat (limited to 'module')
| -rw-r--r-- | module/plugins/MegauploadCom.py | 18 | ||||
| -rw-r--r-- | module/plugins/RapidshareCom.py | 4 | 
2 files changed, 16 insertions, 6 deletions
| diff --git a/module/plugins/MegauploadCom.py b/module/plugins/MegauploadCom.py index 3736503c0..db1859db7 100644 --- a/module/plugins/MegauploadCom.py +++ b/module/plugins/MegauploadCom.py @@ -4,6 +4,7 @@  import os  import re  import tempfile +from time import time  from module.Plugin import Plugin @@ -21,6 +22,8 @@ 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.html = [None, None]          self.want_reconnect = False          self.init_ocr() @@ -31,18 +34,24 @@ class MegauploadCom(Plugin):          captcha_image = tempfile.NamedTemporaryFile(suffix=".gif").name -        for i in range(5): +        got_captcha = False +         +        for i in range(10):              self.html[0] = self.req.load(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)              if re.search(r"Waiting time before each download begins", self.html[1]) != None: +                got_captcha = True                  break +        self.time_plus_wait = time() + 45 +        if not got_captcha: +            raise "Fuckin captcha to hard" -        os.remove(captcha_image)      def get_file_url(self):          """ returns the absolute downloadable filepath @@ -52,7 +61,7 @@ class MegauploadCom(Plugin):          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) +            return search.group(1).replace(" ", "%20")          else:              return False @@ -75,3 +84,6 @@ class MegauploadCom(Plugin):              return False          else:              return True +             +    def proceed(self, url, location): +        self.req.download(url, location, cookies=True) diff --git a/module/plugins/RapidshareCom.py b/module/plugins/RapidshareCom.py index c4e1f8ef9..615dda521 100644 --- a/module/plugins/RapidshareCom.py +++ b/module/plugins/RapidshareCom.py @@ -38,9 +38,7 @@ class RapidshareCom(Plugin):      def prepare(self, thread):          pyfile = self.parent - -        self.want_reconnect = False - +                  self.download_api_data()          if self.api_data["status"] == "1":              pyfile.status.filename = self.get_file_name() | 
