summaryrefslogtreecommitdiffstats
path: root/module/plugins/accounts/RapidshareCom.py
diff options
context:
space:
mode:
authorGravatar mkaay <mkaay@mkaay.de> 2010-05-07 16:45:58 +0200
committerGravatar mkaay <mkaay@mkaay.de> 2010-05-07 16:45:58 +0200
commit898a4b1fc1006e85355b34b677b91e5413dd5a86 (patch)
tree21f79a2da9e3db3fed49deabfd707e6bd9a87ea8 /module/plugins/accounts/RapidshareCom.py
parentbetter cookie handling, rapidshare fix (diff)
downloadpyload-898a4b1fc1006e85355b34b677b91e5413dd5a86.tar.xz
better rapidshare traffic share handling
Diffstat (limited to 'module/plugins/accounts/RapidshareCom.py')
-rw-r--r--module/plugins/accounts/RapidshareCom.py28
1 files changed, 26 insertions, 2 deletions
diff --git a/module/plugins/accounts/RapidshareCom.py b/module/plugins/accounts/RapidshareCom.py
index f18fadd15..c9113afd7 100644
--- a/module/plugins/accounts/RapidshareCom.py
+++ b/module/plugins/accounts/RapidshareCom.py
@@ -27,8 +27,32 @@ class RapidshareCom(Account):
__author_name__ = ("mkaay")
__author_mail__ = ("mkaay@mkaay.de")
- def getAccountInfo(self):
- pass
+ def getAccountInfo(self, name):
+ req = self.core.requestFactory.getRequest(self.__name__, name)
+ data = None
+ for account in self.accounts:
+ if account[0] == name:
+ data = account
+ if not data:
+ return
+ api_url_base = "http://api.rapidshare.com/cgi-bin/rsapi.cgi"
+ api_param_prem = {"sub": "getaccountdetails_v1", "type": "prem", "login": data[0], "password": data[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 = {"validuntil":int(info["validuntil"]), "login":str(info["accountid"]), "trafficleft":int(info["premkbleft"])}
+ if int(info["plustrafficmode"]) == 1 or int(info["plustrafficmode"]) == 3:
+ out["trafficleft"] += int(info["bodkb"])
+ if int(info["plustrafficmode"]) == 2 or int(info["plustrafficmode"]) == 3:
+ out["trafficleft"] += 15*1024*int(info["ppoints"])
+ return out
def login(self):
for account in self.accounts: