diff options
| author | 2015-01-04 20:26:13 +0100 | |
|---|---|---|
| committer | 2015-01-04 20:26:13 +0100 | |
| commit | 7979d0833573a107baae8c45330b8b5874630a76 (patch) | |
| tree | eaa2c71065c33067de56bdd8763e9ef3d690263f /module | |
| parent | [PremiumTo] CHECK_TRAFFIC (diff) | |
| download | pyload-7979d0833573a107baae8c45330b8b5874630a76.tar.xz | |
Spare code improvements
Diffstat (limited to 'module')
| -rw-r--r-- | module/plugins/crypter/DlProtectCom.py | 2 | ||||
| -rw-r--r-- | module/plugins/hooks/EasybytezCom.py | 5 | ||||
| -rw-r--r-- | module/plugins/hooks/PremiumizeMe.py | 20 | ||||
| -rw-r--r-- | module/plugins/hooks/RPNetBiz.py | 20 | ||||
| -rw-r--r-- | module/plugins/hooks/RehostTo.py | 15 | ||||
| -rw-r--r-- | module/plugins/hoster/MultishareCz.py | 19 | ||||
| -rw-r--r-- | module/plugins/hoster/NoPremiumPl.py | 5 | ||||
| -rw-r--r-- | module/plugins/hoster/RapideoPl.py | 5 | ||||
| -rw-r--r-- | module/plugins/hoster/RehostTo.py | 4 | ||||
| -rw-r--r-- | module/plugins/hoster/ShareonlineBiz.py | 6 | ||||
| -rw-r--r-- | module/plugins/hoster/SimplydebridCom.py | 2 | 
11 files changed, 27 insertions, 76 deletions
| diff --git a/module/plugins/crypter/DlProtectCom.py b/module/plugins/crypter/DlProtectCom.py index 052e8303f..4a188aa83 100644 --- a/module/plugins/crypter/DlProtectCom.py +++ b/module/plugins/crypter/DlProtectCom.py @@ -37,7 +37,7 @@ class DlProtectCom(SimpleCrypter):          if "Please click on continue to see the content" in self.html:              post_req['submitform'] = "Continue" -            self.wait(5) +            self.wait(2)          else:              mstime  = int(round(time() * 1000)) diff --git a/module/plugins/hooks/EasybytezCom.py b/module/plugins/hooks/EasybytezCom.py index 16149580c..1606c9f30 100644 --- a/module/plugins/hooks/EasybytezCom.py +++ b/module/plugins/hooks/EasybytezCom.py @@ -8,7 +8,7 @@ from module.plugins.internal.MultiHook import MultiHook  class EasybytezCom(MultiHook):      __name__    = "EasybytezCom"      __type__    = "hook" -    __version__ = "0.05" +    __version__ = "0.06"      __config__ = [("mode", "all;listed;unlisted", "Use for hosters (if supported)", "all"),                    ("pluginlist", "str", "Hoster list (comma separated)", "")] @@ -19,8 +19,7 @@ class EasybytezCom(MultiHook):      def getHosters(self): -        self.account = self.core.accountManager.getAccountPlugin(self.__name__) -        user = self.account.selectAccount()[0] +        user, data = self.account.selectAccount()          try:              req  = self.account.getAccountRequest(user) diff --git a/module/plugins/hooks/PremiumizeMe.py b/module/plugins/hooks/PremiumizeMe.py index c0717afc7..d334ddd25 100644 --- a/module/plugins/hooks/PremiumizeMe.py +++ b/module/plugins/hooks/PremiumizeMe.py @@ -7,7 +7,7 @@ from module.plugins.internal.MultiHook import MultiHook  class PremiumizeMe(MultiHook):      __name__    = "PremiumizeMe"      __type__    = "hook" -    __version__ = "0.15" +    __version__ = "0.16"      __config__ = [("mode", "all;listed;unlisted", "Use for hosters (if supported):", "all"),                    ("pluginlist", "str", "Hoster list (comma separated)", ""), @@ -20,12 +20,8 @@ class PremiumizeMe(MultiHook):      def getHosters(self): -        # If no accounts are available there will be no hosters available -        if not self.account or not self.account.canUse(): -            return [] -          # Get account data -        (user, data) = self.account.selectAccount() +        user, data = self.account.selectAccount()          # Get supported hosters list from premiumize.me using the          # json API v1 (see https://secure.premiumize.me/?show=api) @@ -39,15 +35,3 @@ class PremiumizeMe(MultiHook):          # Extract hosters from json file          return data['result']['hosterlist'] - - -    def coreReady(self): -        # Get account plugin and check if there is a valid account available -        self.account = self.core.accountManager.getAccountPlugin("PremiumizeMe") -        if not self.account.canUse(): -            self.account = None -            self.logError(_("Please add a valid premiumize.me account first and restart pyLoad")) -            return - -        # Run the overwriten core ready which actually enables the multihoster hook -        return MultiHook.coreReady(self) diff --git a/module/plugins/hooks/RPNetBiz.py b/module/plugins/hooks/RPNetBiz.py index bbbe8e128..9c88e6c01 100644 --- a/module/plugins/hooks/RPNetBiz.py +++ b/module/plugins/hooks/RPNetBiz.py @@ -7,7 +7,7 @@ from module.plugins.internal.MultiHook import MultiHook  class RPNetBiz(MultiHook):      __name__    = "RPNetBiz"      __type__    = "hook" -    __version__ = "0.12" +    __version__ = "0.13"      __config__ = [("mode", "all;listed;unlisted", "Use for hosters (if supported):", "all"),                    ("pluginlist", "str", "Hoster list (comma separated)", ""), @@ -20,12 +20,8 @@ class RPNetBiz(MultiHook):      def getHosters(self): -        # No hosts supported if no account -        if not self.account or not self.account.canUse(): -            return [] -          # Get account data -        (user, data) = self.account.selectAccount() +        user, data = self.account.selectAccount()          res = self.getURL("https://premium.rpnet.biz/client_api.php",                       get={'username': user, 'password': data['password'], 'action': "showHosterList"}) @@ -37,15 +33,3 @@ class RPNetBiz(MultiHook):          # Extract hosters from json file          return hoster_list['hosters'] - - -    def coreReady(self): -        # Get account plugin and check if there is a valid account available -        self.account = self.core.accountManager.getAccountPlugin("RPNetBiz") -        if not self.account.canUse(): -            self.account = None -            self.logError(_("Please enter your %s account or deactivate this plugin") % "rpnet") -            return - -        # Run the overwriten core ready which actually enables the multihoster hook -        return MultiHook.coreReady(self) diff --git a/module/plugins/hooks/RehostTo.py b/module/plugins/hooks/RehostTo.py index c3b626bf7..527770eb6 100644 --- a/module/plugins/hooks/RehostTo.py +++ b/module/plugins/hooks/RehostTo.py @@ -6,7 +6,7 @@ from module.plugins.internal.MultiHook import MultiHook  class RehostTo(MultiHook):      __name__    = "RehostTo"      __type__    = "hook" -    __version__ = "0.45" +    __version__ = "0.46"      __config__ = [("mode", "all;listed;unlisted", "Use for hosters (if supported)", "all"),                    ("pluginlist", "str", "Hoster list (comma separated)", ""), @@ -25,16 +25,9 @@ class RehostTo(MultiHook):      def coreReady(self): -        self.account = self.core.accountManager.getAccountPlugin("RehostTo") +        super(RehostTo, self).coreReady() -        user = self.account.selectAccount()[0] +        user, data = self.account.selectAccount() -        if not user: -            self.logError(_("Please add your rehost.to account first and restart pyLoad")) -            return - -        data = self.account.getAccountInfo(user) -        self.ses = data['ses'] +        self.ses      = data['ses']          self.long_ses = data['long_ses'] - -        return MultiHook.coreReady(self) diff --git a/module/plugins/hoster/MultishareCz.py b/module/plugins/hoster/MultishareCz.py index ee84f613f..421ad111b 100644 --- a/module/plugins/hoster/MultishareCz.py +++ b/module/plugins/hoster/MultishareCz.py @@ -10,7 +10,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo  class MultishareCz(SimpleHoster):      __name__    = "MultishareCz"      __type__    = "hoster" -    __version__ = "0.38" +    __version__ = "0.39"      __pattern__ = r'http://(?:www\.)?multishare\.cz/stahnout/(?P<ID>\d+)' @@ -21,7 +21,8 @@ class MultishareCz(SimpleHoster):      SIZE_REPLACEMENTS = [(' ', '')] -    MULTI_HOSTER = True +    CHECK_TRAFFIC = True +    MULTI_HOSTER  = True      INFO_PATTERN    = ur'(?:<li>Název|Soubor): <strong>(?P<N>[^<]+)</strong><(?:/li><li|br)>Velikost: <strong>(?P<S>[^<]+)</strong>'      OFFLINE_PATTERN = ur'<h1>Stáhnout soubor</h1><p><strong>Požadovaný soubor neexistuje.</strong></p>' @@ -32,10 +33,6 @@ class MultishareCz(SimpleHoster):      def handlePremium(self): -        if not self.checkCredit(): -            self.logWarning(_("Not enough credit left to download file")) -            self.resetAccount() -          self.download("http://www.multishare.cz/html/download_premium.php?ID=%s" % self.info['pattern']['ID']) @@ -44,7 +41,7 @@ class MultishareCz(SimpleHoster):          self.checkInfo() -        if not self.checkCredit(): +        if not self.checkTrafficLeft():              self.fail(_("Not enough credit left to download file"))          self.download("http://dl%d.mms.multishare.cz/html/mms_process.php" % round(random() * 10000 * random()), @@ -54,12 +51,4 @@ class MultishareCz(SimpleHoster):                        disposition=True) -    def checkCredit(self): -        self.acc_info = self.account.getAccountInfo(self.user, True) - -        self.logInfo(_("User %s has %i MB left") % (self.user, self.acc_info['trafficleft'] / 1024)) - -        return self.pyfile.size / 1024 <= self.acc_info['trafficleft'] - -  getInfo = create_getInfo(MultishareCz) diff --git a/module/plugins/hoster/NoPremiumPl.py b/module/plugins/hoster/NoPremiumPl.py index f4f7ba56a..feedd7651 100644 --- a/module/plugins/hoster/NoPremiumPl.py +++ b/module/plugins/hoster/NoPremiumPl.py @@ -43,8 +43,9 @@ class NoPremiumPl(SimpleHoster):          if not self.account:              self.fail(_("Please enter your %s account or deactivate this plugin") % "NoPremium.pl")          else: -            self._usr = self.account.getAccountData(self.user).get('usr') -            self._pwd = self.account.getAccountData(self.user).get('pwd') +            data = self.account.getAccountData(self.user) +            self._usr = data['usr'] +            self._pwd = data['pwd']      def runFileQuery(self, url, mode=None):          query = self._api_query.copy() diff --git a/module/plugins/hoster/RapideoPl.py b/module/plugins/hoster/RapideoPl.py index 9fd20e69e..7260ebbe3 100644 --- a/module/plugins/hoster/RapideoPl.py +++ b/module/plugins/hoster/RapideoPl.py @@ -41,8 +41,9 @@ class RapideoPl(SimpleHoster):          if not self.account:              self.fail(_("Please enter your %s account or deactivate this plugin") % "Rapideo.pl")          else: -            self._usr = self.account.getAccountData(self.user).get('usr') -            self._pwd = self.account.getAccountData(self.user).get('pwd') +            data = self.account.getAccountData(self.user) +            self._usr = data['usr'] +            self._pwd = data['pwd']      def runFileQuery(self, url, mode=None):          query = self._api_query.copy() diff --git a/module/plugins/hoster/RehostTo.py b/module/plugins/hoster/RehostTo.py index 5dd17e374..96443d5f5 100644 --- a/module/plugins/hoster/RehostTo.py +++ b/module/plugins/hoster/RehostTo.py @@ -8,7 +8,7 @@ from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo  class RehostTo(MultiHoster):      __name__    = "RehostTo"      __type__    = "hoster" -    __version__ = "0.17" +    __version__ = "0.18"      __pattern__ = r'https?://.*rehost\.to\..+' @@ -22,7 +22,7 @@ class RehostTo(MultiHoster):      def handlePremium(self): -        data = self.account.getAccountInfo(self.user) +        data = self.account.getAccountData(self.user)          self.download("http://rehost.to/process_download.php",                        get={'user': "cookie", diff --git a/module/plugins/hoster/ShareonlineBiz.py b/module/plugins/hoster/ShareonlineBiz.py index dc3d5093c..bbf75c94a 100644 --- a/module/plugins/hoster/ShareonlineBiz.py +++ b/module/plugins/hoster/ShareonlineBiz.py @@ -14,7 +14,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo  class ShareonlineBiz(SimpleHoster):      __name__    = "ShareonlineBiz"      __type__    = "hoster" -    __version__ = "0.45" +    __version__ = "0.46"      __pattern__ = r'https?://(?:www\.)?(share-online\.biz|egoshare\.com)/(download\.php\?id=|dl/)(?P<ID>\w+)' @@ -28,6 +28,8 @@ class ShareonlineBiz(SimpleHoster):      URL_REPLACEMENTS = [(__pattern__ + ".*", "http://www.share-online.biz/dl/\g<ID>")] +    CHECK_TRAFFIC = True +      RECAPTCHA_KEY = "6LdatrsSAAAAAHZrB70txiV5p-8Iv8BtVxlTtjKX"      ERROR_INFO_PATTERN = r'<p class="b">Information:</p>\s*<div>\s*<strong>(.*?)</strong>' @@ -125,8 +127,6 @@ class ShareonlineBiz(SimpleHoster):      def handlePremium(self):  #: should be working better loading (account) api internally -        self.account.getAccountInfo(self.user, True) -          html = self.load("http://api.share-online.biz/account.php",                          {"username": self.user, "password": self.account.accounts[self.user]['password'],                           "act": "download", "lid": self.info['fileid']}) diff --git a/module/plugins/hoster/SimplydebridCom.py b/module/plugins/hoster/SimplydebridCom.py index 8211d40d4..0be9bfa12 100644 --- a/module/plugins/hoster/SimplydebridCom.py +++ b/module/plugins/hoster/SimplydebridCom.py @@ -36,7 +36,7 @@ class SimplydebridCom(MultiHoster):          self.logDebug("New URL: %s" % self.link)          if not re.match(self.__pattern__, self.link): -            page = self.load("http://simply-debrid.com/api.php", get={'dl': self.link})  # +'&u='+self.user+'&p='+self.account.getAccountData(self.user)['password']) +            page = self.load("http://simply-debrid.com/api.php", get={'dl': self.link})              if 'tiger Link' in page or 'Invalid Link' in page or ('API' in page and 'ERROR' in page):                  self.fail(_("Unable to unrestrict link"))              self.link = page | 
