summaryrefslogtreecommitdiffstats
path: root/module
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2011-01-23 22:02:16 +0100
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2011-01-23 22:02:16 +0100
commit2d492e58810a5c0c1a52cee4837b3ca4697531a3 (patch)
treea7dc1b9421f708cbfd3efe375f9f6670a783f030 /module
parentadded missing curl.close (diff)
downloadpyload-2d492e58810a5c0c1a52cee4837b3ca4697531a3.tar.xz
FileSonic Premium
Diffstat (limited to 'module')
-rw-r--r--module/network/HTTPRequest.py2
-rw-r--r--module/plugins/AccountManager.py7
-rw-r--r--module/plugins/accounts/FilesonicCom.py49
-rw-r--r--module/plugins/accounts/ShareonlineBiz.py7
-rw-r--r--module/plugins/hoster/FilesonicCom.py13
5 files changed, 68 insertions, 10 deletions
diff --git a/module/network/HTTPRequest.py b/module/network/HTTPRequest.py
index fa34ad5b3..ebb3c3177 100644
--- a/module/network/HTTPRequest.py
+++ b/module/network/HTTPRequest.py
@@ -65,7 +65,7 @@ class HTTPRequest():
self.c.setopt(pycurl.AUTOREFERER, 1)
self.c.setopt(pycurl.SSL_VERIFYPEER, 0)
self.c.setopt(pycurl.LOW_SPEED_TIME, 30)
- self.c.setopt(pycurl.LOW_SPEED_LIMIT, 20)
+ self.c.setopt(pycurl.LOW_SPEED_LIMIT, 100)
#self.c.setopt(pycurl.VERBOSE, 1)
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 <http://www.gnu.org/licenses/>.
+
+ @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'<td align="left"><b>Package Expire Date:</b></td>\s*<td align="left">(\d+/\d+/\d+)</td>', src).group(1)
- validuntil = int(mktime(strptime(validuntil, "%m/%d/%y")))
+ validuntil = re.search(r'<td align="left"><b>Package Expire Date:</b></td>\s*<td align="left">(\d+/\d+/\d+)</td>', 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*</span>\s*<strong>(.*?)<', 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: