From cac52bbf8b0e928a83a29b744bff20240c8e7354 Mon Sep 17 00:00:00 2001 From: RaNaN Date: Wed, 6 Oct 2010 22:24:17 +0200 Subject: freakshare premium, closed #146, closed #147 --- module/plugins/accounts/FreakshareCom.py | 53 ++++++++++++++++++++++++++++++++ module/plugins/accounts/NetloadIn.py | 15 +++++++-- 2 files changed, 66 insertions(+), 2 deletions(-) create mode 100644 module/plugins/accounts/FreakshareCom.py (limited to 'module/plugins/accounts') diff --git a/module/plugins/accounts/FreakshareCom.py b/module/plugins/accounts/FreakshareCom.py new file mode 100644 index 000000000..ba9566522 --- /dev/null +++ b/module/plugins/accounts/FreakshareCom.py @@ -0,0 +1,53 @@ +# -*- 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 = self.getAccountRequest(user) + 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 = self.getAccountRequest(user) + 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() diff --git a/module/plugins/accounts/NetloadIn.py b/module/plugins/accounts/NetloadIn.py index 28b3a1c56..16e06b688 100644 --- a/module/plugins/accounts/NetloadIn.py +++ b/module/plugins/accounts/NetloadIn.py @@ -18,6 +18,8 @@ """ from module.plugins.Account import Account +import re +from time import time class NetloadIn(Account): __name__ = "NetloadIn" @@ -26,8 +28,17 @@ class NetloadIn(Account): __description__ = """netload.in account plugin""" __author_name__ = ("RaNaN") __author_mail__ = ("RaNaN@pyload.org") + + def loadAccountInfo(self, user): + req = self.getAccountRequest(user) + page = req.load("http://netload.in/index.php?id=2") + left = r">(\d+) Tage, (\d+) Stunden<" + left = re.search(left, page) + validuntil = time() + int(left.group(1)) * 24 * 60 * 60 + int(left.group(2)) * 60 * 60 + return {"validuntil": validuntil, "trafficleft": -1} def login(self, user, data): req = self.getAccountRequest(user) - req.load("http://netload.in/index.php", None, { "txtuser" : user, "txtpass" : data['password'], "txtcheck" : "login", "txtlogin" : ""}, cookies=True) - + page = req.load("http://netload.in/index.php", None, { "txtuser" : user, "txtpass" : data['password'], "txtcheck" : "login", "txtlogin" : ""}, cookies=True) + if "password or it might be invalid!" in page: + self.wrongPassword() -- cgit v1.2.3