diff options
Diffstat (limited to 'pyload/plugin')
113 files changed, 468 insertions, 514 deletions
diff --git a/pyload/plugin/account/DropboxCom.py b/pyload/plugin/account/DropboxCom.py index d18504926..c6fd2253d 100644 --- a/pyload/plugin/account/DropboxCom.py +++ b/pyload/plugin/account/DropboxCom.py @@ -27,8 +27,8 @@ class DropboxCom(SimpleHoster):      def setup(self): -        self.multiDL = True -        self.chunkLimit = 1 +        self.multiDL        = True +        self.chunkLimit     = 1          self.resumeDownload = True diff --git a/pyload/plugin/account/FilerNet.py b/pyload/plugin/account/FilerNet.py index f3cc42367..8b1da8ce3 100644 --- a/pyload/plugin/account/FilerNet.py +++ b/pyload/plugin/account/FilerNet.py @@ -16,7 +16,7 @@ class FilerNet(Account):      __authors__     = [("stickell", "l.stickell@yahoo.it")] -    TOKEN_PATTERN = r'_csrf_token" value="([^"]+)" />' +    TOKEN_PATTERN = r'_csrf_token" value="(.+?)" />'      WALID_UNTIL_PATTERN = r'Der Premium-Zugang ist gültig bis (.+)\.\s*</td>'      TRAFFIC_PATTERN = r'Traffic</th>\s*<td>([^<]+)</td>'      FREE_PATTERN = r'Account Status</th>\s*<td>\s*Free' diff --git a/pyload/plugin/account/FshareVn.py b/pyload/plugin/account/FshareVn.py index 539a739df..85306ce8f 100644 --- a/pyload/plugin/account/FshareVn.py +++ b/pyload/plugin/account/FshareVn.py @@ -18,8 +18,8 @@ class FshareVn(Account):      VALID_UNTIL_PATTERN = ur'<dt>Thời hạn dùng:</dt>\s*<dd>([^<]+)</dd>' -    LIFETIME_PATTERN = ur'<dt>Lần đăng nhập trước:</dt>\s*<dd>[^<]+</dd>' -    TRAFFIC_LEFT_PATTERN = ur'<dt>Tổng Dung Lượng Tài Khoản</dt>\s*<dd[^>]*>([\d.]+) ([kKMG])B</dd>' +    LIFETIME_PATTERN = ur'<dt>Lần đăng nhập trước:</dt>\s*<dd>.+?</dd>' +    TRAFFIC_LEFT_PATTERN = ur'<dt>Tổng Dung Lượng Tài Khoản</dt>\s*<dd.*?>([\d.]+) ([kKMG])B</dd>'      DIRECT_DOWNLOAD_PATTERN = ur'<input type="checkbox"\s*([^=>]*)[^>]*/>Kích hoạt download trực tiếp</dt>' diff --git a/pyload/plugin/account/MegaRapidoNet.py b/pyload/plugin/account/MegaRapidoNet.py index 22979a09a..5d92a62d4 100644 --- a/pyload/plugin/account/MegaRapidoNet.py +++ b/pyload/plugin/account/MegaRapidoNet.py @@ -16,8 +16,8 @@ class MegaRapidoNet(Account):      __authors__     = [("Kagenoshin", "kagenoshin@gmx.ch")] -    VALID_UNTIL_PATTERN = r'<\s*?div[^>]*?class\s*?=\s*?[\'"]premium_index[\'"][^>]*>[^<]*?<[^>]*?b[^>]*>\s*?TEMPO\s*?PREMIUM[^<]*<[^>]*?/b[^>]*>\s*?(\d*)[^\d]*?DIAS[^\d]*?(\d*)[^\d]*?HORAS[^\d]*?(\d*)[^\d]*?MINUTOS[^\d]*?(\d*)[^\d]*?SEGUNDOS' -    USER_ID_PATTERN     = r'<\s*?div[^>]*?class\s*?=\s*?["\']checkbox_compartilhar["\'][^>]*>[^<]*<\s*?input[^>]*?name\s*?=\s*?["\']usar["\'][^>]*>[^<]*<\s*?input[^>]*?name\s*?=\s*?["\']user["\'][^>]*?value\s*?=\s*?["\'](.*?)\s*?["\']' +    VALID_UNTIL_PATTERN = r'<\s*?div[^>]*?class\s*?=\s*?[\'"]premium_index[\'"].*?>[^<]*?<[^>]*?b.*?>\s*?TEMPO\s*?PREMIUM.*?<[^>]*?/b.*?>\s*?(\d*)[^\d]*?DIAS[^\d]*?(\d*)[^\d]*?HORAS[^\d]*?(\d*)[^\d]*?MINUTOS[^\d]*?(\d*)[^\d]*?SEGUNDOS' +    USER_ID_PATTERN     = r'<\s*?div[^>]*?class\s*?=\s*?["\']checkbox_compartilhar["\'].*?>.*?<\s*?input[^>]*?name\s*?=\s*?["\']usar["\'].*?>.*?<\s*?input[^>]*?name\s*?=\s*?["\']user["\'][^>]*?value\s*?=\s*?["\'](.*?)\s*?["\']'      def loadAccountInfo(self, user, req): diff --git a/pyload/plugin/account/MultishareCz.py b/pyload/plugin/account/MultishareCz.py index 9b4f4447b..169372aac 100644 --- a/pyload/plugin/account/MultishareCz.py +++ b/pyload/plugin/account/MultishareCz.py @@ -16,7 +16,7 @@ class MultishareCz(Account):      TRAFFIC_LEFT_PATTERN = r'<span class="profil-zvyrazneni">Kredit:</span>\s*<strong>(?P<S>[\d.,]+) (?P<U>[\w^_]+)</strong>' -    ACCOUNT_INFO_PATTERN = r'<input type="hidden" id="(u_ID|u_hash)" name="[^"]*" value="([^"]+)">' +    ACCOUNT_INFO_PATTERN = r'<input type="hidden" id="(u_ID|u_hash)" name=".+?" value="(.+?)">'      def loadAccountInfo(self, user, req): diff --git a/pyload/plugin/account/OboomCom.py b/pyload/plugin/account/OboomCom.py index 7fad29821..163692399 100644 --- a/pyload/plugin/account/OboomCom.py +++ b/pyload/plugin/account/OboomCom.py @@ -4,7 +4,8 @@ import time  try:      from beaker.crypto.pbkdf2 import PBKDF2 -except: + +except ImportError:      from beaker.crypto.pbkdf2 import pbkdf2      from binascii import b2a_hex      class PBKDF2(object): @@ -23,7 +24,7 @@ from pyload.plugin.Account import Account  class OboomCom(Account):      __name__    = "OboomCom"      __type__    = "account" -    __version__ = "0.23" +    __version__ = "0.24"      __description__ = """Oboom.com account plugin"""      __license__     = "GPLv3" diff --git a/pyload/plugin/account/SmoozedCom.py b/pyload/plugin/account/SmoozedCom.py index 00cb5b5d6..dd11a35f2 100644 --- a/pyload/plugin/account/SmoozedCom.py +++ b/pyload/plugin/account/SmoozedCom.py @@ -5,7 +5,8 @@ import time  try:      from beaker.crypto.pbkdf2 import PBKDF2 -except: + +except ImportError:      from beaker.crypto.pbkdf2 import pbkdf2      from binascii import b2a_hex      class PBKDF2(object): @@ -24,7 +25,7 @@ from pyload.plugin.Account import Account  class SmoozedCom(Account):      __name__    = "SmoozedCom"      __type__    = "account" -    __version__ = "0.03" +    __version__ = "0.04"      __description__ = """Smoozed.com account plugin"""      __license__     = "GPLv3" diff --git a/pyload/plugin/account/UlozTo.py b/pyload/plugin/account/UlozTo.py index 1570419b0..135f4b6c6 100644 --- a/pyload/plugin/account/UlozTo.py +++ b/pyload/plugin/account/UlozTo.py @@ -18,7 +18,7 @@ class UlozTo(Account):                         ("pulpe", "")] -    TRAFFIC_LEFT_PATTERN = r'<li class="menu-kredit"><a .*?title="[^"]*?GB = ([\d.]+) MB"' +    TRAFFIC_LEFT_PATTERN = r'<li class="menu-kredit"><a .*?title=".+?GB = ([\d.]+) MB"'      def loadAccountInfo(self, user, req): diff --git a/pyload/plugin/addon/AntiVirus.py b/pyload/plugin/addon/AntiVirus.py index 619893735..2213cddc1 100644 --- a/pyload/plugin/addon/AntiVirus.py +++ b/pyload/plugin/addon/AntiVirus.py @@ -11,21 +11,39 @@ from pyload.utils import fs_encode, fs_join  class AntiVirus(Addon):      __name__    = "AntiVirus"      __type__    = "addon" -    __version__ = "0.05" +    __version__ = "0.07"      #@TODO: add trash option (use Send2Trash lib) -    __config__ = [("action"    , "Antivirus default;Delete;Quarantine", "Manage infected files"                    , "Antivirus default"), -                  ("quardir"   , "folder"                             , "Quarantine folder"                        , ""                 ), -                  ("scanfailed", "bool"                               , "Scan incompleted files (failed downloads)", False              ), -                  ("cmdfile"   , "file"                               , "Antivirus executable"                     , ""                 ), -                  ("cmdargs"   , "str"                                , "Scan options"                             , ""                 ), -                  ("ignore-err", "bool"                               , "Ignore scan errors"                       , False              )] +    __config__ = [("action"    , "Antivirus default;Delete;Quarantine", "Manage infected files"                     , "Antivirus default"), +                  ("quardir"   , "folder"                             , "Quarantine folder"                         , ""                 ), +                  ("deltotrash", "bool"                               , "Move to trash (recycle bin) instead delete", True               ), +                  ("scanfailed", "bool"                               , "Scan incompleted files (failed downloads)" , False              ), +                  ("cmdfile"   , "file"                               , "Antivirus executable"                      , ""                 ), +                  ("cmdargs"   , "str"                                , "Scan options"                              , ""                 ), +                  ("ignore-err", "bool"                               , "Ignore scan errors"                        , False              )]      __description__ = """Scan downloaded files with antivirus program"""      __license__     = "GPLv3"      __authors__     = [("Walter Purcaro", "vuolter@gmail.com")] +    interval = 0  #@TODO: Remove in 0.4.10 + + +    def setup(self): +        self.info = {}  #@TODO: Remove in 0.4.10 + +        try: +            import send2trash + +        except ImportError: +            self.logDebug("Send2Trash lib not found") +            self.trashable = False + +        else: +            self.trashable = True + +      @Expose      @threaded      def scan(self, pyfile, thread): @@ -39,6 +57,7 @@ class AntiVirus(Addon):          thread.addActive(pyfile)          pyfile.setCustomStatus(_("virus scanning")) +        pyfile.setProgress(0)          try:              p = subprocess.Popen([cmdfile, cmdargs, file], bufsize=-1, stdout=subprocess.PIPE, stderr=subprocess.PIPE) @@ -59,11 +78,19 @@ class AntiVirus(Addon):                  action = self.getConfig('action')                  try:                      if action == "Delete": -                        os.remove(file) +                        if not self.getConfig('deltotrash'): +                            os.remove(file) + +                        elif self.trashable: +                            send2trash.send2trash(file) + +                        else: +                            self.logWarning(_("Unable to move file to trash, move to quarantine instead")) +                            pyfile.setCustomStatus(_("file moving")) +                            shutil.move(file, self.getConfig('quardir'))                      elif action == "Quarantine":                          pyfile.setCustomStatus(_("file moving")) -                        pyfile.setProgress(0)                          shutil.move(file, self.getConfig('quardir'))                  except (IOError, shutil.Error), e: diff --git a/pyload/plugin/addon/DeleteFinished.py b/pyload/plugin/addon/DeleteFinished.py index 8bb681cca..801e48ed6 100644 --- a/pyload/plugin/addon/DeleteFinished.py +++ b/pyload/plugin/addon/DeleteFinished.py @@ -9,9 +9,8 @@ class DeleteFinished(Addon):      __type__    = "addon"      __version__ = "1.12" -    __config__ = [("activated" , "bool", "Activated"                         , "False"), -                  ("interval"  , "int" , "Delete every (hours)"              , "72"   ), -                  ("deloffline", "bool", "Delete packages with offline links", "False")] +    __config__ = [("interval"  , "int" , "Check interval in hours"          , 72   ), +                  ("deloffline", "bool", "Delete package with offline links", False)]      __description__ = """Automatically delete all finished packages from queue"""      __license__     = "GPLv3" diff --git a/pyload/plugin/addon/ExternalScripts.py b/pyload/plugin/addon/ExternalScripts.py index 502a6dc7b..05b1d7b65 100644 --- a/pyload/plugin/addon/ExternalScripts.py +++ b/pyload/plugin/addon/ExternalScripts.py @@ -10,7 +10,7 @@ from pyload.utils import fs_encode, fs_join  class ExternalScripts(Addon):      __name__    = "ExternalScripts"      __type__    = "addon" -    __version__ = "0.37" +    __version__ = "0.39"      __config__ = [("activated", "bool", "Activated"         , True ),                    ("waitend"  , "bool", "Wait script ending", False)] @@ -119,7 +119,7 @@ class ExternalScripts(Addon):      def downloadPreparing(self, pyfile):          for script in self.scripts['download_preparing']: -            self.callScript(script, pyfile.id, pyfile.name, pyfile.pluginname, pyfile.url, None) +            self.callScript(script, pyfile.id, pyfile.name, None, pyfile.pluginname, pyfile.url)      def downloadFailed(self, pyfile): @@ -130,7 +130,7 @@ class ExternalScripts(Addon):          for script in self.scripts['download_failed']:              file = fs_join(download_folder, pyfile.name) -            self.callScript(script, pyfile.id, pyfile.name, pyfile.pluginname, pyfile.url, file) +            self.callScript(script, pyfile.id, pyfile.name, file, pyfile.pluginname, pyfile.url)      def downloadFinished(self, pyfile): @@ -141,17 +141,17 @@ class ExternalScripts(Addon):          for script in self.scripts['download_finished']:              file = fs_join(download_folder, pyfile.name) -            self.callScript(script, pyfile.id, pyfile.name, pyfile.pluginname, pyfile.url, file) +            self.callScript(script, pyfile.id, pyfile.name, file, pyfile.pluginname, pyfile.url)      def archive_extract_failed(self, pyfile, archive):          for script in self.scripts['archive_extract_failed']: -            self.callScript(script, pyfile.id, pyfile.name, archive.out, archive.filename, archive.files) +            self.callScript(script, pyfile.id, pyfile.name, archive.filename, archive.out, archive.files)      def archive_extracted(self, pyfile, archive):          for script in self.scripts['archive_extracted']: -            self.callScript(script, pyfile.id, pyfile.name, archive.out, archive.filename, archive.files) +            self.callScript(script, pyfile.id, pyfile.name, archive.filename, archive.out, archive.files)      def packageFinished(self, pypack): @@ -161,7 +161,7 @@ class ExternalScripts(Addon):              download_folder = self.config['general']['download_folder']          for script in self.scripts['package_finished']: -            self.callScript(script, pypack.id, pypack.name, download_folder) +            self.callScript(script, pypack.id, pypack.name, download_folder, pypack.password)      def packageDeleted(self, pid): @@ -173,7 +173,7 @@ class ExternalScripts(Addon):              download_folder = self.config['general']['download_folder']          for script in self.scripts['package_deleted']: -            self.callScript(script, pack.id, pack.name, download_folder) +            self.callScript(script, pack.id, pack.name, download_folder, pack.password)      def package_extract_failed(self, pypack): @@ -183,7 +183,7 @@ class ExternalScripts(Addon):              download_folder = self.config['general']['download_folder']          for script in self.scripts['package_extract_failed']: -            self.callScript(script, pypack.id, pypack.name, download_folder) +            self.callScript(script, pypack.id, pypack.name, download_folder, pypack.password)      def package_extracted(self, pypack): diff --git a/pyload/plugin/addon/ExtractArchive.py b/pyload/plugin/addon/ExtractArchive.py index 93dd52e46..07b388ecd 100644 --- a/pyload/plugin/addon/ExtractArchive.py +++ b/pyload/plugin/addon/ExtractArchive.py @@ -4,9 +4,9 @@ from __future__ import with_statement  import os  import sys +import traceback  from copy import copy -from traceback import print_exc  # monkey patch bug in python 2.6 and lower  # http://bugs.python.org/issue6122 , http://bugs.python.org/issue1236 , http://bugs.python.org/issue1731717 @@ -106,24 +106,25 @@ class ArchiveQueue(object):  class ExtractArchive(Addon):      __name__    = "ExtractArchive"      __type__    = "addon" -    __version__ = "1.38" - -    __config__ = [("activated"      , "bool"              , "Activated"                             , True                                                                     ), -                  ("fullpath"       , "bool"              , "Extract with full paths"               , True                                                                     ), -                  ("overwrite"      , "bool"              , "Overwrite files"                       , False                                                                    ), -                  ("keepbroken"     , "bool"              , "Try to extract broken archives"        , False                                                                    ), -                  ("repair"         , "bool"              , "Repair broken archives (RAR required)" , False                                                                    ), -                  ("test"           , "bool"              , "Test archive before extracting"        , False                                                                    ), -                  ("usepasswordfile", "bool"              , "Use password file"                     , True                                                                     ), -                  ("passwordfile"   , "file"              , "Password file"                         , "archive_password.txt"                                                   ), -                  ("delete"         , "No;Permanent;Trash", "Delete archive after extraction"       , "No"                                                                     ), -                  ("subfolder"      , "bool"              , "Create subfolder for each package"     , False                                                                    ), -                  ("destination"    , "folder"            , "Extract files to folder"               , ""                                                                       ), -                  ("extensions"     , "str"               , "Extract archives ending with extension", "7z,bz2,bzip2,gz,gzip,lha,lzh,lzma,rar,tar,taz,tbz,tbz2,tgz,xar,xz,z,zip"), -                  ("excludefiles"   , "str"               , "Don't extract the following files"     , "*.nfo,*.DS_Store,index.dat,thumb.db"                                    ), -                  ("recursive"      , "bool"              , "Extract archives in archives"          , True                                                                     ), -                  ("waitall"        , "bool"              , "Run after all downloads was processed" , False                                                                    ), -                  ("renice"         , "int"               , "CPU priority"                          , 0                                                                        )] +    __version__ = "1.41" + +    __config__ = [("activated"      , "bool"              , "Activated"                                 , True                                                                     ), +                  ("fullpath"       , "bool"              , "Extract with full paths"                   , True                                                                     ), +                  ("overwrite"      , "bool"              , "Overwrite files"                           , False                                                                    ), +                  ("keepbroken"     , "bool"              , "Try to extract broken archives"            , False                                                                    ), +                  ("repair"         , "bool"              , "Repair broken archives (RAR required)"     , False                                                                    ), +                  ("test"           , "bool"              , "Test archive before extracting"            , False                                                                    ), +                  ("usepasswordfile", "bool"              , "Use password file"                         , True                                                                     ), +                  ("passwordfile"   , "file"              , "Password file"                             , "archive_password.txt"                                                   ), +                  ("delete"         , "bool"              , "Delete archive after extraction"           , True                                                                     ), +                  ("deltotrash"     , "bool"              , "Move to trash (recycle bin) instead delete", True                                                                     ), +                  ("subfolder"      , "bool"              , "Create subfolder for each package"         , False                                                                    ), +                  ("destination"    , "folder"            , "Extract files to folder"                   , ""                                                                       ), +                  ("extensions"     , "str"               , "Extract archives ending with extension"    , "7z,bz2,bzip2,gz,gzip,lha,lzh,lzma,rar,tar,taz,tbz,tbz2,tgz,xar,xz,z,zip"), +                  ("excludefiles"   , "str"               , "Don't extract the following files"         , "*.nfo,*.DS_Store,index.dat,thumb.db"                                    ), +                  ("recursive"      , "bool"              , "Extract archives in archives"              , True                                                                     ), +                  ("waitall"        , "bool"              , "Run after all downloads was processed"     , False                                                                    ), +                  ("renice"         , "int"               , "CPU priority"                              , 0                                                                        )]      __description__ = """Extract different kind of archives"""      __license__     = "GPLv3" @@ -146,7 +147,16 @@ class ExtractArchive(Addon):          self.extractors  = []          self.passwords   = []          self.repair      = False -        self.trash       = False + +        try: +            import send2trash + +        except ImportError: +            self.logDebug("Send2Trash lib not found") +            self.trashable = False + +        else: +            self.trashable = True      def activate(self): @@ -161,19 +171,19 @@ class ExtractArchive(Addon):              except OSError, e:                  if e.errno == 2: -                    self.logInfo(_("No %s installed") % p) +                    self.logWarning(_("No %s installed") % p)                  else:                      self.logWarning(_("Could not activate: %s") % p, e)                      if self.core.debug: -                        print_exc() +                        traceback.print_exc()              except Exception, e:                  self.logWarning(_("Could not activate: %s") % p, e)                  if self.core.debug: -                    print_exc() +                    traceback.print_exc()          if self.extractors: -            self.logInfo(_("Activated") + " " + "|".join("%s %s" % (Extractor.__name__,Extractor.VERSION) for Extractor in self.extractors)) +            self.logDebug(*["Found %s %s" % (Extractor.__name__, Extractor.VERSION) for Extractor in self.extractors])              self.extractQueued()  #: Resume unfinished extractions          else:              self.logInfo(_("No Extract plugins activated")) @@ -319,6 +329,7 @@ class ExtractArchive(Addon):                                  new_files = self._extract(pyfile, archive, pypack.password)                              finally: +                                pyfile.setProgress(100)                                  thread.finishFile(pyfile)                          except Exception, e: @@ -447,31 +458,25 @@ class ExtractArchive(Addon):              pyfile.setStatus("processing")              delfiles = archive.getDeleteFiles() -            if self.core.debug: -                self.logDebug("Would delete: %s" % ", ".join(delfiles)) +            self.logDebug("Would delete: " + ", ".join(delfiles)) -            if self.getConfig('delete') != 'No': -                try: -                    from send2trash import send2trash -                    if self.getConfig('delete') == "Trash": -                        self.trash = True -                        self.logInfo(_("Sending %s files to trash") % len(delfiles)) -                except ImportError: -                    self.logError(name, _("Send2Trash not installed, no files deleted")) -                    self.trash = False - -                if self.getConfig('delete') == "Permanent": -                    self.trash = False -                    self.logInfo(_("Deleting %s files") % len(delfiles)) +            if self.getConfig('delete'): +                self.logInfo(_("Deleting %s files") % len(delfiles)) +                deltotrash = self.getConfig('deltotrash')                  for f in delfiles:                      file = fs_encode(f) -                    if os.path.exists(file) and self.trash: -                        send2trash(file) -                    elif os.path.exists(file): +                    if not os.path.exists(file): +                        continue + +                    if not deltotrash:                          os.remove(file) + +                    elif self.trashable: +                        send2trash.send2trash(file) +                      else: -                        self.logDebug("%s does not exists" % f) +                        self.logWarning(_("Unable to move %s to trash") % os.path.basename(f))              self.logInfo(name, _("Extracting finished"))              extracted_files = archive.files or archive.list() @@ -490,7 +495,7 @@ class ExtractArchive(Addon):          except Exception, e:              self.logError(name, _("Unknown error"), e)              if self.core.debug: -                print_exc() +                traceback.print_exc()          self.manager.dispatchEvent("archive_extract_failed", pyfile, archive) diff --git a/pyload/plugin/addon/IRCInterface.py b/pyload/plugin/addon/IRCInterface.py index 6d85a5681..170055ee8 100644 --- a/pyload/plugin/addon/IRCInterface.py +++ b/pyload/plugin/addon/IRCInterface.py @@ -4,11 +4,11 @@ import re  import socket  import ssl  import time +import traceback  from pycurl import FORM_FILE  from select import select  from threading import Thread -from traceback import print_exc  from pyload.api import PackageDoesNotExists, FileDoesNotExists  from pyload.network.RequestFactory import getURL @@ -103,7 +103,7 @@ class IRCInterface(Thread, Addon):          except IRCError, ex:              self.sock.send("QUIT :byebye\r\n") -            print_exc() +            traceback.print_exc()              self.sock.close() diff --git a/pyload/plugin/addon/MergeFiles.py b/pyload/plugin/addon/MergeFiles.py index 393e66628..ee6a86d9f 100644 --- a/pyload/plugin/addon/MergeFiles.py +++ b/pyload/plugin/addon/MergeFiles.py @@ -4,8 +4,7 @@ from __future__ import with_statement  import os  import re - -from traceback import print_exc +import traceback  from pyload.plugin.Addon import Addon, threaded  from pyload.utils import fs_join @@ -71,7 +70,7 @@ class MergeFiles(Addon):                          self.logDebug("Finished merging part", splitted_file)                      except Exception, e: -                        print_exc() +                        traceback.print_exc()                      finally:                          pyfile.setProgress(100) diff --git a/pyload/plugin/addon/RestartSlow.py b/pyload/plugin/addon/RestartSlow.py deleted file mode 100644 index 34416e79a..000000000 --- a/pyload/plugin/addon/RestartSlow.py +++ /dev/null @@ -1,57 +0,0 @@ -# -*- coding: utf-8 -*- - -import pycurl - -from pyload.plugin.Addon import Addon - - -class RestartSlow(Addon): -    __name__    = "RestartSlow" -    __type__    = "addon" -    __version__ = "0.04" - -    __config__ = [("free_limit"   , "int" ,  "Transfer speed threshold in kilobytes"                     , 100 ), -                ("free_time"    , "int" ,  "Sample interval in minutes"                                , 5   ), -                ("premium_limit", "int" ,  "Transfer speed threshold for premium download in kilobytes", 300 ), -                ("premium_time" , "int" ,  "Sample interval for premium download in minutes"           , 2   ), -                ("safe_mode"    , "bool",  "Don't restart if download is not resumable"                , True)] - -    __description__ = """Restart slow downloads""" -    __license__     = "GPLv3" -    __authors__     = [("Walter Purcaro", "vuolter@gmail.com")] - - -    event_list = ["downloadStarts"] - - -    def setup(self): -        self.info = {'chunk': {}} - - -    def periodical(self): -        if not self.pyfile.plugin.req.dl: -            return - -        if self.getConfig('safe_mode') and not self.pyfile.plugin.resumeDownload: -            time  = 30 -            limit = 5 -        else: -            type  = "premium" if self.pyfile.plugin.premium else "free" -            time  = max(30, self.getConfig('%s_time' % type) * 60) -            limit = max(5, self.getConfig('%s_limit' % type) * 1024) - -        chunks = [chunk for chunk in self.pyfile.plugin.req.dl.chunks \ -                  if chunk.id not in self.info['chunk'] or self.info['chunk'][chunk.id] is not (time, limit)] - -        for chunk in chunks: -            chunk.c.setopt(pycurl.LOW_SPEED_TIME , time) -            chunk.c.setopt(pycurl.LOW_SPEED_LIMIT, limit) - -            self.info['chunk'][chunk.id] = (time, limit) - - -    def downloadStarts(self, pyfile, url, filename): -        if self.cb or (self.getConfig('safe_mode') and not pyfile.plugin.resumeDownload): -            return -        self.pyfile = pyfile -        self.initPeriodical() diff --git a/pyload/plugin/addon/UpdateManager.py b/pyload/plugin/addon/UpdateManager.py index 8e27d9959..c5bee16a1 100644 --- a/pyload/plugin/addon/UpdateManager.py +++ b/pyload/plugin/addon/UpdateManager.py @@ -113,7 +113,7 @@ class UpdateManager(Addon):              return getURL(self.SERVER_URL, get={'v': self.core.api.getServerVersion()}).splitlines()          except Exception: -            self.logWarning(_("Unable to contact server to get updates")) +            self.logWarning(_("Unable to retrieve server to get updates"))      @Expose      @threaded @@ -251,7 +251,7 @@ class UpdateManager(Addon):              if self.core.pluginManager.reloadPlugins(updated):                  exitcode = 1              else: -                self.logWarning(_("pyLoad restart required to reload the updated plugins")) +                self.logWarning(_("Restart pyLoad to reload the updated plugins"))                  self.info['plugins'] = True                  exitcode = 2 diff --git a/pyload/plugin/crypter/CrockoCom.py b/pyload/plugin/crypter/CrockoCom.py index f1472a004..bb93edca9 100644 --- a/pyload/plugin/crypter/CrockoCom.py +++ b/pyload/plugin/crypter/CrockoCom.py @@ -18,4 +18,5 @@ class CrockoCom(SimpleCrypter):      __authors__     = [("zoidberg", "zoidberg@mujmail.cz")] -    LINK_PATTERN = r'<td class="last"><a href="([^"]+)">download</a>' +    LINK_PATTERN = r'<td class="last"><a href="(.+?)">download</a>' + diff --git a/pyload/plugin/crypter/CzshareCom.py b/pyload/plugin/crypter/CzshareCom.py index 230a038c5..60e53ec39 100644 --- a/pyload/plugin/crypter/CzshareCom.py +++ b/pyload/plugin/crypter/CzshareCom.py @@ -19,7 +19,7 @@ class CzshareCom(Crypter):      FOLDER_PATTERN = r'<tr class="subdirectory">\s*<td>\s*<table>(.*?)</table>' -    LINK_PATTERN = r'<td class="col2"><a href="([^"]+)">info</a></td>' +    LINK_PATTERN = r'<td class="col2"><a href="(.+?)">info</a></td>'      def decrypt(self, pyfile): diff --git a/pyload/plugin/crypter/DepositfilesCom.py b/pyload/plugin/crypter/DepositfilesCom.py index a66136ab3..e47f9dd18 100644 --- a/pyload/plugin/crypter/DepositfilesCom.py +++ b/pyload/plugin/crypter/DepositfilesCom.py @@ -18,4 +18,5 @@ class DepositfilesCom(SimpleCrypter):      __authors__     = [("zoidberg", "zoidberg@mujmail.cz")] -    LINK_PATTERN = r'<div class="progressName"[^>]*>\s*<a href="([^"]+)" title="[^"]*" target="_blank">' +    LINK_PATTERN = r'<div class="progressName".*?>\s*<a href="(.+?)" title=".+?" target="_blank">' + diff --git a/pyload/plugin/crypter/EmbeduploadCom.py b/pyload/plugin/crypter/EmbeduploadCom.py index 06d71e21b..357126508 100644 --- a/pyload/plugin/crypter/EmbeduploadCom.py +++ b/pyload/plugin/crypter/EmbeduploadCom.py @@ -21,7 +21,7 @@ class EmbeduploadCom(Crypter):      __authors__     = [("zoidberg", "zoidberg@mujmail.cz")] -    LINK_PATTERN = r'<div id="([^"]+)"[^>]*>\s*<a href="([^"]+)" target="_blank" (?:class="DownloadNow"|style="color:red")>' +    LINK_PATTERN = r'<div id="(.+?)".*?>\s*<a href="(.+?)" target="_blank" (?:class="DownloadNow"|style="color:red")>'      def decrypt(self, pyfile): diff --git a/pyload/plugin/crypter/FileserveCom.py b/pyload/plugin/crypter/FileserveCom.py index f68f8e98c..4b742d5f3 100644 --- a/pyload/plugin/crypter/FileserveCom.py +++ b/pyload/plugin/crypter/FileserveCom.py @@ -20,7 +20,7 @@ class FileserveCom(Crypter):      FOLDER_PATTERN = r'<table class="file_list">(.*?)</table>' -    LINK_PATTERN = r'<a href="([^"]+)" class="sheet_icon wbold">' +    LINK_PATTERN = r'<a href="(.+?)" class="sheet_icon wbold">'      def decrypt(self, pyfile): diff --git a/pyload/plugin/crypter/FourChanOrg.py b/pyload/plugin/crypter/FourChanOrg.py index 68d1e4a31..bf80e3ca1 100644 --- a/pyload/plugin/crypter/FourChanOrg.py +++ b/pyload/plugin/crypter/FourChanOrg.py @@ -23,5 +23,5 @@ class FourChanOrg(Crypter):      def decrypt(self, pyfile):          pagehtml = self.load(pyfile.url) -        images = set(re.findall(r'(images\.4chan\.org/[^/]*/src/[^"<]*)', pagehtml)) +        images = set(re.findall(r'(images\.4chan\.org/[^/]*/src/[^"<]+)', pagehtml))          self.urls = ["http://" + image for image in images] diff --git a/pyload/plugin/crypter/FreakhareCom.py b/pyload/plugin/crypter/FreakhareCom.py index 700c85f07..c061a44d4 100644 --- a/pyload/plugin/crypter/FreakhareCom.py +++ b/pyload/plugin/crypter/FreakhareCom.py @@ -20,7 +20,7 @@ class FreakhareCom(SimpleCrypter):      __authors__     = [("stickell", "l.stickell@yahoo.it")] -    LINK_PATTERN = r'<a href="(http://freakshare\.com/files/[^"]+)" target="_blank">' +    LINK_PATTERN = r'<a href="(http://freakshare\.com/files/.+?)" target="_blank">'      NAME_PATTERN = r'Folder:</b> (?P<N>.+)'      PAGES_PATTERN = r'Pages: +(\d+)' diff --git a/pyload/plugin/crypter/FshareVn.py b/pyload/plugin/crypter/FshareVn.py index 31523d78f..45a174f25 100644 --- a/pyload/plugin/crypter/FshareVn.py +++ b/pyload/plugin/crypter/FshareVn.py @@ -18,4 +18,5 @@ class FshareVn(SimpleCrypter):      __authors__     = [("zoidberg", "zoidberg@mujmail.cz")] -    LINK_PATTERN = r'<li class="w_80pc"><a href="([^"]+)" target="_blank">' +    LINK_PATTERN = r'<li class="w_80pc"><a href="(.+?)" target="_blank">' + diff --git a/pyload/plugin/crypter/LetitbitNet.py b/pyload/plugin/crypter/LetitbitNet.py index 5d19cca8e..587c75c80 100644 --- a/pyload/plugin/crypter/LetitbitNet.py +++ b/pyload/plugin/crypter/LetitbitNet.py @@ -20,7 +20,7 @@ class LetitbitNet(Crypter):      FOLDER_PATTERN = r'<table>(.*)</table>' -    LINK_PATTERN = r'<a href="([^"]+)" target="_blank">' +    LINK_PATTERN = r'<a href="(.+?)" target="_blank">'      def decrypt(self, pyfile): diff --git a/pyload/plugin/crypter/LinkCryptWs.py b/pyload/plugin/crypter/LinkCryptWs.py index a3eb4f179..a900248ef 100644 --- a/pyload/plugin/crypter/LinkCryptWs.py +++ b/pyload/plugin/crypter/LinkCryptWs.py @@ -131,7 +131,7 @@ class LinkCryptWs(Crypter):      def unlockCaptchaProtection(self): -        captcha_url  = re.search(r'<form.*?id\s*?=\s*?"captcha"[^>]*?>.*?<\s*?input.*?src="([^"]*?)"', self.html, re.I | re.S).group(1) +        captcha_url  = re.search(r'<form.*?id\s*?=\s*?"captcha"[^>]*?>.*?<\s*?input.*?src="(.+?)"', self.html, re.I | re.S).group(1)          captcha_code = self.decryptCaptcha(captcha_url, forceUser=True, imgtype="gif", result_type='positional')          self.html = self.load(self.pyfile.url, post={"x": captcha_code[0], "y": captcha_code[1]}) @@ -190,7 +190,7 @@ class LinkCryptWs(Crypter):          self.logDebug("Search for Web links ")          package_links = [] -        pattern = r'<form action="http://linkcrypt.ws/out.html"[^>]*?>.*?<input[^>]*?value="([^"]*?)"[^>]*?name="file"' +        pattern = r'<form action="http://linkcrypt.ws/out.html"[^>]*?>.*?<input[^>]*?value="(.+?)"[^>]*?name="file"'          ids = re.findall(pattern, self.html, re.I | re.S)          self.logDebug("Decrypting %d Web links" % len(ids)) @@ -244,7 +244,7 @@ class LinkCryptWs(Crypter):          for line in self.container_html:              if type in line:                  jseval = self.handle_javascript(line) -                clink = re.search(r'href=["\']([^"\']*?)["\']',jseval,re.I) +                clink = re.search(r'href=["\'](["\']+)', jseval, re.I)                  if not clink:                      continue diff --git a/pyload/plugin/crypter/LinkdecrypterCom.py b/pyload/plugin/crypter/LinkdecrypterCom.py index 09863989f..1ba2dc377 100644 --- a/pyload/plugin/crypter/LinkdecrypterCom.py +++ b/pyload/plugin/crypter/LinkdecrypterCom.py @@ -1,6 +1,7 @@  # -*- coding: utf-8 -*-  import re +  from pyload.plugin.Crypter import Crypter diff --git a/pyload/plugin/crypter/MegaRapidCz.py b/pyload/plugin/crypter/MegaRapidCz.py index 5a14b6f85..1ff859ce5 100644 --- a/pyload/plugin/crypter/MegaRapidCz.py +++ b/pyload/plugin/crypter/MegaRapidCz.py @@ -18,4 +18,5 @@ class MegaRapidCz(SimpleCrypter):      __authors__     = [("zoidberg", "zoidberg@mujmail.cz")] -    LINK_PATTERN = r'<td class="soubor"[^>]*><a href="([^"]+)">' +    LINK_PATTERN = r'<td class="soubor".*?><a href="(.+?)">' + diff --git a/pyload/plugin/crypter/MultiloadCz.py b/pyload/plugin/crypter/MultiloadCz.py index 0bcf94016..de29aea0f 100644 --- a/pyload/plugin/crypter/MultiloadCz.py +++ b/pyload/plugin/crypter/MultiloadCz.py @@ -20,8 +20,8 @@ class MultiloadCz(Crypter):      __authors__     = [("zoidberg", "zoidberg@mujmail.cz")] -    FOLDER_PATTERN = r'<form action="" method="get"><textarea[^>]*>([^>]*)</textarea></form>' -    LINK_PATTERN = r'<p class="manager-server"><strong>([^<]+)</strong></p><p class="manager-linky"><a href="([^"]+)">' +    FOLDER_PATTERN = r'<form action="" method="get"><textarea.*?>([^>]*)</textarea></form>' +    LINK_PATTERN = r'<p class="manager-server"><strong>([^<]+)</strong></p><p class="manager-linky"><a href="(.+?)">'      def decrypt(self, pyfile): diff --git a/pyload/plugin/crypter/NCryptIn.py b/pyload/plugin/crypter/NCryptIn.py index 557a782e8..64ea8727f 100644 --- a/pyload/plugin/crypter/NCryptIn.py +++ b/pyload/plugin/crypter/NCryptIn.py @@ -27,7 +27,7 @@ class NCryptIn(Crypter):      JK_KEY = "jk"      CRYPTED_KEY = "crypted" -    NAME_PATTERN = r'<meta name="description" content="(?P<N>[^"]+)"' +    NAME_PATTERN = r'<meta name="description" content="(?P<N>.+?)"'      def setup(self): @@ -108,7 +108,7 @@ class NCryptIn(Crypter):      def isProtected(self):          form = re.search(r'<form.*?name.*?protected.*?>(.*?)</form>', self.cleanedHtml, re.S) -        if form is not None: +        if form:              content = form.group(1)              for keyword in ("password", "captcha"):                  if keyword in content: @@ -144,7 +144,7 @@ class NCryptIn(Crypter):          # Resolve anicaptcha          if "anicaptcha" in form:              self.logDebug("Captcha protected") -            captchaUri = re.search(r'src="(/temp/anicaptcha/[^"]+)', form).group(1) +            captchaUri = re.search(r'src="(/temp/anicaptcha/.+?)"', form).group(1)              captcha = self.decryptCaptcha("http://ncrypt.in" + captchaUri)              self.logDebug("Captcha resolved [%s]" % captcha)              postData['captcha'] = captcha diff --git a/pyload/plugin/crypter/PastebinCom.py b/pyload/plugin/crypter/PastebinCom.py index d0e34abaf..d0c779aaa 100644 --- a/pyload/plugin/crypter/PastebinCom.py +++ b/pyload/plugin/crypter/PastebinCom.py @@ -19,4 +19,5 @@ class PastebinCom(SimpleCrypter):      LINK_PATTERN = r'<div class="de\d+">(https?://[^ <]+)(?:[^<]*)</div>' -    NAME_PATTERN = r'<div class="paste_box_line1" title="(?P<N>[^"]+)">' +    NAME_PATTERN = r'<div class="paste_box_line1" title="(?P<N>.+?)">' + diff --git a/pyload/plugin/crypter/QuickshareCz.py b/pyload/plugin/crypter/QuickshareCz.py index 8635c797d..18350cba3 100644 --- a/pyload/plugin/crypter/QuickshareCz.py +++ b/pyload/plugin/crypter/QuickshareCz.py @@ -18,7 +18,7 @@ class QuickshareCz(Crypter):      __authors__     = [("zoidberg", "zoidberg@mujmail.cz")] -    FOLDER_PATTERN = r'<textarea[^>]*>(.*?)</textarea>' +    FOLDER_PATTERN = r'<textarea.*?>(.*?)</textarea>'      LINK_PATTERN = r'(http://www\.quickshare\.cz/\S+)' diff --git a/pyload/plugin/crypter/RelinkUs.py b/pyload/plugin/crypter/RelinkUs.py index 448854325..d27750d1e 100644 --- a/pyload/plugin/crypter/RelinkUs.py +++ b/pyload/plugin/crypter/RelinkUs.py @@ -153,7 +153,7 @@ class RelinkUs(Crypter):          # Try to get info from web          m = re.search(self.FILE_TITLE_REGEX, self.html) -        if m is not None: +        if m:              title = m.group(1).strip()              if not self.FILE_NOTITLE in title:                  name = folder = title @@ -198,7 +198,7 @@ class RelinkUs(Crypter):          self.logDebug("Search for CNL2 links")          package_links = []          m = re.search(self.CNL2_FORM_REGEX, self.html, re.S) -        if m is not None: +        if m:              cnl2_form = m.group(1)              try:                  (vcrypted, vjk) = self._getCipherParams(cnl2_form) @@ -213,7 +213,7 @@ class RelinkUs(Crypter):          self.logDebug("Search for DLC links")          package_links = []          m = re.search(self.DLC_LINK_REGEX, self.html) -        if m is not None: +        if m:              container_url = self.DLC_DOWNLOAD_URL + "?id=%s&dlc=1" % self.fileid              self.logDebug("Downloading DLC container link [%s]" % container_url)              try: diff --git a/pyload/plugin/crypter/ShareLinksBiz.py b/pyload/plugin/crypter/ShareLinksBiz.py index 5cc796475..9cae0017a 100644 --- a/pyload/plugin/crypter/ShareLinksBiz.py +++ b/pyload/plugin/crypter/ShareLinksBiz.py @@ -164,7 +164,7 @@ class ShareLinksBiz(Crypter):          # Extract from web package header          title_re = r'<h2><img.*?/>(.*)</h2>'          m = re.search(title_re, self.html, re.S) -        if m is not None: +        if m:              title = m.group(1).strip()              if 'unnamed' not in title:                  name = folder = title diff --git a/pyload/plugin/crypter/UlozTo.py b/pyload/plugin/crypter/UlozTo.py index 5909958bd..a33742c54 100644 --- a/pyload/plugin/crypter/UlozTo.py +++ b/pyload/plugin/crypter/UlozTo.py @@ -19,8 +19,8 @@ class UlozTo(Crypter):      FOLDER_PATTERN = r'<ul class="profile_files">(.*?)</ul>' -    LINK_PATTERN = r'<br /><a href="/([^"]+)">[^<]+</a>' -    NEXT_PAGE_PATTERN = r'<a class="next " href="/([^"]+)"> </a>' +    LINK_PATTERN = r'<br /><a href="/(.+?)">.+?</a>' +    NEXT_PAGE_PATTERN = r'<a class="next " href="/(.+?)"> </a>'      def decrypt(self, pyfile): diff --git a/pyload/plugin/hoster/BezvadataCz.py b/pyload/plugin/hoster/BezvadataCz.py index 20da88010..5d1d05172 100644 --- a/pyload/plugin/hoster/BezvadataCz.py +++ b/pyload/plugin/hoster/BezvadataCz.py @@ -76,7 +76,7 @@ class BezvadataCz(SimpleHoster):          wait_time = (int(m.group(1)) * 60 + int(m.group(2))) if m else 120          self.wait(wait_time, False) -        self.download(url) +        self.link = url      def checkErrors(self): diff --git a/pyload/plugin/hoster/BitshareCom.py b/pyload/plugin/hoster/BitshareCom.py index 4210d0f73..56beb7353 100644 --- a/pyload/plugin/hoster/BitshareCom.py +++ b/pyload/plugin/hoster/BitshareCom.py @@ -72,7 +72,7 @@ class BitshareCom(SimpleHoster):          self.logDebug("File ajax id is [%s]" % self.ajaxid)          # This may either download our file or forward us to an error page -        self.download(self.getDownloadUrl()) +        self.link = self.getDownloadUrl()          if self.checkDownload({"error": ">Error occured<"}):              self.retry(5, 5 * 60, "Bitshare host : Error occured") diff --git a/pyload/plugin/hoster/CatShareNet.py b/pyload/plugin/hoster/CatShareNet.py index 6babb001c..b9d5ad650 100644 --- a/pyload/plugin/hoster/CatShareNet.py +++ b/pyload/plugin/hoster/CatShareNet.py @@ -9,7 +9,7 @@ from pyload.plugin.internal.SimpleHoster import SimpleHoster  class CatShareNet(SimpleHoster):      __name__    = "CatShareNet"      __type__    = "hoster" -    __version__ = "0.12" +    __version__ = "0.13"      __pattern__ = r'http://(?:www\.)?catshare\.net/\w{16}'      __config__  = [("use_premium", "bool", "Use premium account if available", True)] @@ -24,12 +24,13 @@ class CatShareNet(SimpleHoster):      TEXT_ENCODING = True      INFO_PATTERN = r'<title>(?P<N>.+) \((?P<S>[\d.,]+) (?P<U>[\w^_]+)\)<' -    OFFLINE_PATTERN = ur'Podany plik został usunięty\s*</div>' +    OFFLINE_PATTERN = r'<div class="alert alert-error"'      IP_BLOCKED_PATTERN = ur'>Nasz serwis wykrył że Twój adres IP nie pochodzi z Polski.<'      WAIT_PATTERN       = r'var\scount\s=\s(\d+);' -    LINK_FREE_PATTERN = LINK_PREMIUM_PATTERN = r'<form action="(.+?)" method="GET">' +    LINK_FREE_PATTERN    = r'<form action="(.+?)" method="GET">' +    LINK_PREMIUM_PATTERN = r'<form action="(.+?)" method="GET">'      def setup(self): @@ -54,8 +55,6 @@ class CatShareNet(SimpleHoster):                                      'recaptcha_response_field' : response})          m = re.search(self.LINK_FREE_PATTERN, self.html) -        if m is None: -            self.invalidCaptcha() -            self.retry(reason=_("Wrong captcha entered")) +        if m: +            self.link = m.group(1) -        self.link = m.group(1) diff --git a/pyload/plugin/hoster/CrockoCom.py b/pyload/plugin/hoster/CrockoCom.py index 38e057df6..2ac9062fb 100644 --- a/pyload/plugin/hoster/CrockoCom.py +++ b/pyload/plugin/hoster/CrockoCom.py @@ -19,16 +19,16 @@ class CrockoCom(SimpleHoster):      __authors__     = [("zoidberg", "zoidberg@mujmail.cz")] -    NAME_PATTERN = r'<span class="fz24">Download:\s*<strong>(?P<N>.*)' -    SIZE_PATTERN = r'<span class="tip1"><span class="inner">(?P<S>[^<]+)</span></span>' +    NAME_PATTERN    = r'<span class="fz24">Download:\s*<strong>(?P<N>.*)' +    SIZE_PATTERN    = r'<span class="tip1"><span class="inner">(?P<S>[^<]+)</span></span>'      OFFLINE_PATTERN = r'<h1>Sorry,<br />the page you\'re looking for <br />isn\'t here.</h1>|File not found' -    CAPTCHA_PATTERN = re.compile(r"u='(/file_contents/captcha/\w+)';\s*w='(\d+)';") +    CAPTCHA_PATTERN = r"u='(/file_contents/captcha/\w+)';\s*w='(\d+)';" -    FORM_PATTERN = r'<form  method="post" action="([^"]+)">(.*?)</form>' -    FORM_INPUT_PATTERN = r'<input[^>]* name="?([^" ]+)"? value="?([^" ]+)"?[^>]*>' +    FORM_PATTERN = r'<form  method="post" action="(.+?)">(.*?)</form>' +    FORM_INPUT_PATTERN = r'<input[^>]* name="?([^" ]+)"? value="?([^" ]+)"?.*?>' -    NAME_REPLACEMENTS = [(r'<[^>]*>', '')] +    NAME_REPLACEMENTS = [(r'<.*?>', '')]      def handleFree(self, pyfile): diff --git a/pyload/plugin/hoster/CzshareCom.py b/pyload/plugin/hoster/CzshareCom.py index 70766d6fc..03b46f444 100644 --- a/pyload/plugin/hoster/CzshareCom.py +++ b/pyload/plugin/hoster/CzshareCom.py @@ -22,7 +22,7 @@ class CzshareCom(SimpleHoster):      __authors__     = [("zoidberg", "zoidberg@mujmail.cz")] -    NAME_PATTERN    = r'<div class="tab" id="parameters">\s*<p>\s*Cel. n.zev: <a href=[^>]*>(?P<N>[^<]+)</a>' +    NAME_PATTERN    = r'<div class="tab" id="parameters">\s*<p>\s*Cel. n.zev: <a href=.*?>(?P<N>[^<]+)</a>'      SIZE_PATTERN    = r'<div class="tab" id="category">(?:\s*<p>[^\n]*</p>)*\s*Velikost:\s*(?P<S>[\d .,]+)(?P<U>[\w^_]+)\s*</div>'      OFFLINE_PATTERN = r'<div class="header clearfix">\s*<h2 class="red">' @@ -31,10 +31,10 @@ class CzshareCom(SimpleHoster):      CHECK_TRAFFIC = True -    FREE_URL_PATTERN     = r'<a href="([^"]+)" class="page-download">[^>]*alt="([^"]+)" /></a>' +    FREE_URL_PATTERN     = r'<a href="(.+?)" class="page-download">[^>]*alt="(.+?)" /></a>'      FREE_FORM_PATTERN    = r'<form action="download\.php" method="post">\s*<img src="captcha\.php" id="captcha" />(.*?)</form>'      PREMIUM_FORM_PATTERN = r'<form action="/profi_down\.php" method="post">(.*?)</form>' -    FORM_INPUT_PATTERN   = r'<input[^>]* name="([^"]+)" value="([^"]+)"[^>]*/>' +    FORM_INPUT_PATTERN   = r'<input[^>]* name="(.+?)" value="(.+?)"[^>]*/>'      MULTIDL_PATTERN      = r'<p><font color=\'red\'>Z[^<]*PROFI.</font></p>'      USER_CREDIT_PATTERN  = r'<div class="credit">\s*kredit: <strong>([\d .,]+)(\w+)</strong>\s*</div><!-- .credit -->' diff --git a/pyload/plugin/hoster/DataHu.py b/pyload/plugin/hoster/DataHu.py index 820736e0a..3736282d2 100644 --- a/pyload/plugin/hoster/DataHu.py +++ b/pyload/plugin/hoster/DataHu.py @@ -24,7 +24,7 @@ class DataHu(SimpleHoster):      INFO_PATTERN = ur'<title>(?P<N>.*) \((?P<S>[^)]+)\) let\xf6lt\xe9se</title>'      OFFLINE_PATTERN = ur'Az adott f\xe1jl nem l\xe9tezik' -    LINK_FREE_PATTERN = r'<div class="download_box_button"><a href="([^"]+)">' +    LINK_FREE_PATTERN = r'<div class="download_box_button"><a href="(.+?)">'      def setup(self): diff --git a/pyload/plugin/hoster/DataportCz.py b/pyload/plugin/hoster/DataportCz.py index 4f659b291..ecc9f8d5d 100644 --- a/pyload/plugin/hoster/DataportCz.py +++ b/pyload/plugin/hoster/DataportCz.py @@ -38,7 +38,7 @@ class DataportCz(SimpleHoster):              else:                  self.error(_("captcha")) -            self.html = self.download("http://www.dataport.cz%s" % action, post=inputs) +            self.download("http://www.dataport.cz%s" % action, post=inputs)              check = self.checkDownload({"captcha": 'alert("\u0160patn\u011b opsan\u00fd k\u00f3d z obr\u00e1zu");',                                          "slot"   : 'alert("Je n\u00e1m l\u00edto, ale moment\u00e1ln\u011b nejsou'}) diff --git a/pyload/plugin/hoster/DateiTo.py b/pyload/plugin/hoster/DateiTo.py index 0669ce365..9b8eeb3c5 100644 --- a/pyload/plugin/hoster/DateiTo.py +++ b/pyload/plugin/hoster/DateiTo.py @@ -57,7 +57,7 @@ class DateiTo(SimpleHoster):          else:              self.fail(_("Too bad...")) -        self.download(self.html) +        self.link = self.html      def checkErrors(self): diff --git a/pyload/plugin/hoster/DepositfilesCom.py b/pyload/plugin/hoster/DepositfilesCom.py index 0a7543dfb..d718b58dd 100644 --- a/pyload/plugin/hoster/DepositfilesCom.py +++ b/pyload/plugin/hoster/DepositfilesCom.py @@ -11,7 +11,7 @@ from pyload.plugin.internal.SimpleHoster import SimpleHoster  class DepositfilesCom(SimpleHoster):      __name__    = "DepositfilesCom"      __type__    = "hoster" -    __version__ = "0.54" +    __version__ = "0.55"      __pattern__ = r'https?://(?:www\.)?(depositfiles\.com|dfiles\.(eu|ru))(/\w{1,3})?/files/(?P<ID>\w+)'      __config__  = [("use_premium", "bool", "Use premium account if available", True)] @@ -28,7 +28,7 @@ class DepositfilesCom(SimpleHoster):      OFFLINE_PATTERN = r'<span class="html_download_api-not_exists"></span>'      NAME_REPLACEMENTS = [(r'\%u([0-9A-Fa-f]{4})', lambda m: unichr(int(m.group(1), 16))), -                              (r'.*<b title="(?P<N>[^"]+).*', "\g<N>")] +                         (r'.*<b title="(?P<N>.+?)".*', "\g<N>")]      URL_REPLACEMENTS  = [(__pattern__ + ".*", "https://dfiles.eu/files/\g<ID>")]      COOKIES = [("dfiles.eu", "lang_current", "en")] @@ -52,7 +52,8 @@ class DepositfilesCom(SimpleHoster):          params = {'fid': m.group(1)}          self.logDebug("FID: %s" % params['fid']) -        self.wait() +        self.checkErrors() +          recaptcha = ReCaptcha(self)          captcha_key = recaptcha.detect_key()          if captcha_key is None: @@ -66,9 +67,6 @@ class DepositfilesCom(SimpleHoster):          m = re.search(self.LINK_FREE_PATTERN, self.html)          if m: -            if 'response' in params: -                self.correctCaptcha() -              self.link = unquote(m.group(1)) diff --git a/pyload/plugin/hoster/DlFreeFr.py b/pyload/plugin/hoster/DlFreeFr.py index 892d72a6f..22a32bcf4 100644 --- a/pyload/plugin/hoster/DlFreeFr.py +++ b/pyload/plugin/hoster/DlFreeFr.py @@ -49,8 +49,8 @@ class DlFreeFr(SimpleHoster):                         ("Toilal", "toilal.dev@gmail.com")] -    NAME_PATTERN = r'Fichier:</td>\s*<td[^>]*>(?P<N>[^>]*)</td>' -    SIZE_PATTERN = r'Taille:</td>\s*<td[^>]*>(?P<S>[\d.,]+\w)o' +    NAME_PATTERN = r'Fichier:</td>\s*<td.*?>(?P<N>[^>]*)</td>' +    SIZE_PATTERN = r'Taille:</td>\s*<td.*?>(?P<S>[\d.,]+\w)o'      OFFLINE_PATTERN = r'Erreur 404 - Document non trouv|Fichier inexistant|Le fichier demandé n\'a pas été trouvé' diff --git a/pyload/plugin/hoster/EdiskCz.py b/pyload/plugin/hoster/EdiskCz.py index 2fd56eb82..2a8fe867e 100644 --- a/pyload/plugin/hoster/EdiskCz.py +++ b/pyload/plugin/hoster/EdiskCz.py @@ -18,7 +18,7 @@ class EdiskCz(SimpleHoster):      __authors__     = [("zoidberg", "zoidberg@mujmail.cz")] -    INFO_PATTERN = r'<span class="fl" title="(?P<N>[^"]+)">\s*.*?\((?P<S>[\d.,]+) (?P<U>[\w^_]+)\)</h1></span>' +    INFO_PATTERN = r'<span class="fl" title="(?P<N>.+?)">\s*.*?\((?P<S>[\d.,]+) (?P<U>[\w^_]+)\)</h1></span>'      OFFLINE_PATTERN = r'<h3>This file does not exist due to one of the following:</h3><ul><li>'      ACTION_PATTERN = r'/en/download/(\d+/.*\.html)' @@ -51,4 +51,5 @@ class EdiskCz(SimpleHoster):          if not re.match(self.LINK_FREE_PATTERN, url):              self.fail(_("Unexpected server response")) -        self.download(url) +        self.link = url + diff --git a/pyload/plugin/hoster/EuroshareEu.py b/pyload/plugin/hoster/EuroshareEu.py index fa0f69d8f..1cb805a90 100644 --- a/pyload/plugin/hoster/EuroshareEu.py +++ b/pyload/plugin/hoster/EuroshareEu.py @@ -34,7 +34,7 @@ class EuroshareEu(SimpleHoster):              self.account.relogin(self.user)              self.retry(reason=_("User not logged in")) -        self.download(pyfile.url.rstrip('/') + "/download/") +        self.link = pyfile.url.rstrip('/') + "/download/"          check = self.checkDownload({"login": re.compile(self.ERR_NOT_LOGGED_IN_PATTERN),                                      "json" : re.compile(r'\{"status":"error".*?"message":"(.*?)"')}) @@ -48,7 +48,7 @@ class EuroshareEu(SimpleHoster):      def handleFree(self, pyfile): -        if re.search(self.ERR_PARDL_PATTERN, self.html) is not None: +        if re.search(self.ERR_PARDL_PATTERN, self.html):              self.longWait(5 * 60, 12)          m = re.search(self.LINK_FREE_PATTERN, self.html) diff --git a/pyload/plugin/hoster/ExtabitCom.py b/pyload/plugin/hoster/ExtabitCom.py index c0fa782fa..8614f439d 100644 --- a/pyload/plugin/hoster/ExtabitCom.py +++ b/pyload/plugin/hoster/ExtabitCom.py @@ -21,7 +21,7 @@ class ExtabitCom(SimpleHoster):      __authors__     = [("zoidberg", "zoidberg@mujmail.cz")] -    NAME_PATTERN = r'<th>File:</th>\s*<td class="col-fileinfo">\s*<div title="(?P<N>[^"]+)">' +    NAME_PATTERN = r'<th>File:</th>\s*<td class="col-fileinfo">\s*<div title="(?P<N>.+?)">'      SIZE_PATTERN = r'<th>Size:</th>\s*<td class="col-fileinfo">(?P<S>[^<]+)</td>'      OFFLINE_PATTERN = r'>File not found<'      TEMP_OFFLINE_PATTERN = r'>(File is temporary unavailable|No download mirror)<' @@ -72,5 +72,5 @@ class ExtabitCom(SimpleHoster):          if m is None:              self.error(_("LINK_FREE_PATTERN not found")) -        url = m.group(1) -        self.download(url) +        self.link = m.group(1) + diff --git a/pyload/plugin/hoster/FileSharkPl.py b/pyload/plugin/hoster/FileSharkPl.py index ab28ac144..b0b0c558b 100644 --- a/pyload/plugin/hoster/FileSharkPl.py +++ b/pyload/plugin/hoster/FileSharkPl.py @@ -10,7 +10,7 @@ from pyload.plugin.internal.SimpleHoster import SimpleHoster  class FileSharkPl(SimpleHoster):      __name__    = "FileSharkPl"      __type__    = "hoster" -    __version__ = "0.09" +    __version__ = "0.10"      __pattern__ = r'http://(?:www\.)?fileshark\.pl/pobierz/\d+/\w+'      __config__  = [("use_premium", "bool", "Use premium account if available", True)] @@ -25,8 +25,8 @@ class FileSharkPl(SimpleHoster):      SIZE_PATTERN    = r'<p class="size-file">(.*?)<strong>(?P<S>\d+\.?\d*)\s(?P<U>\w+)</strong></p>'      OFFLINE_PATTERN = r'(P|p)lik zosta. (usuni.ty|przeniesiony)' -    LINK_FREE_PATTERN    = r'<a href="(.*?)" class="btn-upload-free">' -    LINK_PREMIUM_PATTERN = r'<a href="(.*?)" class="btn-upload-premium">' +    LINK_FREE_PATTERN    = r'<a  rel="nofollow" href="(.*?)" class="btn-upload-free">' +    LINK_PREMIUM_PATTERN = r'<a rel="nofollow" href="(.*?)" class="btn-upload-premium">'      WAIT_PATTERN       = r'var timeToDownload = (\d+);'      ERROR_PATTERN      = r'<p class="lead text-center alert alert-warning">(.*?)</p>' diff --git a/pyload/plugin/hoster/FilecloudIo.py b/pyload/plugin/hoster/FilecloudIo.py index aa3321016..601f72892 100644 --- a/pyload/plugin/hoster/FilecloudIo.py +++ b/pyload/plugin/hoster/FilecloudIo.py @@ -104,8 +104,7 @@ class FilecloudIo(SimpleHoster):              if "size" in self.info and self.info['size']:                  self.check_data = {"size": int(self.info['size'])} -            download_url = m.group(1) -            self.download(download_url) +            self.link = m.group(1)          else:              self.fail(_("Unexpected server response")) diff --git a/pyload/plugin/hoster/FilejungleCom.py b/pyload/plugin/hoster/FilejungleCom.py index cd890778b..025b98aed 100644 --- a/pyload/plugin/hoster/FilejungleCom.py +++ b/pyload/plugin/hoster/FilejungleCom.py @@ -19,7 +19,7 @@ class FilejungleCom(FileserveCom):      URLS = ["http://www.filejungle.com/f/", "http://www.filejungle.com/check_links.php",              "http://www.filejungle.com/checkReCaptcha.php"]      LINKCHECK_TR = r'<li>\s*(<div class="col1">.*?)</li>' -    LINKCHECK_TD = r'<div class="(?:col )?col\d">(?:<[^>]*>| )*([^<]*)' +    LINKCHECK_TD = r'<div class="(?:col )?col\d">(?:<.*?>| )*([^<]*)'      LONG_WAIT_PATTERN = r'<h1>Please wait for (\d+) (\w+)\s*to download the next file\.</h1>' diff --git a/pyload/plugin/hoster/FilepostCom.py b/pyload/plugin/hoster/FilepostCom.py index 4e611fc8e..82ba5f16f 100644 --- a/pyload/plugin/hoster/FilepostCom.py +++ b/pyload/plugin/hoster/FilepostCom.py @@ -21,7 +21,7 @@ class FilepostCom(SimpleHoster):      __authors__     = [("zoidberg", "zoidberg@mujmail.cz")] -    INFO_PATTERN = r'<input type="text" id="url" value=\'<a href[^>]*>(?P<N>[^>]+?) - (?P<S>[\d.,]+) (?P<U>[\w^_]+)</a>\' class="inp_text"/>' +    INFO_PATTERN = r'<input type="text" id="url" value=\'<a href.*?>(?P<N>[^>]+?) - (?P<S>[\d.,]+) (?P<U>[\w^_]+)</a>\' class="inp_text"/>'      OFFLINE_PATTERN = r'class="error_msg_title"> Invalid or Deleted File. </div>|<div class="file_info file_info_deleted">'      PREMIUM_ONLY_PATTERN = r'members only. Please upgrade to premium|a premium membership is required to download this file' @@ -79,20 +79,11 @@ class FilepostCom(SimpleHoster):                      self.logDebug(u"RECAPTCHA: %s : %s : %s" % (                          captcha_key, post_dict['recaptcha_challenge_field'], post_dict['recaptcha_response_field'])) -                download_url = self.getJsonResponse(get_dict, post_dict, 'link') -                if download_url: -                    if i: -                        self.correctCaptcha() -                    break -                elif i: -                    self.invalidCaptcha() +                self.link = self.getJsonResponse(get_dict, post_dict, 'link')              else:                  self.fail(_("Invalid captcha")) -        # Download -        self.download(download_url) -      def getJsonResponse(self, get_dict, post_dict, field):          res = json_loads(self.load('https://filepost.com/files/get/', get=get_dict, post=post_dict)) diff --git a/pyload/plugin/hoster/FileserveCom.py b/pyload/plugin/hoster/FileserveCom.py index eb80889b1..34ab3d790 100644 --- a/pyload/plugin/hoster/FileserveCom.py +++ b/pyload/plugin/hoster/FileserveCom.py @@ -48,7 +48,7 @@ class FileserveCom(Hoster):      URLS = ["http://www.fileserve.com/file/", "http://www.fileserve.com/link-checker.php",              "http://www.fileserve.com/checkReCaptcha.php"]      LINKCHECK_TR = r'<tr>\s*(<td>http://www\.fileserve\.com/file/.*?)</tr>' -    LINKCHECK_TD = r'<td>(?:<[^>]*>| )*([^<]*)' +    LINKCHECK_TD = r'<td>(?:<.*?>| )*([^<]*)'      CAPTCHA_KEY_PATTERN = r'var reCAPTCHA_publickey=\'(.+?)\''      LONG_WAIT_PATTERN = r'<li class="title">You need to wait (\d+) (\w+) to start another download\.</li>' diff --git a/pyload/plugin/hoster/FlyFilesNet.py b/pyload/plugin/hoster/FlyFilesNet.py index 612de14bd..a122199f8 100644 --- a/pyload/plugin/hoster/FlyFilesNet.py +++ b/pyload/plugin/hoster/FlyFilesNet.py @@ -41,6 +41,4 @@ class FlyFilesNet(SimpleHoster):              self.wait(10 * 60, True)              self.retry() -        download_url = parsed_url.replace('#downlink|', '') - -        self.download(download_url) +        self.link = parsed_url.replace('#downlink|', '') diff --git a/pyload/plugin/hoster/FreakshareCom.py b/pyload/plugin/hoster/FreakshareCom.py index 53eb10e55..078293120 100644 --- a/pyload/plugin/hoster/FreakshareCom.py +++ b/pyload/plugin/hoster/FreakshareCom.py @@ -107,12 +107,14 @@ class FreakshareCom(Hoster):      def get_file_name(self):          if not self.html:              self.download_html() +          if not self.wantReconnect: -            file_name = re.search(r"<h1\sclass=\"box_heading\"\sstyle=\"text-align:center;\">([^ ]+)", self.html) -            if file_name is not None: -                file_name = file_name.group(1) +            m = re.search(r"<h1\sclass=\"box_heading\"\sstyle=\"text-align:center;\">([^ ]+)", self.html) +            if m: +                file_name = m.group(1)              else:                  file_name = self.pyfile.url +              return file_name          else:              return self.pyfile.url @@ -122,12 +124,12 @@ class FreakshareCom(Hoster):          size = 0          if not self.html:              self.download_html() +          if not self.wantReconnect: -            file_size_check = re.search( -                r"<h1\sclass=\"box_heading\"\sstyle=\"text-align:center;\">[^ ]+ - ([^ ]+) (\w\w)yte", self.html) -            if file_size_check is not None: -                units = float(file_size_check.group(1).replace(",", "")) -                pow = {'KB': 1, 'MB': 2, 'GB': 3}[file_size_check.group(2)] +            m = re.search(r"<h1\sclass=\"box_heading\"\sstyle=\"text-align:center;\">[^ ]+ - ([^ ]+) (\w\w)yte", self.html) +            if m: +                units = float(m.group(1).replace(",", "")) +                pow = {'KB': 1, 'MB': 2, 'GB': 3}[m.group(2)]                  size = int(units * 1024 ** pow)          return size @@ -153,7 +155,7 @@ class FreakshareCom(Hoster):          """          if not self.html:              self.download_html() -        if re.search(r"This file does not exist!", self.html) is not None: +        if re.search(r"This file does not exist!", self.html):              return False          else:              return True diff --git a/pyload/plugin/hoster/Ftp.py b/pyload/plugin/hoster/Ftp.py index 6924c5910..d7aaa730e 100644 --- a/pyload/plugin/hoster/Ftp.py +++ b/pyload/plugin/hoster/Ftp.py @@ -12,7 +12,7 @@ from pyload.plugin.Hoster import Hoster  class Ftp(Hoster):      __name__    = "Ftp"      __type__    = "hoster" -    __version__ = "0.46" +    __version__ = "0.49"      __pattern__ = r'(?:ftps?|sftp)://([\w.-]+(:[\w.-]+)?@)?[\w.-]+(:\d+)?/.+' @@ -28,6 +28,16 @@ class Ftp(Hoster):          self.resumeDownload = True +    #: Work-around to `filename*=UTF-8` bug; remove in 0.4.10 +    def download(self, url, get={}, post={}, ref=True, cookies=True, disposition=False): +        try: +            if disposition: +                content = urllib2.urlopen(url).info()['Content-Disposition'].split(';') +                self.pyfile.name = content[1].split('filename=')[1][1:-1] or self.pyfile.name +        finally: +            return super(Ftp, self).download(url, get, post, ref, cookies, False) + +      def process(self, pyfile):          parsed_url = urlparse(pyfile.url)          netloc = parsed_url.netloc diff --git a/pyload/plugin/hoster/GigapetaCom.py b/pyload/plugin/hoster/GigapetaCom.py index 6397882f8..e9351eac1 100644 --- a/pyload/plugin/hoster/GigapetaCom.py +++ b/pyload/plugin/hoster/GigapetaCom.py @@ -43,14 +43,13 @@ class GigapetaCom(SimpleHoster):              m = re.search(r'Location\s*:\s*(.+)', self.req.http.header, re.I)              if m: -                download_url = m.group(1) +                self.link = m.group(1).rstrip()  #@TODO: Remove .rstrip() in 0.4.10                  break              elif "Entered figures don`t coincide with the picture" in self.html:                  self.invalidCaptcha()          else:              self.fail(_("No valid captcha code entered")) -        self.download(download_url)      def checkErrors(self): diff --git a/pyload/plugin/hoster/GooIm.py b/pyload/plugin/hoster/GooIm.py index 0556e9804..77a2603c9 100644 --- a/pyload/plugin/hoster/GooIm.py +++ b/pyload/plugin/hoster/GooIm.py @@ -32,4 +32,5 @@ class GooIm(SimpleHoster):      def handleFree(self, pyfile):          self.wait(10) -        self.download(pyfile.url) +        self.link = pyfile.url + diff --git a/pyload/plugin/hoster/GoogledriveCom.py b/pyload/plugin/hoster/GoogledriveCom.py index 8ae3664a3..746377a53 100644 --- a/pyload/plugin/hoster/GoogledriveCom.py +++ b/pyload/plugin/hoster/GoogledriveCom.py @@ -12,7 +12,7 @@ from pyload.utils import html_unescape  class GoogledriveCom(SimpleHoster):      __name__    = "GoogledriveCom"      __type__    = "hoster" -    __version__ = "0.03" +    __version__ = "0.07"      __pattern__ = r'https?://(?:www\.)?drive\.google\.com/file/.+'      __config__  = [("use_premium", "bool", "Use premium account if available", True)] @@ -22,8 +22,6 @@ class GoogledriveCom(SimpleHoster):      __authors__     = [("zapp-brannigan", "fuerst.reinje@web.de")] -    DISPOSITION = False -      NAME_PATTERN    = r'"og:title" content="(?P<N>.*?)">'      OFFLINE_PATTERN = r'align="center"><p class="errorMessage"' diff --git a/pyload/plugin/hoster/HugefilesNet.py b/pyload/plugin/hoster/HugefilesNet.py index 413191c52..828e4e79c 100644 --- a/pyload/plugin/hoster/HugefilesNet.py +++ b/pyload/plugin/hoster/HugefilesNet.py @@ -17,6 +17,6 @@ class HugefilesNet(XFSHoster):      __authors__     = [("stickell", "l.stickell@yahoo.it")] -    SIZE_PATTERN = r'File Size:</span>\s*<span[^>]*>(?P<S>[^<]+)</span></div>' +    SIZE_PATTERN = r'File Size:</span>\s*<span.*?>(?P<S>[^<]+)</span></div>'      FORM_INPUTS_MAP = {'ctype': re.compile(r'\d+')} diff --git a/pyload/plugin/hoster/IfolderRu.py b/pyload/plugin/hoster/IfolderRu.py index 04c19ace5..f87c01e66 100644 --- a/pyload/plugin/hoster/IfolderRu.py +++ b/pyload/plugin/hoster/IfolderRu.py @@ -10,7 +10,7 @@ class IfolderRu(SimpleHoster):      __type__    = "hoster"      __version__ = "0.39" -    __pattern__ = r'http://(?:www\.)?(?:ifolder\.ru|rusfolder\.(?:com|net|ru))/(?:files/)?(?P<ID>\d+)' +    __pattern__ = r'http://(?:www)?(files\.)?(ifolder\.ru|metalarea\.org|rusfolder\.(com|net|ru))/(files/)?(?P<ID>\d+)'      __config__  = [("use_premium", "bool", "Use premium account if available", True)]      __description__ = """Ifolder.ru hoster plugin""" @@ -22,13 +22,13 @@ class IfolderRu(SimpleHoster):      NAME_PATTERN    = ur'(?:<div><span>)?Название:(?:</span>)? <b>(?P<N>[^<]+)</b><(?:/div|br)>'      SIZE_PATTERN    = ur'(?:<div><span>)?Размер:(?:</span>)? <b>(?P<S>[^<]+)</b><(?:/div|br)>' -    OFFLINE_PATTERN = ur'<p>Файл номер <b>[^<]*</b> (не найден|удален) !!!</p>' +    OFFLINE_PATTERN = ur'<p>Файл номер <b>.*?</b> (не найден|удален) !!!</p>' -    SESSION_ID_PATTERN = r'<a href=(http://ints\.(?:rusfolder\.com|ifolder\.ru)/ints/sponsor/\?bi=\d*&session=([^&]+)&u=[^>]+)>' -    INTS_SESSION_PATTERN = r'\(\'ints_session\'\);\s*if\(tag\)\{tag\.value = "([^"]+)";\}' +    SESSION_ID_PATTERN = r'<input type="hidden" name="session" value="(.+?)"' +    INTS_SESSION_PATTERN = r'\(\'ints_session\'\);\s*if\(tag\)\{tag\.value = "(.+?)";\}'      HIDDEN_INPUT_PATTERN = r'var v = .*?name=\'(.+?)\' value=\'1\'' -    LINK_FREE_PATTERN = r'<a id="download_file_href" href="([^"]+)"' +    LINK_FREE_PATTERN = r'<a href="(.+?)" class="downloadbutton_files"'      WRONG_CAPTCHA_PATTERN = ur'<font color=Red>неверный код,<br>введите еще раз</font><br>' @@ -39,26 +39,15 @@ class IfolderRu(SimpleHoster):      def handleFree(self, pyfile): +        url = "http://rusfolder.com/%s" % self.info['pattern']['ID']          self.html = self.load("http://rusfolder.com/%s" % self.info['pattern']['ID'], decode=True)          self.getFileInfo() -        url = re.search(r"location\.href = '(http://ints\..*?=)'", self.html).group(1) -        self.html = self.load(url, decode=True) - -        url, session_id = re.search(self.SESSION_ID_PATTERN, self.html).groups() -        self.html = self.load(url, decode=True) - -        url = "http://ints.rusfolder.com/ints/frame/?session=%s" % session_id -        self.html = self.load(url) - -        self.wait(31, False) +        session_id = re.search(self.SESSION_ID_PATTERN, self.html).groups()          captcha_url = "http://ints.rusfolder.com/random/images/?session=%s" % session_id          for _i in xrange(5): -            self.html = self.load(url) -            action, inputs = self.parseHtmlForm('ID="Form1"') -            inputs['ints_session'] = re.search(self.INTS_SESSION_PATTERN, self.html).group(1) -            inputs[re.search(self.HIDDEN_INPUT_PATTERN, self.html).group(1)] = '1' +            action, inputs = self.parseHtmlForm('id="download-step-one-form"')              inputs['confirmed_number'] = self.decryptCaptcha(captcha_url, cookies=True)              inputs['action'] = '1'              self.logDebug(inputs) @@ -71,4 +60,5 @@ class IfolderRu(SimpleHoster):          else:              self.fail(_("Invalid captcha")) -        self.link = re.search(self.LINK_PATTERN, self.html).group(1) +        self.link = re.search(self.LINK_FREE_PATTERN, self.html).group(1) + diff --git a/pyload/plugin/hoster/Keep2ShareCc.py b/pyload/plugin/hoster/Keep2ShareCc.py index 67af087b7..6e70e3962 100644 --- a/pyload/plugin/hoster/Keep2ShareCc.py +++ b/pyload/plugin/hoster/Keep2ShareCc.py @@ -22,7 +22,7 @@ class Keep2ShareCc(SimpleHoster):                         ("Walter Purcaro", "vuolter@gmail.com")] -    URL_REPLACEMENTS = [(__pattern__ + ".*", "http://k2s.cc/file/\g<ID>")] +    URL_REPLACEMENTS = [(__pattern__ + ".*", "http://keep2s.cc/file/\g<ID>")]      NAME_PATTERN = r'File: <span>(?P<N>.+)</span>'      SIZE_PATTERN = r'Size: (?P<S>[^<]+)</div>' @@ -30,7 +30,7 @@ class Keep2ShareCc(SimpleHoster):      OFFLINE_PATTERN      = r'File not found or deleted|Sorry, this file is blocked or deleted|Error 404'      TEMP_OFFLINE_PATTERN = r'Downloading blocked due to' -    LINK_FREE_PATTERN    = r'"([^"]+url.html?file=.+?)"|window\.location\.href = \'(.+?)\';' +    LINK_FREE_PATTERN    = r'"(.+?url.html\?file=.+?)"|window\.location\.href = \'(.+?)\';'      LINK_PREMIUM_PATTERN = r'window\.location\.href = \'(.+?)\';'      CAPTCHA_PATTERN = r'src="(/file/captcha\.html.+?)"' @@ -67,18 +67,18 @@ class Keep2ShareCc(SimpleHoster):      def handleFree(self, pyfile): -        self.fid  = re.search(r'<input type="hidden" name="slow_id" value="([^"]+)">', self.html).group(1) +        self.fid  = re.search(r'<input type="hidden" name="slow_id" value="(.+?)">', self.html).group(1)          self.html = self.load(pyfile.url, post={'yt0': '', 'slow_id': self.fid}) +        # self.logDebug(self.fid) +        # self.logDebug(pyfile.url) +          self.checkErrors()          m = re.search(self.LINK_FREE_PATTERN, self.html) -          if m is None:              self.handleCaptcha() - -            self.wait(30) - +            self.wait(31)              self.html = self.load(pyfile.url)              m = re.search(self.LINK_FREE_PATTERN, self.html) @@ -87,17 +87,21 @@ class Keep2ShareCc(SimpleHoster):          self.link = m.group(1)      def handleCaptcha(self): -        recaptcha = ReCaptcha(self)          post_data = {'free'               : 1,                       'freeDownloadRequest': 1,                       'uniqueId'           : self.fid,                       'yt0'                : ''} +        m = re.search(r'id="(captcha\-form)"', self.html) +        self.logDebug("captcha-form found %s" % m) +          m = re.search(self.CAPTCHA_PATTERN, self.html) +        self.logDebug("CAPTCHA_PATTERN found %s" % m)          if m: -            captcha_url = urljoin("http://k2s.cc/", m.group(1)) +            captcha_url = urljoin("http://keep2s.cc/", m.group(1))              post_data['CaptchaForm[code]'] = self.decryptCaptcha(captcha_url)          else: +            recaptcha = ReCaptcha(self)              response, challenge = recaptcha.challenge()              post_data.update({'recaptcha_challenge_field': challenge,                                'recaptcha_response_field' : response}) diff --git a/pyload/plugin/hoster/LetitbitNet.py b/pyload/plugin/hoster/LetitbitNet.py index 545cde27c..32b695b10 100644 --- a/pyload/plugin/hoster/LetitbitNet.py +++ b/pyload/plugin/hoster/LetitbitNet.py @@ -119,16 +119,7 @@ class LetitbitNet(SimpleHoster):          else:              self.error(_("Unknown response - captcha check")) -        self.correctCaptcha() - -        for download_url in urls: -            try: -                self.download(download_url) -                break -            except Exception, e: -                self.logError(e) -        else: -            self.fail(_("Download did not finish correctly")) +        self.link = urls[0]      def handlePremium(self, pyfile): diff --git a/pyload/plugin/hoster/LoadTo.py b/pyload/plugin/hoster/LoadTo.py index 157a2f942..19818e7a3 100644 --- a/pyload/plugin/hoster/LoadTo.py +++ b/pyload/plugin/hoster/LoadTo.py @@ -45,7 +45,7 @@ class LoadTo(SimpleHoster):          if m is None:              self.error(_("LINK_FREE_PATTERN not found")) -        download_url = m.group(1) +        self.link = m.group(1)          # Set Timer - may be obsolete          m = re.search(self.WAIT_PATTERN, self.html) @@ -56,11 +56,9 @@ class LoadTo(SimpleHoster):          solvemedia  = SolveMedia(self)          captcha_key = solvemedia.detect_key() -        if captcha_key is None: -            self.download(download_url) -        else: +        if captcha_key:              response, challenge = solvemedia.challenge(captcha_key) -            self.download(download_url, +            self.download(self.link,                            post={'adcopy_challenge': challenge,                                  'adcopy_response' : response,                                  'returnUrl'       : pyfile.url}) diff --git a/pyload/plugin/hoster/LuckyShareNet.py b/pyload/plugin/hoster/LuckyShareNet.py index 80e92d869..bb9563fc2 100644 --- a/pyload/plugin/hoster/LuckyShareNet.py +++ b/pyload/plugin/hoster/LuckyShareNet.py @@ -69,4 +69,5 @@ class LuckyShareNet(SimpleHoster):          if not json['link']:              self.fail(_("No Download url retrieved/all captcha attempts failed")) -        self.download(json['link']) +        self.link = json['link'] + diff --git a/pyload/plugin/hoster/MediafireCom.py b/pyload/plugin/hoster/MediafireCom.py index 8b05a95ec..683d2272c 100644 --- a/pyload/plugin/hoster/MediafireCom.py +++ b/pyload/plugin/hoster/MediafireCom.py @@ -7,9 +7,9 @@ from pyload.plugin.internal.SimpleHoster import SimpleHoster  class MediafireCom(SimpleHoster):      __name__    = "MediafireCom"      __type__    = "hoster" -    __version__ = "0.85" +    __version__ = "0.86" -    __pattern__ = r'https?://(?:www\.)?mediafire\.com/(file/|view/\??|download(\.php\?|/))\w+' +    __pattern__ = r'https?://(?:www\.)?mediafire\.com/(file/|view/\??|download(\.php\?|/)|\?)\w{15}'      __config__  = [("use_premium", "bool", "Use premium account if available", True)]      __description__ = """Mediafire.com hoster plugin""" diff --git a/pyload/plugin/hoster/MegaRapidCz.py b/pyload/plugin/hoster/MegaRapidCz.py index 9d639555f..25f696e08 100644 --- a/pyload/plugin/hoster/MegaRapidCz.py +++ b/pyload/plugin/hoster/MegaRapidCz.py @@ -36,13 +36,13 @@ class MegaRapidCz(SimpleHoster):                         ("Walter Purcaro", "vuolter@gmail.com")] -    NAME_PATTERN = r'<h1[^>]*><span[^>]*>(?:<a[^>]*>)?(?P<N>[^<]+)' +    NAME_PATTERN = r'<h1.*?><span.*?>(?:<a.*?>)?(?P<N>[^<]+)'      SIZE_PATTERN = r'<td class="i">Velikost:</td>\s*<td class="h"><strong>\s*(?P<S>[\d.,]+) (?P<U>[\w^_]+)</strong></td>'      OFFLINE_PATTERN = ur'Nastala chyba 404|Soubor byl smazán'      CHECK_TRAFFIC = True -    LINK_PREMIUM_PATTERN = r'<a href="([^"]+)" title="Stahnout">([^<]+)</a>' +    LINK_PREMIUM_PATTERN = r'<a href="(.+?)" title="Stahnout">([^<]+)</a>'      ERR_LOGIN_PATTERN  = ur'<div class="error_div"><strong>Stahování je přístupné pouze přihlášeným uživatelům'      ERR_CREDIT_PATTERN = ur'<div class="error_div"><strong>Stahování zdarma je možné jen přes náš' diff --git a/pyload/plugin/hoster/MegaRapidoNet.py b/pyload/plugin/hoster/MegaRapidoNet.py index 938b201d5..f9d091507 100644 --- a/pyload/plugin/hoster/MegaRapidoNet.py +++ b/pyload/plugin/hoster/MegaRapidoNet.py @@ -8,8 +8,8 @@ from pyload.plugin.internal.MultiHoster import MultiHoster  def random_with_N_digits(n):      rand = "0."      not_zero = 0 -    for i in range(1,n+1): -        r = randint(0,9) +    for i in range(1, n + 1): +        r = randint(0, 9)          if(r > 0):              not_zero += 1          rand += str(r) @@ -33,9 +33,9 @@ class MegaRapidoNet(MultiHoster):      __authors__     = [("Kagenoshin", "kagenoshin@gmx.ch")] -    LINK_PREMIUM_PATTERN = r'<\s*?a[^>]*?title\s*?=\s*?["\'][^"\']*?download["\'][^>]*?href=["\']([^"\']*)' +    LINK_PREMIUM_PATTERN = r'<\s*?a[^>]*?title\s*?=\s*?["\'].*?download["\'][^>]*?href=["\']([^"\']+)' -    ERROR_PATTERN = r'<\s*?div[^>]*?class\s*?=\s*?["\']?alert-message error[^>]*>([^<]*)' +    ERROR_PATTERN = r'<\s*?div[^>]*?class\s*?=\s*?["\']?alert-message error.*?>([^<]*)'      def handlePremium(self, pyfile): diff --git a/pyload/plugin/hoster/MegasharesCom.py b/pyload/plugin/hoster/MegasharesCom.py index ed07f373b..f7ad28f68 100644 --- a/pyload/plugin/hoster/MegasharesCom.py +++ b/pyload/plugin/hoster/MegasharesCom.py @@ -20,17 +20,17 @@ class MegasharesCom(SimpleHoster):                         ("Walter Purcaro", "vuolter@gmail.com")] -    NAME_PATTERN = r'<h1 class="black xxl"[^>]*title="(?P<N>[^"]+)">' +    NAME_PATTERN = r'<h1 class="black xxl"[^>]*title="(?P<N>.+?)">'      SIZE_PATTERN = r'<strong><span class="black">Filesize:</span></strong> (?P<S>[\d.,]+) (?P<U>[\w^_]+)'      OFFLINE_PATTERN = r'<dd class="red">(Invalid Link Request|Link has been deleted|Invalid link)' -    LINK_PATTERN = r'<div id="show_download_button_%d"[^>]*>\s*<a href="([^"]+)">' +    LINK_PATTERN = r'<div id="show_download_button_%d".*?>\s*<a href="(.+?)">' -    PASSPORT_LEFT_PATTERN = r'Your Download Passport is: <[^>]*>(\w+).*?You have.*?<[^>]*>.*?([\d.]+) (\w+)' +    PASSPORT_LEFT_PATTERN = r'Your Download Passport is: <.*?>(\w+).*?You have.*?<.*?>.*?([\d.]+) (\w+)'      PASSPORT_RENEW_PATTERN = r'(\d+):<strong>(\d+)</strong>:<strong>(\d+)</strong>'      REACTIVATE_NUM_PATTERN = r'<input[^>]*id="random_num" value="(\d+)" />'      REACTIVATE_PASSPORT_PATTERN = r'<input[^>]*id="passport_num" value="(\w+)" />' -    REQUEST_URI_PATTERN = r'var request_uri = "([^"]+)";' +    REQUEST_URI_PATTERN = r'var request_uri = "(.+?)";'      NO_SLOTS_PATTERN = r'<dd class="red">All download slots for this link are currently filled' @@ -105,6 +105,6 @@ class MegasharesCom(SimpleHoster):          if m is None:              self.error(msg) -        download_url = m.group(1) -        self.logDebug("%s: %s" % (msg, download_url)) -        self.download(download_url) +        self.link = m.group(1) +        self.logDebug("%s: %s" % (msg, self.link)) + diff --git a/pyload/plugin/hoster/MovReelCom.py b/pyload/plugin/hoster/MovReelCom.py index f273d623a..d1833c947 100644 --- a/pyload/plugin/hoster/MovReelCom.py +++ b/pyload/plugin/hoster/MovReelCom.py @@ -15,4 +15,5 @@ class MovReelCom(XFSHoster):      __authors__     = [("JorisV83", "jorisv83-pyload@yahoo.com")] -    LINK_PATTERN = r'<a href="([^"]+)">Download Link' +    LINK_PATTERN = r'<a href="(.+?)">Download Link' + diff --git a/pyload/plugin/hoster/NarodRu.py b/pyload/plugin/hoster/NarodRu.py index 6cd9d57cc..e587ece44 100644 --- a/pyload/plugin/hoster/NarodRu.py +++ b/pyload/plugin/hoster/NarodRu.py @@ -48,7 +48,7 @@ class NarodRu(SimpleHoster):              m = re.search(self.LINK_FREE_PATTERN, self.html)              if m: -                url = 'http://narod.ru' + m.group(1) +                self.link = 'http://narod.ru' + m.group(1)                  self.correctCaptcha()                  break @@ -61,4 +61,3 @@ class NarodRu(SimpleHoster):          else:              self.fail(_("No valid captcha code entered")) -        self.download(url) diff --git a/pyload/plugin/hoster/NetloadIn.py b/pyload/plugin/hoster/NetloadIn.py index 2055da5e4..9c049668b 100644 --- a/pyload/plugin/hoster/NetloadIn.py +++ b/pyload/plugin/hoster/NetloadIn.py @@ -268,7 +268,7 @@ class NetloadIn(Hoster):          try:              file_url_pattern = r'<a class="Orange_Link" href="(http://.+)".?>Or click here'              attempt = re.search(file_url_pattern, page) -            if attempt is not None: +            if attempt:                  return attempt.group(1)              else:                  self.logDebug("Backup try for final link") diff --git a/pyload/plugin/hoster/NovafileCom.py b/pyload/plugin/hoster/NovafileCom.py index e79ba5980..3bb4760ce 100644 --- a/pyload/plugin/hoster/NovafileCom.py +++ b/pyload/plugin/hoster/NovafileCom.py @@ -20,7 +20,7 @@ class NovafileCom(XFSHoster):                         ("stickell", "l.stickell@yahoo.it")] -    ERROR_PATTERN = r'class="alert[^"]*alert-separate"[^>]*>\s*(?:<p>)?(.*?)\s*</' -    WAIT_PATTERN  = r'<p>Please wait <span id="count"[^>]*>(\d+)</span> seconds</p>' +    ERROR_PATTERN = r'class="alert.+?alert-separate".*?>\s*(?:<p>)?(.*?)\s*</' +    WAIT_PATTERN  = r'<p>Please wait <span id="count".*?>(\d+)</span> seconds</p>'      LINK_PATTERN = r'<a href="(http://s\d+\.novafile\.com/.*?)" class="btn btn-green">Download File</a>' diff --git a/pyload/plugin/hoster/NowDownloadSx.py b/pyload/plugin/hoster/NowDownloadSx.py index 1cc009b30..77b1b1d27 100644 --- a/pyload/plugin/hoster/NowDownloadSx.py +++ b/pyload/plugin/hoster/NowDownloadSx.py @@ -28,7 +28,7 @@ class NowDownloadSx(SimpleHoster):      WAIT_PATTERN = r'\.countdown\(\{until: \+(\d+),'      LINK_FREE_PATTERN = r'(http://s\d+\.coolcdn\.info/nowdownload/.+?)["\']' -    NAME_REPLACEMENTS = [("&#?\w+;", fixup), (r'<[^>]*>', '')] +    NAME_REPLACEMENTS = [("&#?\w+;", fixup), (r'<.*?>', '')]      def setup(self): @@ -55,8 +55,9 @@ class NowDownloadSx(SimpleHoster):          self.html = self.load(baseurl + str(continuelink.group(1))) -        url = re.search(self.LINK_FREE_PATTERN, self.html) -        if url is None: +        m = re.search(self.LINK_FREE_PATTERN, self.html) +        if m is None:              self.error(_("Download link not found")) -        self.download(str(url.group(1))) +        self.link = m.group(1) + diff --git a/pyload/plugin/hoster/NowVideoSx.py b/pyload/plugin/hoster/NowVideoSx.py index 3501c5219..423f08ccd 100644 --- a/pyload/plugin/hoster/NowVideoSx.py +++ b/pyload/plugin/hoster/NowVideoSx.py @@ -39,4 +39,5 @@ class NowVideoSx(SimpleHoster):          if m is None:              self.error(_("Free download link not found")) -        self.download(m.group(1)) +        self.link = m.group(1) + diff --git a/pyload/plugin/hoster/OneFichierCom.py b/pyload/plugin/hoster/OneFichierCom.py index dd8064585..fc79b7502 100644 --- a/pyload/plugin/hoster/OneFichierCom.py +++ b/pyload/plugin/hoster/OneFichierCom.py @@ -8,7 +8,7 @@ from pyload.plugin.internal.SimpleHoster import SimpleHoster  class OneFichierCom(SimpleHoster):      __name__    = "OneFichierCom"      __type__    = "hoster" -    __version__ = "0.79" +    __version__ = "0.83"      __pattern__ = r'https?://(?:www\.)?(?:(?P<ID1>\w+)\.)?(?P<HOST>1fichier\.com|alterupload\.com|cjoint\.net|d(es)?fichiers\.com|dl4free\.com|megadl\.fr|mesfichiers\.org|piecejointe\.net|pjointe\.com|tenvoi\.com)(?:/\?(?P<ID2>\w+))?'      __config__  = [("use_premium", "bool", "Use premium account if available", True)] @@ -21,7 +21,8 @@ class OneFichierCom(SimpleHoster):                         ("imclem", ""),                         ("stickell", "l.stickell@yahoo.it"),                         ("Elrick69", "elrick69[AT]rocketmail[DOT]com"), -                       ("Walter Purcaro", "vuolter@gmail.com")] +                       ("Walter Purcaro", "vuolter@gmail.com"), +                       ("Ludovic Lehmann", "ludo.lehmann@gmail.com")]      NAME_PATTERN = r'>FileName :</td>\s*<td.*>(?P<N>.+?)<' @@ -30,7 +31,6 @@ class OneFichierCom(SimpleHoster):      OFFLINE_PATTERN = r'File not found !\s*<'      COOKIES     = [("1fichier.com", "LG", "en")] -    DISPOSITION = False  #: Remove in 0.4.10      WAIT_PATTERN = r'>You must wait \d+ minutes' diff --git a/pyload/plugin/hoster/OverLoadMe.py b/pyload/plugin/hoster/OverLoadMe.py index 35360c28a..1aab372b1 100644 --- a/pyload/plugin/hoster/OverLoadMe.py +++ b/pyload/plugin/hoster/OverLoadMe.py @@ -42,7 +42,7 @@ class OverLoadMe(MultiHoster):              self.logWarning(data['msg'])              self.tempOffline()          else: -            if pyfile.name is not None and pyfile.name.endswith('.tmp') and data['filename']: +            if pyfile.name and pyfile.name.endswith('.tmp') and data['filename']:                  pyfile.name = data['filename']                  pyfile.size = parseFileSize(data['filesize']) diff --git a/pyload/plugin/hoster/PornhubCom.py b/pyload/plugin/hoster/PornhubCom.py index 9f8a5eec2..08ff52891 100644 --- a/pyload/plugin/hoster/PornhubCom.py +++ b/pyload/plugin/hoster/PornhubCom.py @@ -64,7 +64,7 @@ class PornhubCom(Hoster):          if not self.html:              self.download_html() -        m = re.search(r'<title[^>]+>([^<]+) - ', self.html) +        m = re.search(r'<title.+?>([^<]+) - ', self.html)          if m:              name = m.group(1)          else: @@ -83,7 +83,7 @@ class PornhubCom(Hoster):          if not self.html:              self.download_html() -        if re.search(r'This video is no longer in our database or is in conversion', self.html) is not None: +        if re.search(r'This video is no longer in our database or is in conversion', self.html):              return False          else:              return True diff --git a/pyload/plugin/hoster/PromptfileCom.py b/pyload/plugin/hoster/PromptfileCom.py index f550fa573..f2e5431ec 100644 --- a/pyload/plugin/hoster/PromptfileCom.py +++ b/pyload/plugin/hoster/PromptfileCom.py @@ -18,10 +18,10 @@ class PromptfileCom(SimpleHoster):      __authors__     = [("igel", "igelkun@myopera.com")] -    INFO_PATTERN = r'<span style="[^"]*" title="[^"]*">(?P<N>.*?) \((?P<S>[\d.,]+) (?P<U>[\w^_]+)\)</span>' -    OFFLINE_PATTERN = r'<span style="[^"]*" title="File Not Found">File Not Found</span>' +    INFO_PATTERN = r'<span style=".+?" title=".+?">(?P<N>.*?) \((?P<S>[\d.,]+) (?P<U>[\w^_]+)\)</span>' +    OFFLINE_PATTERN = r'<span style=".+?" title="File Not Found">File Not Found</span>' -    CHASH_PATTERN = r'<input type="hidden" name="chash" value="([^"]*)" />' +    CHASH_PATTERN = r'<input type="hidden" name="chash" value="(.+?)" />'      LINK_FREE_PATTERN = r'<a href=\"(.+)\" target=\"_blank\" class=\"view_dl_link\">Download File</a>' diff --git a/pyload/plugin/hoster/QuickshareCz.py b/pyload/plugin/hoster/QuickshareCz.py index 570c9f876..fb6e4e85c 100644 --- a/pyload/plugin/hoster/QuickshareCz.py +++ b/pyload/plugin/hoster/QuickshareCz.py @@ -28,7 +28,7 @@ class QuickshareCz(SimpleHoster):          self.getFileInfo()          # parse js variables -        self.jsvars = dict((x, y.strip("'")) for x, y in re.findall(r"var (\w+) = ([\d.]+|'[^']*')", self.html)) +        self.jsvars = dict((x, y.strip("'")) for x, y in re.findall(r"var (\w+) = ([\d.]+|'.+?')", self.html))          self.logDebug(self.jsvars)          pyfile.name = self.jsvars['ID3'] @@ -64,11 +64,12 @@ class QuickshareCz(SimpleHoster):          m = re.search(r'Location\s*:\s*(.+)', self.header, re.I)          if m is None:              self.fail(_("File not found")) -        download_url = m.group(1) -        self.logDebug("FREE URL2:" + download_url) + +        self.link = m.group(1).rstrip()  #@TODO: Remove .rstrip() in 0.4.10 +        self.logDebug("FREE URL2:" + self.link)          # check errors -        m = re.search(r'/chyba/(\d+)', download_url) +        m = re.search(r'/chyba/(\d+)', self.link)          if m:              if m.group(1) == '1':                  self.retry(60, 2 * 60, "This IP is already downloading") @@ -77,9 +78,6 @@ class QuickshareCz(SimpleHoster):              else:                  self.fail(_("Error %d") % m.group(1)) -        # download file -        self.download(download_url) -      def handlePremium(self, pyfile):          download_url = '%s/download_premium.php' % self.jsvars['server'] diff --git a/pyload/plugin/hoster/RapidgatorNet.py b/pyload/plugin/hoster/RapidgatorNet.py index 98a8b97c9..ecddd00b3 100644 --- a/pyload/plugin/hoster/RapidgatorNet.py +++ b/pyload/plugin/hoster/RapidgatorNet.py @@ -45,7 +45,7 @@ class RapidgatorNet(SimpleHoster):      LINK_FREE_PATTERN = r'return \'(http://\w+.rapidgator.net/.*)\';'      RECAPTCHA_PATTERN  = r'"http://api\.recaptcha\.net/challenge\?k=(.*?)"' -    ADSCAPTCHA_PATTERN = r'(http://api\.adscaptcha\.com/Get\.aspx[^"\']*)' +    ADSCAPTCHA_PATTERN = r'(http://api\.adscaptcha\.com/Get\.aspx[^"\']+)'      SOLVEMEDIA_PATTERN = r'http://api\.solvemedia\.com/papi/challenge\.script\?k=(.*?)"' diff --git a/pyload/plugin/hoster/RapiduNet.py b/pyload/plugin/hoster/RapiduNet.py index 078365a4a..ef2a3bbe2 100644 --- a/pyload/plugin/hoster/RapiduNet.py +++ b/pyload/plugin/hoster/RapiduNet.py @@ -13,7 +13,7 @@ from pyload.plugin.internal.SimpleHoster import SimpleHoster  class RapiduNet(SimpleHoster):      __name__    = "RapiduNet"      __type__    = "hoster" -    __version__ = "0.07" +    __version__ = "0.08"      __pattern__ = r'https?://(?:www\.)?rapidu\.net/(?P<ID>\d{10})'      __config__  = [("use_premium", "bool", "Use premium account if available", True)] @@ -26,7 +26,7 @@ class RapiduNet(SimpleHoster):      COOKIES = [("rapidu.net", "rapidu_lang", "en")]      INFO_PATTERN    = r'<h1 title="(?P<N>.*)">.*</h1>\s*<small>(?P<S>\d+(\.\d+)?)\s(?P<U>\w+)</small>' -    OFFLINE_PATTERN = r'404 - File not found' +    OFFLINE_PATTERN = r'<h1>404'      ERROR_PATTERN = r'<div class="error">' @@ -58,20 +58,18 @@ class RapiduNet(SimpleHoster):              self.wait(int(jsvars['timeToDownload']) - int(time.time()))          recaptcha = ReCaptcha(self) +        response, challenge = recaptcha.challenge(self.RECAPTCHA_KEY) -        for _i in xrange(10): -            response, challenge = recaptcha.challenge(self.RECAPTCHA_KEY) - -            jsvars = self.getJsonResponse("https://rapidu.net/ajax.php", -                                          get={'a': "getCheckCaptcha"}, -                                          post={'_go'     : "", -                                                'captcha1': challenge, -                                                'captcha2': response, -                                                'fileId'  : self.info['pattern']['ID']}, -                                          decode=True) -            if jsvars['message'] == 'success': -                self.download(jsvars['url']) -                break +        jsvars = self.getJsonResponse("https://rapidu.net/ajax.php", +                                      get={'a': "getCheckCaptcha"}, +                                      post={'_go'     : "", +                                            'captcha1': challenge, +                                            'captcha2': response, +                                            'fileId'  : self.info['pattern']['ID']}, +                                      decode=True) + +        if jsvars['message'] == 'success': +            self.link = jsvars['url']      def getJsonResponse(self, *args, **kwargs): diff --git a/pyload/plugin/hoster/RealdebridCom.py b/pyload/plugin/hoster/RealdebridCom.py index ca303cf88..02e242d72 100644 --- a/pyload/plugin/hoster/RealdebridCom.py +++ b/pyload/plugin/hoster/RealdebridCom.py @@ -44,7 +44,7 @@ class RealdebridCom(MultiHoster):                  self.logWarning(data['message'])                  self.tempOffline()          else: -            if pyfile.name is not None and pyfile.name.endswith('.tmp') and data['file_name']: +            if pyfile.name and pyfile.name.endswith('.tmp') and data['file_name']:                  pyfile.name = data['file_name']              pyfile.size = parseFileSize(data['file_size'])              self.link = data['generated_links'][0][-1] diff --git a/pyload/plugin/hoster/RedtubeCom.py b/pyload/plugin/hoster/RedtubeCom.py index 1f18d09c7..f6bc3f825 100644 --- a/pyload/plugin/hoster/RedtubeCom.py +++ b/pyload/plugin/hoster/RedtubeCom.py @@ -56,7 +56,7 @@ class RedtubeCom(Hoster):          if not self.html:              self.download_html() -        if re.search(r'This video has been removed.', self.html) is not None: +        if re.search(r'This video has been removed.', self.html):              return False          else:              return True diff --git a/pyload/plugin/hoster/RemixshareCom.py b/pyload/plugin/hoster/RemixshareCom.py index 1df62bbba..ffaef3f38 100644 --- a/pyload/plugin/hoster/RemixshareCom.py +++ b/pyload/plugin/hoster/RemixshareCom.py @@ -1,7 +1,7 @@  # -*- coding: utf-8 -*-  #  # Test links: -# http://remixshare.com/download/p946u +# http://remixshare.com/download/z8uli  #  # Note:  # The remixshare.com website is very very slow, so @@ -16,23 +16,26 @@ from pyload.plugin.internal.SimpleHoster import SimpleHoster  class RemixshareCom(SimpleHoster):      __name__    = "RemixshareCom"      __type__    = "hoster" -    __version__ = "0.03" +    __version__ = "0.05"      __pattern__ = r'https?://remixshare\.com/(download|dl)/\w+'      __config__  = [("use_premium", "bool", "Use premium account if available", True)]      __description__ = """Remixshare.com hoster plugin"""      __license__     = "GPLv3" -    __authors__     = [("zapp-brannigan", "fuerst.reinje@web.de"), -                       ("Walter Purcaro", "vuolter@gmail.com")] +    __authors__     = [("zapp-brannigan", "fuerst.reinje@web.de"  ), +                       ("Walter Purcaro", "vuolter@gmail.com"     ), +                       ("sraedler"      , "simon.raedler@yahoo.de")] -    INFO_PATTERN = r'title=\'.+?\'>(?P<N>.+?)</span><span class=\'light2\'> \((?P<S>\d+) (?P<U>[\w^_]+)\)<' -    OFFLINE_PATTERN = r'<h1>Ooops!<' +    INFO_PATTERN    = r'title=\'.+?\'>(?P<N>.+?)</span><span class=\'light2\'> \((?P<S>\d+) (?P<U>[\w^_]+)\)<' +    HASHSUM_PATTERN = r'>(?P<T>MD5): (?P<H>\w+)' +    OFFLINE_PATTERN = r'<h1>Ooops!' -    LINK_FREE_PATTERN = r'(http://remixshare\.com/downloadfinal/.+?)"' +    LINK_PATTERN  = r'var uri = "(.+?)"'      TOKEN_PATTERN = r'var acc = (\d+)' -    WAIT_PATTERN = r'var XYZ = r"(\d+)"' + +    WAIT_PATTERN = r'var XYZ = "(\d+)"'      def setup(self): @@ -41,18 +44,13 @@ class RemixshareCom(SimpleHoster):      def handleFree(self, pyfile): -        b = re.search(self.LINK_FREE_PATTERN, self.html) +        b = re.search(self.LINK_PATTERN, self.html)          if not b: -            self.error(_("Cannot parse download url")) +            self.error(_("File url"))          c = re.search(self.TOKEN_PATTERN, self.html)          if not c: -            self.error(_("Cannot parse file token")) +            self.error(_("File token")) -        self.link = b.group(1) + c.group(1) +        self.link = b.group(1) + "/zzz/" + c.group(1) -        #Check if we have to wait -        seconds = re.search(self.WAIT_PATTERN, self.html) -        if seconds: -            self.logDebug("Wait " + seconds.group(1)) -            self.wait(seconds.group(1)) diff --git a/pyload/plugin/hoster/RgHostNet.py b/pyload/plugin/hoster/RgHostNet.py index 2552b5091..0e7d3de46 100644 --- a/pyload/plugin/hoster/RgHostNet.py +++ b/pyload/plugin/hoster/RgHostNet.py @@ -8,9 +8,9 @@ from pyload.plugin.internal.SimpleHoster import SimpleHoster  class RgHostNet(SimpleHoster):      __name__    = "RgHostNet"      __type__    = "hoster" -    __version__ = "0.03" +    __version__ = "0.04" -    __pattern__ = r'http://(?:www\.)?rghost\.net/\d+(?:r=\d+)?' +    __pattern__ = r'http://(?:www\.)?rghost\.(net|ru)/[\d-]+'      __config__  = [("use_premium", "bool", "Use premium account if available", True)]      __description__ = """RgHost.net hoster plugin""" @@ -18,7 +18,9 @@ class RgHostNet(SimpleHoster):      __authors__     = [("z00nx", "z00nx0@gmail.com")] -    INFO_PATTERN    = r'<h1>\s+(<a[^>]+>)?(?P<N>[^<]+)(</a>)?\s+<small[^>]+>\s+\((?P<S>[^)]+)\)\s+</small>\s+</h1>' -    OFFLINE_PATTERN = r'File is deleted|this page is not found' +    INFO_PATTERN    = r'data-share42-text="(?P<N>.+?) \((?P<S>[\d.,]+) (?P<U>[\w^_]+)' +    HASHSUM_PATTERN = r'<dt>(?P<T>\w+)</dt>\s*<dd>(?P<H>\w+)' +    OFFLINE_PATTERN = r'>(File is deleted|page not found)' + +    LINK_FREE_PATTERN = r'<a href="(.+?)" class="btn large' -    LINK_FREE_PATTERN = r'<a\s+href="([^"]+)"\s+class="btn\s+large\s+download"[^>]+>Download</a>' diff --git a/pyload/plugin/hoster/SendspaceCom.py b/pyload/plugin/hoster/SendspaceCom.py index 5faf2a870..1921317c5 100644 --- a/pyload/plugin/hoster/SendspaceCom.py +++ b/pyload/plugin/hoster/SendspaceCom.py @@ -22,10 +22,10 @@ class SendspaceCom(SimpleHoster):      SIZE_PATTERN    = r'<div class="file_description reverse margin_center">\s*<b>File Size:</b>\s*(?P<S>[\d.,]+)(?P<U>[\w^_]+)\s*</div>'      OFFLINE_PATTERN = r'<div class="msg error" style="cursor: default">Sorry, the file you requested is not available.</div>' -    LINK_FREE_PATTERN = r'<a id="download_button" href="([^"]+)"' +    LINK_FREE_PATTERN = r'<a id="download_button" href="(.+?)"' -    CAPTCHA_PATTERN      = r'<td><img src="(/captchas/captcha\.php?captcha=([^"]+))"></td>' -    USER_CAPTCHA_PATTERN = r'<td><img src="/captchas/captcha\.php?user=([^"]+))"></td>' +    CAPTCHA_PATTERN      = r'<td><img src="(/captchas/captcha\.php?captcha=(.+?))"></td>' +    USER_CAPTCHA_PATTERN = r'<td><img src="/captchas/captcha\.php?user=(.+?))"></td>'      def handleFree(self, pyfile): @@ -35,7 +35,7 @@ class SendspaceCom(SimpleHoster):              if m:                  if 'captcha_hash' in params:                      self.correctCaptcha() -                download_url = m.group(1) +                self.link = m.group(1)                  break              m = re.search(self.CAPTCHA_PATTERN, self.html) @@ -56,4 +56,3 @@ class SendspaceCom(SimpleHoster):          else:              self.fail(_("Download link not found")) -        self.download(download_url) diff --git a/pyload/plugin/hoster/ShareonlineBiz.py b/pyload/plugin/hoster/ShareonlineBiz.py index 5f01b5111..840421a67 100644 --- a/pyload/plugin/hoster/ShareonlineBiz.py +++ b/pyload/plugin/hoster/ShareonlineBiz.py @@ -98,16 +98,14 @@ class ShareonlineBiz(SimpleHoster):          self.checkErrors() -        res          = self.handleCaptcha() -        download_url = res.decode('base64') +        res = self.handleCaptcha() +        self.link = res.decode('base64') -        if not download_url.startswith("http://"): +        if not self.link.startswith("http://"):              self.error(_("Wrong download url"))          self.wait() -        self.download(download_url) -      def checkFile(self, rules={}):          check = self.checkDownload({'cookie': re.compile(r'<div id="dl_failure"'), @@ -145,13 +143,12 @@ class ShareonlineBiz(SimpleHoster):              pyfile.name = dlinfo['name']              pyfile.size = int(dlinfo['size']) -            dlLink = dlinfo['url'] +            self.link = dlinfo['url'] -            if dlLink == "server_under_maintenance": +            if self.link == "server_under_maintenance":                  self.tempOffline()              else:                  self.multiDL = True -                self.download(dlLink)      def checkErrors(self): diff --git a/pyload/plugin/hoster/ShareplaceCom.py b/pyload/plugin/hoster/ShareplaceCom.py index 61e0f8723..35f74d460 100644 --- a/pyload/plugin/hoster/ShareplaceCom.py +++ b/pyload/plugin/hoster/ShareplaceCom.py @@ -83,7 +83,7 @@ class ShareplaceCom(Hoster):          if not self.html:              self.download_html() -        if re.search(r"HTTP Status 404", self.html) is not None: +        if re.search(r"HTTP Status 404", self.html):              return False          else:              return True diff --git a/pyload/plugin/hoster/StreamCz.py b/pyload/plugin/hoster/StreamCz.py index 95e69abf4..fb22cb6e5 100644 --- a/pyload/plugin/hoster/StreamCz.py +++ b/pyload/plugin/hoster/StreamCz.py @@ -32,10 +32,10 @@ class StreamCz(Hoster):      __authors__     = [("zoidberg", "zoidberg@mujmail.cz")] -    NAME_PATTERN = r'<link rel="video_src" href="http://www\.stream\.cz/\w+/(\d+)-([^"]+)" />' +    NAME_PATTERN = r'<link rel="video_src" href="http://www\.stream\.cz/\w+/(\d+)-(.+?)" />'      OFFLINE_PATTERN = r'<h1 class="commonTitle">Str.nku nebylo mo.n. nal.zt \(404\)</h1>' -    CDN_PATTERN = r'<param name="flashvars" value="[^"]*&id=(?P<ID>\d+)(?:&cdnLQ=(?P<cdnLQ>\d*))?(?:&cdnHQ=(?P<cdnHQ>\d*))?(?:&cdnHD=(?P<cdnHD>\d*))?&' +    CDN_PATTERN = r'<param name="flashvars" value=".+?&id=(?P<ID>\d+)(?:&cdnLQ=(?P<cdnLQ>\d*))?(?:&cdnHQ=(?P<cdnHQ>\d*))?(?:&cdnHD=(?P<cdnHD>\d*))?&'      def setup(self): diff --git a/pyload/plugin/hoster/TusfilesNet.py b/pyload/plugin/hoster/TusfilesNet.py index 20a948925..a11e86a40 100644 --- a/pyload/plugin/hoster/TusfilesNet.py +++ b/pyload/plugin/hoster/TusfilesNet.py @@ -7,7 +7,7 @@ from pyload.plugin.internal.XFSHoster import XFSHoster  class TusfilesNet(XFSHoster):      __name__    = "TusfilesNet"      __type__    = "hoster" -    __version__ = "0.09" +    __version__ = "0.10"      __pattern__ = r'https?://(?:www\.)?tusfiles\.net/\w{12}' @@ -27,9 +27,9 @@ class TusfilesNet(XFSHoster):          self.resumeDownload = True -    def downloadLink(self, link): +    def downloadLink(self, link, disposition=True):          try: -            return super(TusfilesNet, self).downloadLink(link) +            return super(TusfilesNet, self).downloadLink(link, disposition)          except BadHeader, e:              if e.code is 503: diff --git a/pyload/plugin/hoster/UlozTo.py b/pyload/plugin/hoster/UlozTo.py index fbbe21f3e..8eec7062f 100644 --- a/pyload/plugin/hoster/UlozTo.py +++ b/pyload/plugin/hoster/UlozTo.py @@ -15,7 +15,7 @@ def convertDecimalPrefix(m):  class UlozTo(SimpleHoster):      __name__    = "UlozTo"      __type__    = "hoster" -    __version__ = "1.04" +    __version__ = "1.08"      __pattern__ = r'http://(?:www\.)?(uloz\.to|ulozto\.(cz|sk|net)|bagruj\.cz|zachowajto\.pl)/(?:live/)?(?P<ID>\w+/[^/?]*)'      __config__  = [("use_premium", "bool", "Use premium account if available", True)] @@ -30,62 +30,23 @@ class UlozTo(SimpleHoster):      SIZE_PATTERN    = r'<span id="fileSize">.*?(?P<S>[\d.,]+\s[kMG]?B)</span>'      OFFLINE_PATTERN = r'<title>404 - Page not found</title>|<h1 class="h1">File (has been deleted|was banned)</h1>' -    URL_REPLACEMENTS  = [(r"(?<=http://)([^/]+)", "www.ulozto.net")] -    SIZE_REPLACEMENTS = [('([\d.]+)\s([kMG])B', convertDecimalPrefix)] +    URL_REPLACEMENTS  = [(r'(?<=http://)([^/]+)', "www.ulozto.net")] +    SIZE_REPLACEMENTS = [(r'([\d.]+)\s([kMG])B', convertDecimalPrefix)] -    ADULT_PATTERN   = r'<form action="([^\"]*)" method="post" id="frm-askAgeForm">' +    CHECK_TRAFFIC = True + +    ADULT_PATTERN   = r'<form action="(.+?)" method="post" id="frm-askAgeForm">'      PASSWD_PATTERN  = r'<div class="passwordProtectedFile">' -    VIPLINK_PATTERN = r'<a href="[^"]*\?disclaimer=1" class="linkVip">' +    VIPLINK_PATTERN = r'<a href=".+?\?disclaimer=1" class="linkVip">'      TOKEN_PATTERN   = r'<input type="hidden" name="_token_" .*?value="(.+?)"'      def setup(self):          self.chunkLimit     = 16 if self.premium else 1 -        self.multiDL        = self.premium +        self.multiDL        = True          self.resumeDownload = True -    def process(self, pyfile): -        pyfile.url = re.sub(r"(?<=http://)([^/]+)", "www.ulozto.net", pyfile.url) -        self.html = self.load(pyfile.url, decode=True) - -        if re.search(self.ADULT_PATTERN, self.html): -            self.logInfo(_("Adult content confirmation needed")) - -            m = re.search(self.TOKEN_PATTERN, self.html) -            if m is None: -                self.error(_("TOKEN_PATTERN not found")) -            token = m.group(1) - -            self.html = self.load(pyfile.url, get={'do': "askAgeForm-submit"}, -                                  post={"agree": "Confirm", "_token_": token}) - -        if self.PASSWD_PATTERN in self.html: -            password = self.getPassword() - -            if password: -                self.logInfo(_("Password protected link, trying ") + password) -                self.html = self.load(pyfile.url, get={'do': "passwordProtectedForm-submit"}, -                                      post={"password": password, "password_send": 'Send'}) - -                if self.PASSWD_PATTERN in self.html: -                    self.fail(_("Incorrect password")) -            else: -                self.fail(_("No password found")) - -        if re.search(self.VIPLINK_PATTERN, self.html): -            self.html = self.load(pyfile.url, get={'disclaimer': "1"}) - -        self.getFileInfo() - -        if self.premium and self.checkTrafficLeft(): -            self.handlePremium(pyfile) -        else: -            self.handleFree(pyfile) - -        self.checkFile() - -      def handleFree(self, pyfile):          action, inputs = self.parseHtmlForm('id="frm-downloadDialog-freeDownloadForm"')          if not action or not inputs: @@ -114,15 +75,47 @@ class UlozTo(SimpleHoster):              self.logDebug("CAPTCHA HASH: " + data['hash'], "CAPTCHA SALT: " + str(data['salt']), "CAPTCHA VALUE: " + captcha_value)              inputs.update({'timestamp': data['timestamp'], 'salt': data['salt'], 'hash': data['hash'], 'captcha_value': captcha_value}) +          else:              self.error(_("CAPTCHA form changed")) -        self.multiDL = True -        self.download("http://www.ulozto.net" + action, post=inputs, disposition=True) +        self.download("http://www.ulozto.net" + action, post=inputs)      def handlePremium(self, pyfile): -        self.download(pyfile.url, get={'do': "directDownload"}, disposition=True) +        self.download(pyfile.url, get={'do': "directDownload"}) + + +    def checkErrors(self): +        if re.search(self.ADULT_PATTERN, self.html): +            self.logInfo(_("Adult content confirmation needed")) + +            m = re.search(self.TOKEN_PATTERN, self.html) +            if m is None: +                self.error(_("TOKEN_PATTERN not found")) + +            self.html = self.load(pyfile.url, +                                  get={'do': "askAgeForm-submit"}, +                                  post={"agree": "Confirm", "_token_": m.group(1)}) + +        if self.PASSWD_PATTERN in self.html: +            password = self.getPassword() + +            if password: +                self.logInfo(_("Password protected link, trying ") + password) +                self.html = self.load(pyfile.url, +                                      get={'do': "passwordProtectedForm-submit"}, +                                      post={"password": password, "password_send": 'Send'}) + +                if self.PASSWD_PATTERN in self.html: +                    self.fail(_("Incorrect password")) +            else: +                self.fail(_("No password found")) + +        if re.search(self.VIPLINK_PATTERN, self.html): +            self.html = self.load(pyfile.url, get={'disclaimer': "1"}) + +        return super(UlozTo, self).checkErrors()      def checkFile(self, rules={}): @@ -135,8 +128,6 @@ class UlozTo(SimpleHoster):          })          if check == "wrong_captcha": -            #self.delStorage("captcha_id") -            #self.delStorage("captcha_text")              self.invalidCaptcha()              self.retry(reason=_("Wrong captcha code")) @@ -153,6 +144,7 @@ class UlozTo(SimpleHoster):              self.retry()          elif check == "not_found": -            self.fail(_("Server error - file not downloadable")) +            self.fail(_("Server error, file not downloadable")) +          return super(UlozTo, self).checkFile(rules) diff --git a/pyload/plugin/hoster/UloziskoSk.py b/pyload/plugin/hoster/UloziskoSk.py index 506ceecb1..f8ccc46d2 100644 --- a/pyload/plugin/hoster/UloziskoSk.py +++ b/pyload/plugin/hoster/UloziskoSk.py @@ -22,10 +22,10 @@ class UloziskoSk(SimpleHoster):      SIZE_PATTERN = ur'Veľkosť súboru: <strong>(?P<S>[\d.,]+) (?P<U>[\w^_]+)</strong><br />'      OFFLINE_PATTERN = ur'<span class = "red">Zadaný súbor neexistuje z jedného z nasledujúcich dôvodov:</span>' -    LINK_FREE_PATTERN = r'<form name = "formular" action = "([^"]+)" method = "post">' -    ID_PATTERN = r'<input type = "hidden" name = "id" value = "([^"]+)" />' -    CAPTCHA_PATTERN = r'<img src="(/obrazky/obrazky\.php\?fid=[^"]+)" alt="" />' -    IMG_PATTERN = ur'<strong>PRE ZVÄČŠENIE KLIKNITE NA OBRÁZOK</strong><br /><a href = "([^"]+)">' +    LINK_FREE_PATTERN = r'<form name = "formular" action = "(.+?)" method = "post">' +    ID_PATTERN = r'<input type = "hidden" name = "id" value = "(.+?)" />' +    CAPTCHA_PATTERN = r'<img src="(/obrazky/obrazky\.php\?fid=.+?)" alt="" />' +    IMG_PATTERN = ur'<strong>PRE ZVÄČŠENIE KLIKNITE NA OBRÁZOK</strong><br /><a href = "(.+?)">'      def process(self, pyfile): @@ -34,8 +34,7 @@ class UloziskoSk(SimpleHoster):          m = re.search(self.IMG_PATTERN, self.html)          if m: -            url = "http://ulozisko.sk" + m.group(1) -            self.download(url) +            self.link = "http://ulozisko.sk" + m.group(1)          else:              self.handleFree(pyfile) diff --git a/pyload/plugin/hoster/UnibytesCom.py b/pyload/plugin/hoster/UnibytesCom.py index a02d5b8c7..d00dc774d 100644 --- a/pyload/plugin/hoster/UnibytesCom.py +++ b/pyload/plugin/hoster/UnibytesCom.py @@ -22,10 +22,10 @@ class UnibytesCom(SimpleHoster):      HOSTER_DOMAIN = "unibytes.com" -    INFO_PATTERN = r'<span[^>]*?id="fileName"[^>]*>(?P<N>[^>]+)</span>\s*\((?P<S>\d.*?)\)' +    INFO_PATTERN = r'<span[^>]*?id="fileName".*?>(?P<N>[^>]+)</span>\s*\((?P<S>\d.*?)\)'      WAIT_PATTERN = r'Wait for <span id="slowRest">(\d+)</span> sec' -    LINK_FREE_PATTERN = r'<a href="([^"]+)">Download</a>' +    LINK_FREE_PATTERN = r'<a href="(.+?)">Download</a>'      def handleFree(self, pyfile): @@ -39,7 +39,7 @@ class UnibytesCom(SimpleHoster):              m = re.search(r'location:\s*(\S+)', self.req.http.header, re.I)              if m: -                url = m.group(1) +                self.link = m.group(1)                  break              if '>Somebody else is already downloading using your IP-address<' in self.html: @@ -49,7 +49,7 @@ class UnibytesCom(SimpleHoster):              if post_data['step'] == 'last':                  m = re.search(self.LINK_FREE_PATTERN, self.html)                  if m: -                    url = m.group(1) +                    self.link = m.group(1)                      self.correctCaptcha()                      break                  else: @@ -68,4 +68,3 @@ class UnibytesCom(SimpleHoster):          else:              self.fail(_("No valid captcha code entered")) -        self.download(url) diff --git a/pyload/plugin/hoster/UploadedTo.py b/pyload/plugin/hoster/UploadedTo.py index 207817122..44c0da516 100644 --- a/pyload/plugin/hoster/UploadedTo.py +++ b/pyload/plugin/hoster/UploadedTo.py @@ -101,7 +101,7 @@ class UploadedTo(SimpleHoster):          if "type:'download'" in self.html:              self.correctCaptcha()              try: -                self.link = re.search("url:'([^']+)", self.html).group(1) +                self.link = re.search("url:'(.+?)'", self.html).group(1)              except Exception:                  pass diff --git a/pyload/plugin/hoster/UploadingCom.py b/pyload/plugin/hoster/UploadingCom.py index 461b0113a..da096eb1f 100644 --- a/pyload/plugin/hoster/UploadingCom.py +++ b/pyload/plugin/hoster/UploadingCom.py @@ -53,8 +53,7 @@ class UploadingCom(SimpleHoster):          self.html = self.load('http://uploading.com/files/get/?JsHttpRequest=%d-xml' % timestamp(), post=postData)          url = re.search(r'"link"\s*:\s*"(.*?)"', self.html)          if url: -            url = url.group(1).replace("\\/", "/") -            self.download(url) +            self.link = url.group(1).replace("\\/", "/")          raise Exception("Plugin defect") @@ -93,4 +92,4 @@ class UploadingCom(SimpleHoster):          else:              self.error(_("No URL")) -        self.download(url) +        self.link = url diff --git a/pyload/plugin/hoster/UpstoreNet.py b/pyload/plugin/hoster/UpstoreNet.py index f6e8a6a1d..80e9f4ebe 100644 --- a/pyload/plugin/hoster/UpstoreNet.py +++ b/pyload/plugin/hoster/UpstoreNet.py @@ -23,7 +23,7 @@ class UpstoreNet(SimpleHoster):      OFFLINE_PATTERN = r'<span class="error">File not found</span>'      WAIT_PATTERN = r'var sec = (\d+)' -    CHASH_PATTERN = r'<input type="hidden" name="hash" value="([^"]*)">' +    CHASH_PATTERN = r'<input type="hidden" name="hash" value="(.+?)">'      LINK_FREE_PATTERN = r'<a href="(https?://.*?)" target="_blank"><b>' diff --git a/pyload/plugin/hoster/VeehdCom.py b/pyload/plugin/hoster/VeehdCom.py index f9756662c..f4b0be050 100644 --- a/pyload/plugin/hoster/VeehdCom.py +++ b/pyload/plugin/hoster/VeehdCom.py @@ -52,7 +52,7 @@ class VeehdCom(Hoster):          if not self.html:              self.download_html() -        m = re.search(r'<title[^>]*>([^<]+) on Veehd</title>', self.html) +        m = re.search(r'<title.*?>([^<]+) on Veehd</title>', self.html)          if m is None:              self.error(_("Video title not found")) @@ -73,7 +73,7 @@ class VeehdCom(Hoster):          if not self.html:              self.download_html() -        m = re.search(r'<embed type="video/divx" src="(http://([^/]*\.)?veehd\.com/dl/[^"]+)"', +        m = re.search(r'<embed type="video/divx" src="(http://([^/]*\.)?veehd\.com/dl/.+?)"',                            self.html)          if m is None:              self.error(_("Embedded video url not found")) diff --git a/pyload/plugin/hoster/VeohCom.py b/pyload/plugin/hoster/VeohCom.py index 0fa118355..78080ee1d 100644 --- a/pyload/plugin/hoster/VeohCom.py +++ b/pyload/plugin/hoster/VeohCom.py @@ -43,8 +43,7 @@ class VeohCom(SimpleHoster):              m = re.search(pattern, self.html)              if m:                  pyfile.name += ".mp4" -                link = m.group(1).replace("\\", "") -                self.download(link) +                self.link = m.group(1).replace("\\", "")                  return              else:                  self.logInfo(_("No %s quality video found") % q.upper()) diff --git a/pyload/plugin/hoster/VimeoCom.py b/pyload/plugin/hoster/VimeoCom.py index fb6ea094a..47ce0de4e 100644 --- a/pyload/plugin/hoster/VimeoCom.py +++ b/pyload/plugin/hoster/VimeoCom.py @@ -49,7 +49,7 @@ class VimeoCom(SimpleHoster):          if self.getConfig('original'):              if "original" in link: -                self.download(link[q]) +                self.link = link[q]                  return              else:                  self.logInfo(_("Original file not downloadable")) @@ -64,7 +64,7 @@ class VimeoCom(SimpleHoster):          for q in qlevel:              if q in link: -                self.download(link[q]) +                self.link = link[q]                  return              else:                  self.logInfo(_("No %s quality video found") % q.upper()) diff --git a/pyload/plugin/hoster/WrzucTo.py b/pyload/plugin/hoster/WrzucTo.py index 88eb38789..bdbcb6a5b 100644 --- a/pyload/plugin/hoster/WrzucTo.py +++ b/pyload/plugin/hoster/WrzucTo.py @@ -46,5 +46,5 @@ class WrzucTo(SimpleHoster):          if len(data) != 4:              self.error(_("No download URL")) -        download_url = "http://%s.wrzuc.to/pobierz/%s" % (data['server_id'], data['download_link']) -        self.download(download_url) +        self.link = "http://%s.wrzuc.to/pobierz/%s" % (data['server_id'], data['download_link']) + diff --git a/pyload/plugin/hoster/XHamsterCom.py b/pyload/plugin/hoster/XHamsterCom.py index 73944a61b..934ff3a58 100644 --- a/pyload/plugin/hoster/XHamsterCom.py +++ b/pyload/plugin/hoster/XHamsterCom.py @@ -123,7 +123,7 @@ class XHamsterCom(Hoster):          """          if not self.html:              self.download_html() -        if re.search(r"(.*Video not found.*)", self.html) is not None: +        if re.search(r"(.*Video not found.*)", self.html):              return False          else:              return True diff --git a/pyload/plugin/hoster/YibaishiwuCom.py b/pyload/plugin/hoster/YibaishiwuCom.py index 9f90dbe5e..01bd56763 100644 --- a/pyload/plugin/hoster/YibaishiwuCom.py +++ b/pyload/plugin/hoster/YibaishiwuCom.py @@ -47,9 +47,8 @@ class YibaishiwuCom(SimpleHoster):          for mr in mirrors:              try: -                url = mr['url'].replace("\\", "") -                self.logDebug("Trying URL: " + url) -                self.download(url) +                self.link = mr['url'].replace("\\", "") +                self.logDebug("Trying URL: " + self.link)                  break              except Exception:                  continue diff --git a/pyload/plugin/hoster/YoupornCom.py b/pyload/plugin/hoster/YoupornCom.py index 75606935d..9aec3531a 100644 --- a/pyload/plugin/hoster/YoupornCom.py +++ b/pyload/plugin/hoster/YoupornCom.py @@ -54,7 +54,7 @@ class YoupornCom(Hoster):          """          if not self.html:              self.download_html() -        if re.search(r"(.*invalid video_id.*)", self.html) is not None: +        if re.search(r"(.*invalid video_id.*)", self.html):              return False          else:              return True diff --git a/pyload/plugin/hoster/YourfilesTo.py b/pyload/plugin/hoster/YourfilesTo.py index a600d822f..cd7ea0a4b 100644 --- a/pyload/plugin/hoster/YourfilesTo.py +++ b/pyload/plugin/hoster/YourfilesTo.py @@ -81,7 +81,7 @@ class YourfilesTo(Hoster):          if not self.html:              self.download_html() -        if re.search(r"HTTP Status 404", self.html) is not None: +        if re.search(r"HTTP Status 404", self.html):              return False          else:              return True diff --git a/pyload/plugin/hoster/ZippyshareCom.py b/pyload/plugin/hoster/ZippyshareCom.py index 9b1d432cc..e4a05d634 100644 --- a/pyload/plugin/hoster/ZippyshareCom.py +++ b/pyload/plugin/hoster/ZippyshareCom.py @@ -1,6 +1,7 @@  # -*- coding: utf-8 -*-  import re +import urllib  from BeautifulSoup import BeautifulSoup @@ -11,7 +12,7 @@ from pyload.plugin.internal.SimpleHoster import SimpleHoster  class ZippyshareCom(SimpleHoster):      __name__    = "ZippyshareCom"      __type__    = "hoster" -    __version__ = "0.77" +    __version__ = "0.78"      __pattern__ = r'http://www\d{0,2}\.zippyshare\.com/v(/|iew\.jsp.*key=)(?P<KEY>[\w^_]+)'      __config__  = [("use_premium", "bool", "Use premium account if available", True)] @@ -24,7 +25,7 @@ class ZippyshareCom(SimpleHoster):      COOKIES = [("zippyshare.com", "ziplocale", "en")] -    NAME_PATTERN    = r'("/|<title>Zippyshare.com - )(?P<N>[^/]+?)("\);|</title>)' +    NAME_PATTERN    = r'(<title>Zippyshare.com - |"/)(?P<N>[^/]+)(</title>|";)'      SIZE_PATTERN    = r'>Size:.+?">(?P<S>[\d.,]+) (?P<U>[\w^_]+)'      OFFLINE_PATTERN = r'does not exist (anymore )?on this server<' @@ -52,6 +53,9 @@ class ZippyshareCom(SimpleHoster):          else:              self.link = self.get_link() +        if self.link and pyfile.name == 'file.html': +            pyfile.name = urllib.unquote(self.link.split('/')[-1]) +      def get_link(self):          # get all the scripts inside the html body diff --git a/pyload/plugin/internal/BasePlugin.py b/pyload/plugin/internal/BasePlugin.py index 0b6e8f102..7c83ddef0 100644 --- a/pyload/plugin/internal/BasePlugin.py +++ b/pyload/plugin/internal/BasePlugin.py @@ -13,7 +13,7 @@ from pyload.plugin.Hoster import Hoster  class BasePlugin(Hoster):      __name__    = "BasePlugin"      __type__    = "hoster" -    __version__ = "0.38" +    __version__ = "0.41"      __pattern__ = r'^unmatchable$' @@ -41,6 +41,16 @@ class BasePlugin(Hoster):          self.resumeDownload = True +    #: Work-around to `filename*=UTF-8` bug; remove in 0.4.10 +    def download(self, url, get={}, post={}, ref=True, cookies=True, disposition=False): +        try: +            if disposition: +                content = urllib2.urlopen(url).info()['Content-Disposition'].split(';') +                self.pyfile.name = content[1].split('filename=')[1][1:-1] or self.pyfile.name +        finally: +            return super(BasePlugin, self).download(url, get, post, ref, cookies, False) + +      def process(self, pyfile):          """main function""" diff --git a/pyload/plugin/internal/MultiHook.py b/pyload/plugin/internal/MultiHook.py index e15d5afda..4ca158c24 100644 --- a/pyload/plugin/internal/MultiHook.py +++ b/pyload/plugin/internal/MultiHook.py @@ -2,6 +2,7 @@  import re  import time +import traceback  from pyload.plugin.Hook import Hook  from pyload.utils import decode, remove_chars @@ -10,7 +11,7 @@ from pyload.utils import decode, remove_chars  class MultiHook(Hook):      __name__    = "MultiHook"      __type__    = "hook" -    __version__ = "0.40" +    __version__ = "0.44"      __config__  = [("pluginmode"    , "all;listed;unlisted", "Use for plugins"              , "all"),                     ("pluginlist"    , "str"                , "Plugin list (comma separated)", ""   ), @@ -64,20 +65,19 @@ class MultiHook(Hook):          self.pluginname   = None          self.plugintype   = None -        self._initPlugin() +        self.initPlugin() -    def _initPlugin(self): -        plugin = self.core.pluginManager.findPlugin("hoster", self.__class__.__name__) +    def initPlugin(self): +        self.pluginname         = self.__class__.__name__.rsplit("Hook", 1)[0] +        plugin, self.plugintype = self.core.pluginManager.findPlugin(self.pluginname) -        if not plugin: +        if plugin: +            self.pluginmodule = self.core.pluginManager.loadModule(self.plugintype, self.pluginname) +            self.pluginclass  = getattr(self.pluginmodule, self.pluginname) +        else:              self.logWarning("Hook plugin will be deactivated due missing plugin reference")              self.setConfig('activated', False) -        else: -            self.pluginname   = self.__class__.__name__ -            self.plugintype   = "hoster" -            self.pluginmodule = self.core.pluginManager.loadModule("hoster", self.__class__.__name__) -            self.pluginclass  = getattr(self.pluginmodule, self.__class__.__name__)      def loadAccount(self): diff --git a/pyload/plugin/internal/SimpleCrypter.py b/pyload/plugin/internal/SimpleCrypter.py index 472488268..d0380c0d9 100644 --- a/pyload/plugin/internal/SimpleCrypter.py +++ b/pyload/plugin/internal/SimpleCrypter.py @@ -20,7 +20,7 @@ class SimpleCrypter(Crypter, SimpleHoster):      __description__ = """Simple decrypter plugin"""      __license__     = "GPLv3" -    __authors__     = [("Walter Purcaro", "vuolter@gmail.com"  )] +    __authors__     = [("Walter Purcaro", "vuolter@gmail.com")]      """ diff --git a/pyload/plugin/internal/SimpleDereferer.py b/pyload/plugin/internal/SimpleDereferer.py index e24a7b836..a224c1e40 100644 --- a/pyload/plugin/internal/SimpleDereferer.py +++ b/pyload/plugin/internal/SimpleDereferer.py @@ -11,7 +11,7 @@ from pyload.plugin.internal.SimpleHoster import getFileURL, set_cookies  class SimpleDereferer(Crypter):      __name__    = "SimpleDereferer"      __type__    = "crypter" -    __version__ = "0.08" +    __version__ = "0.11"      __pattern__ = r'^unmatchable$'      __config__  = [("use_subfolder"     , "bool", "Save package to subfolder"          , True), diff --git a/pyload/plugin/internal/SimpleHoster.py b/pyload/plugin/internal/SimpleHoster.py index d83bbb625..56170a4fd 100644 --- a/pyload/plugin/internal/SimpleHoster.py +++ b/pyload/plugin/internal/SimpleHoster.py @@ -5,10 +5,8 @@ import mimetypes  import os  import re  import time - -from inspect import isclass -from urllib import unquote -from urlparse import urljoin, urlparse +import urllib +import urlparse  from pyload.datatype.File import statusMap as _statusMap  from pyload.network.CookieJar import CookieJar @@ -29,7 +27,7 @@ def _error(self, reason, type):          type = "unknown"      msg  = _("%s error") % type.strip().capitalize() if type else _("Error") -    msg += ": %s" % reason.strip() if reason else "" +    msg += (": %s" % reason.strip()) if reason else ""      msg += _(" | Plugin may be out of date")      raise Fail(msg) @@ -108,8 +106,8 @@ def parseFileInfo(plugin, url="", html=""):          info = plugin.getInfo(url, html)          res  = info['name'], info['size'], info['status'], info['url']      else: -        url   = unquote(url) -        url_p = urlparse(url) +        url   = urllib.unquote(url) +        url_p = urlparse.urlparse(url)          res   = ((url_p.path.split('/')[-1]                    or url_p.query.split('=', 1)[::-1][0].split('&', 1)[0]                    or url_p.netloc.split('.', 1)[0]), @@ -185,10 +183,10 @@ def getFileURL(self, url, follow_location=None):          elif 'location' in header and header['location'].strip():              location = header['location'] -            if not urlparse(location).scheme: -                url_p    = urlparse(url) +            if not urlparse.urlparse(location).scheme: +                url_p    = urlparse.urlparse(url)                  baseurl  = "%s://%s" % (url_p.scheme, url_p.netloc) -                location = urljoin(baseurl, location) +                location = urlparse.urljoin(baseurl, location)              if 'code' in header and header['code'] == 302:                  link = location @@ -198,7 +196,7 @@ def getFileURL(self, url, follow_location=None):                  continue          else: -            extension = os.path.splitext(urlparse(url).path.split('/')[-1])[-1] +            extension = os.path.splitext(urlparse.urlparse(url).path.split('/')[-1])[-1]              if 'content-type' in header and header['content-type'].strip():                  mimetype = header['content-type'].split(';')[0].strip() @@ -246,7 +244,7 @@ def secondsToMidnight(gmt=0):  class SimpleHoster(Hoster):      __name__    = "SimpleHoster"      __type__    = "hoster" -    __version__ = "1.31" +    __version__ = "1.37"      __pattern__ = r'^unmatchable$'      __config__  = [("use_premium", "bool", "Use premium account if available", True)] @@ -307,20 +305,21 @@ class SimpleHoster(Hoster):      DIRECT_LINK   = None   #: Set to True to looking for direct link (as defined in handleDirect method), set to None to do it if self.account is True else False      MULTI_HOSTER  = False  #: Set to True to leech other hoster link (as defined in handleMulti method)      LOGIN_ACCOUNT = False  #: Set to True to require account login -    DISPOSITION   = True   #: Work-around to `filename*=UTF-8` bug; remove in 0.4.10 +    DISPOSITION   = True   #: Set to True to use any content-disposition value in http header as file name      directLink = getFileURL  # @TODO: Remove in 0.4.10 +      @classmethod -    def parseInfos(cls, urls):  # @TODO: Built-in in 0.4.10 core, then remove from plugins +    def parseInfos(cls, urls):  #@TODO: Built-in in 0.4.10 core (remove from plugins)          for url in urls:              url = replace_patterns(url, cls.URL_REPLACEMENTS)              yield cls.getInfo(url)      @classmethod      def apiInfo(cls, url="", get={}, post={}): -        url   = unquote(url) -        url_p = urlparse(url) +        url   = urllib.unquote(url) +        url_p = urlparse.urlparse(url)          return {'name': (url_p.path.split('/')[-1]                           or url_p.query.split('=', 1)[::-1][0].split('&', 1)[0]                           or url_p.netloc.split('.', 1)[0]), @@ -386,7 +385,7 @@ class SimpleHoster(Hoster):              info['status'] = 2              if 'N' in info['pattern']: -                info['name'] = replace_patterns(unquote(info['pattern']['N'].strip()), +                info['name'] = replace_patterns(urllib.unquote(info['pattern']['N'].strip()),                                                  cls.NAME_REPLACEMENTS)              if 'S' in info['pattern']: @@ -478,7 +477,7 @@ class SimpleHoster(Hoster):                      self.logDebug("Handled as free download")                      self.handleFree(pyfile) -            self.downloadLink(self.link, self.DISPOSITION)  #: Remove `self.DISPOSITION` in 0.4.10 +            self.downloadLink(self.link, self.DISPOSITION)              self.checkFile()          except Fail, e:  # @TODO: Move to PluginThread in 0.4.10 @@ -492,10 +491,10 @@ class SimpleHoster(Hoster):          if link and isinstance(link, basestring):              self.correctCaptcha() -            if not urlparse(link).scheme: -                url_p   = urlparse(self.pyfile.url) +            if not urlparse.urlparse(link).scheme: +                url_p   = urlparse.urlparse(self.pyfile.url)                  baseurl = "%s://%s" % (url_p.scheme, url_p.netloc) -                link    = urljoin(baseurl, link) +                link    = urlparse.urljoin(baseurl, link)              self.download(link, ref=False, disposition=disposition) @@ -577,8 +576,8 @@ class SimpleHoster(Hoster):                  except Exception:                      waitmsg = m.group(0).strip() -                wait_time = sum(int(v) * {"hr": 3600, "hour": 3600, "min": 60, "sec": 1}[u.lower()] for v, u in -                                re.findall(r'(\d+)\s*(hr|hour|min|sec)', waitmsg, re.I)) +                wait_time = sum(int(v) * {"hr": 3600, "hour": 3600, "min": 60, "sec": 1, "": 1}[u.lower()] for v, u in +                                re.findall(r'(\d+)\s*(hr|hour|min|sec|)', waitmsg, re.I))                  self.wait(wait_time, wait_time > 300)          self.info.pop('error', None) @@ -652,7 +651,6 @@ class SimpleHoster(Hoster):          if link:              self.logInfo(_("Direct download link detected")) -              self.link = link          else:              self.logDebug("Direct download link not found") diff --git a/pyload/plugin/internal/XFSHoster.py b/pyload/plugin/internal/XFSHoster.py index 58bcf0e09..0e265ce64 100644 --- a/pyload/plugin/internal/XFSHoster.py +++ b/pyload/plugin/internal/XFSHoster.py @@ -15,7 +15,7 @@ from pyload.utils import html_unescape  class XFSHoster(SimpleHoster):      __name__    = "XFSHoster"      __type__    = "hoster" -    __version__ = "0.45" +    __version__ = "0.46"      __pattern__ = r'^unmatchable$' @@ -181,8 +181,8 @@ class XFSHoster(SimpleHoster):              self.logWarning(re.sub(r"<.*?>", " ", self.errmsg))              if 'wait' in self.errmsg: -                wait_time = sum(int(v) * {"hr": 3600, "hour": 3600, "min": 60, "sec": 1}[u.lower()] for v, u in -                                re.findall(r'(\d+)\s*(hr|hour|min|sec)', self.errmsg, re.I)) +                wait_time = sum(int(v) * {"hr": 3600, "hour": 3600, "min": 60, "sec": 1, "": 1}[u.lower()] for v, u in +                                re.findall(r'(\d+)\s*(hr|hour|min|sec|)', self.errmsg, re.I))                  self.wait(wait_time, wait_time > 300)              elif 'country' in self.errmsg: diff --git a/pyload/plugin/ocr/LinksaveIn.py b/pyload/plugin/ocr/LinksaveIn.py index ddffb190a..6de6f0123 100644 --- a/pyload/plugin/ocr/LinksaveIn.py +++ b/pyload/plugin/ocr/LinksaveIn.py @@ -124,7 +124,7 @@ class LinksaveIn(OCR):              for y in xrange(new.size[1]):                  rgb = orgpix[x, y]                  r, g, b = rgb -                pix[x, y] = (255,255,255) +                pix[x, y] = (255, 255, 255)                  if r > max(b, g)+thresh:                      pix[x, y] = (0, 0, 0)                  if g < min(r, b):  | 
