diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2011-02-22 20:38:45 +0100 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2011-02-22 20:38:45 +0100 |
commit | 3b0f78439f70ede5dd0c24af39d7eb1b79b1446c (patch) | |
tree | a5946290c13a3e85fc4e1e67493fd0f26ba9fff9 /module/plugins | |
parent | NCryptIn: Bug fixes (diff) | |
download | pyload-3b0f78439f70ede5dd0c24af39d7eb1b79b1446c.tar.xz |
filesonic info prefetching + premium fix
Diffstat (limited to 'module/plugins')
-rw-r--r-- | module/plugins/accounts/FilesonicCom.py | 7 | ||||
-rw-r--r-- | module/plugins/hoster/FilesonicCom.py | 17 |
2 files changed, 20 insertions, 4 deletions
diff --git a/module/plugins/accounts/FilesonicCom.py b/module/plugins/accounts/FilesonicCom.py index f80a4a638..08f6ab4d2 100644 --- a/module/plugins/accounts/FilesonicCom.py +++ b/module/plugins/accounts/FilesonicCom.py @@ -31,7 +31,7 @@ class FilesonicCom(Account): __author_mail__ = ("RaNaN@pyload.org") def loadAccountInfo(self, user, req): - src = req.load("http://www.filesonic.com/user/settings") + src = req.load("http://www.filesonic.com/user/settings").decode("utf8") validuntil = re.search(r'\d+-\d+-\d+ \d+:\d+:\d+', src).group(0) validuntil = int(mktime(strptime(validuntil, "%Y-%m-%d %H:%M:%S"))) @@ -42,8 +42,9 @@ class FilesonicCom(Account): post_vars = { "email": user, "password": data["password"], + "rememberMe" : 1 } - page = req.load("http://www.filesonic.com/user/login", cookies=True, post=post_vars) + page = req.load("http://www.filesonic.com/user/login", cookies=True, post=post_vars).decode("utf8") - if "Provided password does not match." in page: + if "Provided password does not match." in page or "You must be logged in to view this page." in page: self.wrongPassword() diff --git a/module/plugins/hoster/FilesonicCom.py b/module/plugins/hoster/FilesonicCom.py index 5bd38655a..1d5a5ceef 100644 --- a/module/plugins/hoster/FilesonicCom.py +++ b/module/plugins/hoster/FilesonicCom.py @@ -5,7 +5,22 @@ import re from module.plugins.Hoster import Hoster
from module.plugins.ReCaptcha import ReCaptcha
-
+from module.plugins.Plugin import chunks
+
+from module.network.RequestFactory import getURL
+
+def getInfo(urls):
+ for chunk in chunks(urls, 15):
+ page = getURL("http://www.filesonic.com/link-checker", post={"links": "\n".join(chunk)}).decode("utf8", "ignore")
+
+ found = re.findall(r'<tr>\s+<td class="source"><span>([^<]+)</span></td>\s+<td class="fileName"><span>([^<]+)</span></td>\s+<td class="fileSize"><span>([0-9]+) MB</span></td>\s+<td class="availability"><span>\s+<strong style="font-weight: strong; color: green;">([^<]+)</strong><br />\s+</span>\s+</td>\s+</tr>', page, re.MULTILINE)
+ result = []
+ for src, name, size, status in found:
+ print src, name, size, status
+ result.append((name, int(size)*1024*1024, 2 if status == "Available" else 1, src))
+
+
+ yield result
class FilesonicCom(Hoster):
__name__ = "FilesonicCom"
|