diff options
| -rw-r--r-- | module/plugins/accounts/ReloadCc.py | 17 | ||||
| -rw-r--r-- | module/plugins/hooks/ReloadCc.py | 24 | ||||
| -rw-r--r-- | module/plugins/hoster/ReloadCc.py | 21 | 
3 files changed, 39 insertions, 23 deletions
diff --git a/module/plugins/accounts/ReloadCc.py b/module/plugins/accounts/ReloadCc.py index c1efd05c5..e0eb5df6e 100644 --- a/module/plugins/accounts/ReloadCc.py +++ b/module/plugins/accounts/ReloadCc.py @@ -4,7 +4,7 @@ from module.common.json_layer import json_loads  class ReloadCc(Account):      __name__ = "ReloadCc" -    __version__ = "0.1" +    __version__ = "0.2"      __type__ = "account"      __description__ = """Reload.Cc account plugin""" @@ -34,13 +34,18 @@ class ReloadCc(Account):      def getAccountStatus(self, user, req): -        pwd = "pwd=%s" % self.accounts[user]['password'] +        # Use reload.cc API v1 to retrieve account info and return the parsed json answer +        query_params = dict( +            via='pyload', +            v=1, +            get_traffic='true', +            user=user +        )          try: -            pwd = "hash=%s" % self.accounts[user]['pwdhash'] +            query_params.update(dict(hash=self.infos[user]['pwdhash']))          except Exception: -            pass +            query_params.update(dict(pwd=self.accounts[user]['password'])) -        # Use reload.cc API v1 to retrieve account info and return the parsed json answer -        answer = req.load("https://api.reload.cc/login?via=pyload&v=1&get_traffic=true&user=%s&%s" % (user, pwd))             +        answer = req.load("https://api.reload.cc/login", get=query_params)                    return json_loads(answer)
\ No newline at end of file diff --git a/module/plugins/hooks/ReloadCc.py b/module/plugins/hooks/ReloadCc.py index 1d4adfbe3..e563e81ba 100644 --- a/module/plugins/hooks/ReloadCc.py +++ b/module/plugins/hooks/ReloadCc.py @@ -5,7 +5,7 @@ from module.network.RequestFactory import getURL  class ReloadCc(MultiHoster):      __name__ = "ReloadCc" -    __version__ = "0.1" +    __version__ = "0.2"      __type__ = "hook"      __description__ = """Reload.cc hook plugin""" @@ -16,7 +16,7 @@ class ReloadCc(MultiHoster):      __author_name__ = ("Reload Team")      __author_mail__ = ("hello@reload.cc") -    interval = 0 # Disable periodic calls, we dont use them anyway +    interval = 0 # Disable periodic calls      def getHoster(self):               # If no accounts are available there will be no hosters available @@ -26,16 +26,22 @@ class ReloadCc(MultiHoster):          # Get account data          (user, data) = self.account.selectAccount() -         -        pwd = "pwd=%s" % data['password'] + +        # Get supported hosters list from reload.cc using the json API v1 +        query_params = dict( +            via='pyload', +            v=1, +            get_supported='true', +            get_traffic='true', +            user=user +        )          try: -            pwd = "hash=%s" % data['pwdhash'] +            query_params.update(dict(hash=self.account.infos[user]['pwdhash']))          except Exception: -            pass +            query_params.update(dict(pwd=data['password'])) -        # Get supported hosters list from reload.cc using the json API v1 -        answer = getURL("https://api.reload.cc/login?via=pyload&v=1&get_supported=true&get_traffic=true&user=%s&%s" % (user, pwd)) +        answer = getURL("https://api.reload.cc/login", get=query_params)          data = json_loads(answer) @@ -52,7 +58,7 @@ class ReloadCc(MultiHoster):          self.account = self.core.accountManager.getAccountPlugin("ReloadCc")               if not self.account.canUse():              self.account = None -            self.logError(_("Please add a valid reload.cc account first and restart pyLoad.")) +            self.logError("Please add a valid reload.cc account first and restart pyLoad.")              return          # Run the overwriten core ready which actually enables the multihoster hook  diff --git a/module/plugins/hoster/ReloadCc.py b/module/plugins/hoster/ReloadCc.py index 36e76226c..1fb1d4419 100644 --- a/module/plugins/hoster/ReloadCc.py +++ b/module/plugins/hoster/ReloadCc.py @@ -4,7 +4,7 @@ from module.common.json_layer import json_loads  class ReloadCc(Hoster):      __name__ = "ReloadCc" -    __version__ = "0.1.1" +    __version__ = "0.2"      __type__ = "hoster"      __description__ = """Reload.Cc hoster plugin""" @@ -17,7 +17,7 @@ class ReloadCc(Hoster):      def process(self, pyfile):          # Check account          if not self.account or not self.account.canUse(): -            self.logError(_("Please enter a valid reload.cc account or deactivate this plugin")) +            self.logError("Please enter a valid reload.cc account or deactivate this plugin")              self.fail("No valid reload.cc account provided")          # In some cases hostsers do not supply us with a filename at download, so we are going to set a fall back filename (e.g. for freakshare or xfileshare) @@ -31,17 +31,22 @@ class ReloadCc(Hoster):          # Get account data          (user, data) = self.account.selectAccount() -         -        pwd = "pwd=%s" % data['password'] + +        query_params = dict( +            via='pyload', +            v=1, +            user=user, +            uri=self.pyfile.url +        )          try: -            pwd = "hash=%s" % data['pwdhash'] +            query_params.update(dict(hash=self.account.infos[user]['pwdhash']))          except Exception: -            pass +            query_params.update(dict(pwd=data['password']))          # Get rewritten link using the reload.cc api v1 -        answer = self.load("https://api.reload.cc/dl?via=pyload&v=1&user=%s&%s&uri=%s" % (user, pwd, self.pyfile.url)) -        data = json_loads(answer)                 +        answer = self.load("https://api.reload.cc/dl", get=query_params) +        data = json_loads(answer)          # Check status and decide what to do          status = data['status']  | 
