summaryrefslogtreecommitdiffstats
path: root/module/plugins/hoster/FilecloudIo.py
diff options
context:
space:
mode:
authorGravatar Stefano <l.stickell@yahoo.it> 2013-07-22 20:50:34 +0200
committerGravatar Stefano <l.stickell@yahoo.it> 2013-07-22 20:50:34 +0200
commit2edeee0532ec6d6b4b26fd045a5971f67ca455da (patch)
tree8d656afc9c18f7dba7c05d6635f898fdf58d66d6 /module/plugins/hoster/FilecloudIo.py
parentFixed PEP 8 violations in Crypters (diff)
downloadpyload-2edeee0532ec6d6b4b26fd045a5971f67ca455da.tar.xz
Fixed PEP 8 violations in Hosters
Diffstat (limited to 'module/plugins/hoster/FilecloudIo.py')
-rw-r--r--module/plugins/hoster/FilecloudIo.py45
1 files changed, 23 insertions, 22 deletions
diff --git a/module/plugins/hoster/FilecloudIo.py b/module/plugins/hoster/FilecloudIo.py
index 71af3e9dd..92735d579 100644
--- a/module/plugins/hoster/FilecloudIo.py
+++ b/module/plugins/hoster/FilecloudIo.py
@@ -20,7 +20,7 @@ import re
from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, PluginParseError
from module.common.json_layer import json_loads
from module.plugins.internal.CaptchaService import ReCaptcha
-from module.network.RequestFactory import getURL
+
class FilecloudIo(SimpleHoster):
__name__ = "FilecloudIo"
@@ -34,59 +34,59 @@ class FilecloudIo(SimpleHoster):
FILE_NAME_PATTERN = r'id="aliasSpan">(?P<N>.*?)&nbsp;&nbsp;<'
FILE_OFFLINE_PATTERN = r'l10n.(FILES__DOESNT_EXIST|REMOVED)'
TEMP_OFFLINE_PATTERN = r'l10n.FILES__WARNING'
-
+
UKEY_PATTERN = r"'ukey'\s*:'(\w+)',"
AB1_PATTERN = r"if\( __ab1 == '(\w+)' \)"
ERROR_MSG_PATTERN = r"var __error_msg\s*=\s*l10n\.(.*?);"
DOWNLOAD_LINK_PATTERN = r'"(http://s\d+.filecloud.io/%s/\d+/.*?)"'
- RECAPTCHA_KEY_PATTERN = r"var __recaptcha_public\s*=\s*'([^']+)';"
+ RECAPTCHA_KEY_PATTERN = r"var __recaptcha_public\s*=\s*'([^']+)';"
RECAPTCHA_KEY = '6Lf5OdISAAAAAEZObLcx5Wlv4daMaASRov1ysDB1'
-
+
def setup(self):
self.resumeDownload = self.multiDL = True
self.chunkLimit = 1
-
+
def handleFree(self):
data = {"ukey": self.file_info['ID']}
-
+
found = re.search(self.AB1_PATTERN, self.html)
if not found:
raise PluginParseError("__AB1")
data["__ab1"] = found.group(1)
-
+
if not self.account:
self.fail("User not logged in")
elif not self.account.logged_in:
recaptcha = ReCaptcha(self)
captcha_challenge, captcha_response = recaptcha.challenge(self.RECAPTCHA_KEY)
- self.account.form_data = {"recaptcha_challenge_field" : captcha_challenge,
- "recaptcha_response_field" : captcha_response}
+ self.account.form_data = {"recaptcha_challenge_field": captcha_challenge,
+ "recaptcha_response_field": captcha_response}
self.account.relogin(self.user)
- self.retry(max_tries = 2)
-
+ self.retry(max_tries=2)
+
json_url = "http://filecloud.io/download-request.json"
- response = self.load(json_url, post = data)
- self.logDebug(response)
+ response = self.load(json_url, post=data)
+ self.logDebug(response)
response = json_loads(response)
-
+
if "error" in response and response["error"]:
self.fail(response)
-
+
self.logDebug(response)
if response["captcha"]:
recaptcha = ReCaptcha(self)
found = re.search(self.RECAPTCHA_KEY_PATTERN, self.html)
captcha_key = found.group(1) if found else self.RECAPTCHA_KEY
data["ctype"] = "recaptcha"
-
+
for i in range(5):
data["recaptcha_challenge"], data["recaptcha_response"] = recaptcha.challenge(captcha_key)
-
+
json_url = "http://filecloud.io/download-request.json"
- response = self.load(json_url, post = data)
+ response = self.load(json_url, post=data)
self.logDebug(response)
response = json_loads(response)
-
+
if "retry" in response and response["retry"]:
self.invalidCaptcha()
else:
@@ -102,11 +102,12 @@ class FilecloudIo(SimpleHoster):
raise PluginParseError("Download URL")
download_url = found.group(1)
self.logDebug("Download URL: %s" % download_url)
-
+
if "size" in self.file_info and self.file_info['size']:
- self.check_data = {"size": int(self.file_info['size'])}
+ self.check_data = {"size": int(self.file_info['size'])}
self.download(download_url)
else:
self.fail("Unexpected server response")
-getInfo = create_getInfo(FilecloudIo) \ No newline at end of file
+
+getInfo = create_getInfo(FilecloudIo)