From 16af85004c84d0d6c626b4f8424ce9647669a0c1 Mon Sep 17 00:00:00 2001 From: RaNaN Date: Sun, 9 Jun 2013 18:10:22 +0200 Subject: moved everything from module to pyload --- pyload/plugins/accounts/FreakshareCom.py | 51 ++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 pyload/plugins/accounts/FreakshareCom.py (limited to 'pyload/plugins/accounts/FreakshareCom.py') diff --git a/pyload/plugins/accounts/FreakshareCom.py b/pyload/plugins/accounts/FreakshareCom.py new file mode 100644 index 000000000..732f9e203 --- /dev/null +++ b/pyload/plugins/accounts/FreakshareCom.py @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- + +""" + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, + or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, see . + + @author: RaNaN +""" +import re +from time import strptime, mktime + +from module.plugins.Account import Account + +class FreakshareCom(Account): + __name__ = "FreakshareCom" + __version__ = "0.1" + __type__ = "account" + __description__ = """freakshare.com account plugin""" + __author_name__ = ("RaNaN") + __author_mail__ = ("RaNaN@pyload.org") + + def loadAccountInfo(self, user, req): + page = req.load("http://freakshare.com/") + + validuntil = r"ltig bis:\s*([0-9 \-:.]+)" + validuntil = re.search(validuntil, page, re.MULTILINE) + validuntil = validuntil.group(1).strip() + validuntil = mktime(strptime(validuntil, "%d.%m.%Y - %H:%M")) + + traffic = r"Traffic verbleibend:\s*([^<]+)" + traffic = re.search(traffic, page, re.MULTILINE) + traffic = traffic.group(1).strip() + traffic = self.parseTraffic(traffic) + + return {"validuntil": validuntil, "trafficleft": traffic} + + def login(self, user, data, req): + page = req.load("http://freakshare.com/login.html", None, { "submit" : "Login", "user" : user, "pass" : data['password']}, cookies=True) + + if "Falsche Logindaten!" in page or "Wrong Username or Password!" in page: + self.wrongPassword() -- cgit v1.2.3