diff options
| author | 2010-10-20 13:29:11 +0200 | |
|---|---|---|
| committer | 2010-10-20 13:29:11 +0200 | |
| commit | 049247095e73ec5cee354aa7256a78ac9004becf (patch) | |
| tree | 0f83252550a5e94b70db9ac9a8202b7cc420a721 /module/plugins | |
| parent | closed #159 (diff) | |
| download | pyload-049247095e73ec5cee354aa7256a78ac9004becf.tar.xz | |
closed #158
Diffstat (limited to 'module/plugins')
| -rw-r--r-- | module/plugins/Plugin.py | 7 | ||||
| -rw-r--r-- | module/plugins/hoster/FileserveCom.py | 63 | 
2 files changed, 30 insertions, 40 deletions
| diff --git a/module/plugins/Plugin.py b/module/plugins/Plugin.py index 267ce57d5..38076bf9c 100644 --- a/module/plugins/Plugin.py +++ b/module/plugins/Plugin.py @@ -107,6 +107,7 @@ class Plugin(object):          self.thread = None # holds thread in future          self.lastDownload = ""  # location where the last call to download was saved +        self.lastCheck = None  #re match of last checked matched          self.js = self.core.js  # js engine          #self.setup() @@ -354,9 +355,11 @@ class Plugin(object):                  if rule in content:                      if delete:                          remove(self.lastDownload) -                    return name +                    return name, name              elif hasattr(rule, "match"): -                if rule.match(content): +                m = rule.match(content) +                if m:                      if delete:                          remove(self.lastDownload) +                    self.lastCheck = m                      return name diff --git a/module/plugins/hoster/FileserveCom.py b/module/plugins/hoster/FileserveCom.py index 2f58393d3..35fd72380 100644 --- a/module/plugins/hoster/FileserveCom.py +++ b/module/plugins/hoster/FileserveCom.py @@ -37,8 +37,11 @@ class FileserveCom(Hoster):      __author_mail__ = ("jeix@hasnomail.de", "mkaay@mkaay.de")
      def setup(self):
 -        self.req.canContinue = self.multiDL = True if self.account else False
 -        
 +        if self.account:
 +            self.req.canContinue = True
 +        else:
 +            self.multiDL = False
 +
      def process(self, pyfile):
          self.html = self.load(self.pyfile.url, ref=False, cookies=False if self.account else True)
          if re.search(r'<h1>File not available</h1>', self.html) is not None:
 @@ -76,48 +79,32 @@ class FileserveCom(Hoster):              if r'incorrect-captcha-sol' in self.html:
                  self.retry()
 -        html = self.load(self.pyfile.url, post={"downloadLink":"wait"})       
 -        wait_time = 30
 -        try:
 -            wait_time = int(html)
 -        except:
 -            pass
 +        wait = self.load(self.pyfile.url, post={"downloadLink":"wait"})
 +        self.setWait(wait)
 +        self.wait()
 +
 +        # show download link
 +        self.load(self.pyfile.url, post={"downloadLink":"show"})
          # this may either download our file or forward us to an error page
          dl = self.download(self.pyfile.url, post={"download":"normal"})
 -        
 +
          # check if we were forwarded to real download
          if self.req.lastEffectiveURL not in self.pyfile.url:
              # download okay
              return
 -            
 -        fp = open(dl)
 -        html = fp.read()
 -        fp.close()
 -        remove(dl)
 -        
 -        if r'Your download link has expired' in html:
 -            self.retry()
 -
 -        wait_time = 720                
 -        m = re.search(r'You need to wait (\d+) seconds to start another download', html)
 -        if m is not None:
 -            wait_time = int(m.group(1))
 -            
 -        self.setWait(wait_time)
 -        self.log.debug("%s: You need to wait %d seconds for another download." % (self.__name__, wait_time))
 -        self.wantReconnect = True
 -        self.wait()
 -        self.retry()
 -    
 +        check = self.checkDownload({"expired": "Your download link has expired"},
 +                                   {"wait": re.compile(r'You need to wait (\d+) seconds to start another download')})
 -        ###### old way
 -        # size = stat(dl)
 -        # size = size.st_size
 -
 -        # if size < 40000:   # html is about 25kb
 -            # f = open(dl, "rb")
 -            # content = f.read()
 -            # if not re.search('<html>.*?<title>\s*Free File Hosting, Online Storage & File Upload with FileServe\s*</title>', content):
 -                # return
 +        if check == "expired":
 +            self.retry()
 +        elif check == "wait":
 +            wait_time = 720
 +            if self.lastCheck is not None:
 +                wait_time = self.lastCheck.group(1)
 +            self.setWait(wait_time)
 +            self.log.debug("%s: You need to wait %d seconds for another download." % (self.__name__, wait_time))
 +            self.wantReconnect = True
 +            self.wait()
 +            self.retry()
\ No newline at end of file | 
