From 2d492e58810a5c0c1a52cee4837b3ca4697531a3 Mon Sep 17 00:00:00 2001 From: RaNaN Date: Sun, 23 Jan 2011 22:02:16 +0100 Subject: FileSonic Premium --- module/plugins/AccountManager.py | 7 +++-- module/plugins/accounts/FilesonicCom.py | 49 +++++++++++++++++++++++++++++++ module/plugins/accounts/ShareonlineBiz.py | 7 +++-- module/plugins/hoster/FilesonicCom.py | 13 ++++---- 4 files changed, 67 insertions(+), 9 deletions(-) create mode 100644 module/plugins/accounts/FilesonicCom.py (limited to 'module/plugins') diff --git a/module/plugins/AccountManager.py b/module/plugins/AccountManager.py index ab35334fc..d0955ecee 100644 --- a/module/plugins/AccountManager.py +++ b/module/plugins/AccountManager.py @@ -101,8 +101,11 @@ class AccountManager(): self.accounts[plugin] = {} elif line.startswith("@"): - option = line[1:].split() - self.accounts[plugin][name]["options"][option[0]] = [] if len(option) < 2 else ([option[1]] if len(option) < 3 else option[1:]) + try: + option = line[1:].split() + self.accounts[plugin][name]["options"][option[0]] = [] if len(option) < 2 else ([option[1]] if len(option) < 3 else option[1:]) + except: + pass elif ":" in line: name, sep, pw = line.partition(":") diff --git a/module/plugins/accounts/FilesonicCom.py b/module/plugins/accounts/FilesonicCom.py new file mode 100644 index 000000000..f80a4a638 --- /dev/null +++ b/module/plugins/accounts/FilesonicCom.py @@ -0,0 +1,49 @@ +# -*- 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 mktime, strptime + +from module.plugins.Account import Account + +class FilesonicCom(Account): + __name__ = "FilesonicCom" + __version__ = "0.2" + __type__ = "account" + __description__ = """filesonic.com account plugin""" + __author_name__ = ("RaNaN") + __author_mail__ = ("RaNaN@pyload.org") + + def loadAccountInfo(self, user, req): + src = req.load("http://www.filesonic.com/user/settings") + + validuntil = re.search(r'\d+-\d+-\d+ \d+:\d+:\d+', src).group(0) + validuntil = int(mktime(strptime(validuntil, "%Y-%m-%d %H:%M:%S"))) + tmp = {"validuntil": validuntil, "trafficleft": -1} + return tmp + + def login(self, user, data, req): + post_vars = { + "email": user, + "password": data["password"], + } + page = req.load("http://www.filesonic.com/user/login", cookies=True, post=post_vars) + + if "Provided password does not match." in page: + self.wrongPassword() diff --git a/module/plugins/accounts/ShareonlineBiz.py b/module/plugins/accounts/ShareonlineBiz.py index 3564d489c..c5e4477be 100644 --- a/module/plugins/accounts/ShareonlineBiz.py +++ b/module/plugins/accounts/ShareonlineBiz.py @@ -31,8 +31,11 @@ class ShareonlineBiz(Account): def loadAccountInfo(self, user, req): src = req.load("http://www.share-online.biz/members.php?setlang=en") - validuntil = re.search(r'Package Expire Date:\s*(\d+/\d+/\d+)', src).group(1) - validuntil = int(mktime(strptime(validuntil, "%m/%d/%y"))) + validuntil = re.search(r'Package Expire Date:\s*(\d+/\d+/\d+)', src) + if validuntil: + validuntil = int(mktime(strptime(validuntil.group(1), "%m/%d/%y"))) + else: + validuntil = -1 tmp = {"validuntil":validuntil, "trafficleft":-1} return tmp diff --git a/module/plugins/hoster/FilesonicCom.py b/module/plugins/hoster/FilesonicCom.py index b79fc406d..5e2c10219 100644 --- a/module/plugins/hoster/FilesonicCom.py +++ b/module/plugins/hoster/FilesonicCom.py @@ -24,14 +24,17 @@ class FilesonicCom(Hoster): self.url = self.convertURL(self.pyfile.url) - self.html = self.load(self.url) + self.html = self.load(self.url, cookies=False) name = re.search(r'Filename:\s*\s*(.*?)<', self.html) if name: self.pyfile.name = name.group(1) else: self.offline() - self.download(self.getFileUrl()) + if self.account: + self.download(pyfile.url) + else: + self.download(self.getFileUrl()) def getFileUrl(self): @@ -55,7 +58,7 @@ class FilesonicCom(Hoster): self.wantReconnect = True self.setWait(wait_time) - self.log.info("%s: Waiting %d seconds." % self.__name__, wait_time) + self.log.info("%s: Waiting %d seconds." % (self.__name__, wait_time)) self.wait() tm = re.search("name='tm' value='(.*?)' />", self.html).group(1) @@ -69,7 +72,7 @@ class FilesonicCom(Hoster): if "Please Enter Password" in self.html: self.fail("implement need pw") - chall = re.search(r'Recaptcha.create("(.*?)",', self.html) + chall = re.search(r'Recaptcha.create\("(.*?)",', self.html) if chall: re_captcha = ReCaptcha(self) challenge, result = re_captcha.challenge(chall.group(1)) @@ -86,7 +89,7 @@ class FilesonicCom(Hoster): id = re.search("/file/([0-9]+(/.+)?)", url) if not id: id = re.search("/file/[a-z0-9]+/([0-9]+(/.+)?)", url) - return ("http://www.filesonic.com/file/" + id.group(1)) + return "http://www.filesonic.com/file/" + id.group(1) def handleErrors(self): if "The file that you're trying to download is larger than" in self.html: -- cgit v1.2.3