diff options
author | mkaay <mkaay@mkaay.de> | 2010-05-07 17:31:29 +0200 |
---|---|---|
committer | mkaay <mkaay@mkaay.de> | 2010-05-07 17:31:29 +0200 |
commit | 4c6fbd8177a7499608b177d64297dc5117a8dd9a (patch) | |
tree | 903187b2fb69eabe3b6f59c31e2d9f245bdd0412 /module/plugins/accounts | |
parent | better rapidshare traffic share handling (diff) | |
download | pyload-4c6fbd8177a7499608b177d64297dc5117a8dd9a.tar.xz |
UploadedTo account plugin
Diffstat (limited to 'module/plugins/accounts')
-rw-r--r-- | module/plugins/accounts/UploadedTo.py | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/module/plugins/accounts/UploadedTo.py b/module/plugins/accounts/UploadedTo.py index a477fa6b1..9c0d90747 100644 --- a/module/plugins/accounts/UploadedTo.py +++ b/module/plugins/accounts/UploadedTo.py @@ -18,6 +18,8 @@ """ from module.plugins.Account import Account +import re +from time import strptime, mktime class UploadedTo(Account): __name__ = "UploadedTo" @@ -27,8 +29,20 @@ class UploadedTo(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 + 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"))) + return {"login":name, "validuntil":validuntil, "trafficleft":traffic} def login(self): for account in self.accounts: |