diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2010-08-12 19:42:46 +0200 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2010-08-12 19:42:46 +0200 |
commit | e655d860882fff63160098f063fc3e4c9b8c0ba5 (patch) | |
tree | e05cbf8628841a64952d294663bd263c19d2bbcd /module/plugins | |
parent | merge (diff) | |
download | pyload-e655d860882fff63160098f063fc3e4c9b8c0ba5.tar.xz |
web if acc settings
Diffstat (limited to 'module/plugins')
-rw-r--r-- | module/plugins/accounts/RapidshareCom.py | 51 | ||||
-rw-r--r-- | module/plugins/accounts/UploadedTo.py | 35 |
2 files changed, 46 insertions, 40 deletions
diff --git a/module/plugins/accounts/RapidshareCom.py b/module/plugins/accounts/RapidshareCom.py index 052470ada..7f5fff84d 100644 --- a/module/plugins/accounts/RapidshareCom.py +++ b/module/plugins/accounts/RapidshareCom.py @@ -28,31 +28,34 @@ class RapidshareCom(Account): __author_mail__ = ("mkaay@mkaay.de") def getAccountInfo(self, user): - data = None - for account in self.accounts.items(): - if account[0] == user: - data = account[1] - if not data: - return - req = self.core.requestFactory.getRequest(self.__name__, user) - api_url_base = "http://api.rapidshare.com/cgi-bin/rsapi.cgi" - api_param_prem = {"sub": "getaccountdetails_v1", "type": "prem", "login": user, "password": data["password"], "withcookie": 1} - src = req.load(api_url_base, cookies=False, get=api_param_prem) - if src.startswith("ERROR"): - return - fields = src.split("\n") - info = {} - for t in fields: - if not t.strip(): - continue - k, v = t.split("=") - info[k] = v + try: + data = None + for account in self.accounts.items(): + if account[0] == user: + data = account[1] + if not data: + return + req = self.core.requestFactory.getRequest(self.__name__, user) + api_url_base = "http://api.rapidshare.com/cgi-bin/rsapi.cgi" + api_param_prem = {"sub": "getaccountdetails_v1", "type": "prem", "login": user, "password": data["password"], "withcookie": 1} + src = req.load(api_url_base, cookies=False, get=api_param_prem) + if src.startswith("ERROR"): + return + fields = src.split("\n") + info = {} + for t in fields: + if not t.strip(): + continue + k, v = t.split("=") + info[k] = v + + out = Account.getAccountInfo(self, user) + tmp = {"validuntil":None, "login":str(info["accountid"]), "trafficleft":int(info["tskb"]), "type":self.__name__} + out.update(tmp) - out = Account.getAccountInfo(self, user) - tmp = {"validuntil":None, "login":str(info["accountid"]), "trafficleft":int(info["tskb"]), "type":self.__name__} - out.update(tmp) - - return out + return out + except: + return Account.getAccountInfo(self, user) def login(self, user, data): req = self.core.requestFactory.getRequest(self.__name__, user) diff --git a/module/plugins/accounts/UploadedTo.py b/module/plugins/accounts/UploadedTo.py index d2aa22b22..926f91255 100644 --- a/module/plugins/accounts/UploadedTo.py +++ b/module/plugins/accounts/UploadedTo.py @@ -30,22 +30,25 @@ class UploadedTo(Account): __author_mail__ = ("mkaay@mkaay.de") def getAccountInfo(self, user): - data = None - for account in self.accounts.items(): - if account[0] == user: - data = account[1] - if not data: - return - req = self.core.requestFactory.getRequest(self.__name__, user) - html = req.load("http://uploaded.to/", cookies=True) - raw_traffic = re.search(r"Traffic left: </span><span class=.*?>(.*?)</span>", html).group(1) - raw_valid = re.search(r"Valid until: </span> <span class=.*?>(.*?)</span>", html).group(1) - traffic = int(self.parseTraffic(raw_traffic)) - validuntil = int(mktime(strptime(raw_valid.strip(), "%d-%m-%Y %H:%M"))) - out = Account.getAccountInfo(self, user) - tmp = {"login":user, "validuntil":validuntil, "trafficleft":traffic, "type":self.__name__} - out.update(tmp) - return out + try: + data = None + for account in self.accounts.items(): + if account[0] == user: + data = account[1] + if not data: + return + req = self.core.requestFactory.getRequest(self.__name__, user) + html = req.load("http://uploaded.to/", cookies=True) + raw_traffic = re.search(r"Traffic left: </span><span class=.*?>(.*?)</span>", html).group(1) + raw_valid = re.search(r"Valid until: </span> <span class=.*?>(.*?)</span>", html).group(1) + traffic = int(self.parseTraffic(raw_traffic)) + validuntil = int(mktime(strptime(raw_valid.strip(), "%d-%m-%Y %H:%M"))) + out = Account.getAccountInfo(self, user) + tmp = {"login":user, "validuntil":validuntil, "trafficleft":traffic, "type":self.__name__} + out.update(tmp) + return out + except: + return Account.getAccountInfo(self, user) def login(self, user, data): req = self.core.requestFactory.getRequest(self.__name__, user) |