From 4c6fbd8177a7499608b177d64297dc5117a8dd9a Mon Sep 17 00:00:00 2001 From: mkaay Date: Fri, 7 May 2010 17:31:29 +0200 Subject: UploadedTo account plugin --- module/plugins/accounts/UploadedTo.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'module/plugins/accounts') 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: (.*?)", html).group(1) + raw_valid = re.search(r"Valid until: (.*?)", 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: -- cgit v1.2.3