summaryrefslogtreecommitdiffstats
path: root/module/plugins/hoster/BitshareCom.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/BitshareCom.py
parentFixed PEP 8 violations in Crypters (diff)
downloadpyload-2edeee0532ec6d6b4b26fd045a5971f67ca455da.tar.xz
Fixed PEP 8 violations in Hosters
Diffstat (limited to 'module/plugins/hoster/BitshareCom.py')
-rw-r--r--module/plugins/hoster/BitshareCom.py38
1 files changed, 19 insertions, 19 deletions
diff --git a/module/plugins/hoster/BitshareCom.py b/module/plugins/hoster/BitshareCom.py
index 5e117ff45..82c2fe9cb 100644
--- a/module/plugins/hoster/BitshareCom.py
+++ b/module/plugins/hoster/BitshareCom.py
@@ -15,9 +15,9 @@ class BitshareCom(SimpleHoster):
__description__ = """Bitshare.Com File Download Hoster"""
__author_name__ = ("paulking", "fragonib")
__author_mail__ = (None, "fragonib[AT]yahoo[DOT]es")
-
+
HOSTER_DOMAIN = "bitshare.com"
- FILE_OFFLINE_PATTERN = r'''(>We are sorry, but the requested file was not found in our database|>Error - File not available<|The file was deleted either by the uploader, inactivity or due to copyright claim)'''
+ FILE_OFFLINE_PATTERN = r'(>We are sorry, but the requested file was not found in our database|>Error - File not available<|The file was deleted either by the uploader, inactivity or due to copyright claim)'
FILE_NAME_PATTERN = r'Download:</td>\s*<td><input type="text" value="http://bitshare\.com/files/\w+/(?P<N>[^"]+)\.html"'
FILE_SIZE_PATTERN = r'- (?P<S>[\d.]+) (?P<U>\w+)</h1>'
FILE_AJAXID_PATTERN = r'var ajaxdl = "(.*?)";'
@@ -31,12 +31,12 @@ class BitshareCom(SimpleHoster):
def process(self, pyfile):
if self.premium:
self.account.relogin(self.user)
-
+
self.pyfile = pyfile
-
+
# File id
m = re.match(self.__pattern__, self.pyfile.url)
- self.file_id = max(m.group('id1'), m.group('id2'))
+ self.file_id = max(m.group('id1'), m.group('id2'))
self.logDebug("File id is [%s]" % self.file_id)
# Load main page
@@ -66,24 +66,23 @@ class BitshareCom(SimpleHoster):
# Ajax file id
self.ajaxid = re.search(BitshareCom.FILE_AJAXID_PATTERN, self.html).group(1)
self.logDebug("File ajax id is [%s]" % self.ajaxid)
-
+
# This may either download our file or forward us to an error page
- url = self.getDownloadUrl()
+ url = self.getDownloadUrl()
self.logDebug("Downloading file with url [%s]" % url)
self.download(url)
-
def getDownloadUrl(self):
# Return location if direct download is active
if self.premium:
- header = self.load(self.pyfile.url, cookies = True, just_header = True)
+ header = self.load(self.pyfile.url, cookies=True, just_header=True)
if 'location' in header:
- return header['location']
-
+ return header['location']
+
# Get download info
self.logDebug("Getting download info")
response = self.load("http://bitshare.com/files-ajax/" + self.file_id + "/request.html",
- post={"request" : "generateID", "ajaxid" : self.ajaxid})
+ post={"request": "generateID", "ajaxid": self.ajaxid})
self.handleErrors(response, ':')
parts = response.split(":")
filetype = parts[0]
@@ -108,24 +107,24 @@ class BitshareCom(SimpleHoster):
id = re.search(BitshareCom.CAPTCHA_KEY_PATTERN, self.html).group(1)
# Try up to 3 times
for i in range(3):
- self.logDebug("Resolving ReCaptcha with key [%s], round %d" % (id, i+1))
+ self.logDebug("Resolving ReCaptcha with key [%s], round %d" % (id, i + 1))
recaptcha = ReCaptcha(self)
challenge, code = recaptcha.challenge(id)
response = self.load("http://bitshare.com/files-ajax/" + self.file_id + "/request.html",
- post={"request" : "validateCaptcha", "ajaxid" : self.ajaxid, "recaptcha_challenge_field" : challenge, "recaptcha_response_field" : code})
+ post={"request": "validateCaptcha", "ajaxid": self.ajaxid,
+ "recaptcha_challenge_field": challenge, "recaptcha_response_field": code})
if self.handleCaptchaErrors(response):
break
-
# Get download URL
self.logDebug("Getting download url")
response = self.load("http://bitshare.com/files-ajax/" + self.file_id + "/request.html",
- post={"request" : "getDownloadURL", "ajaxid" : self.ajaxid})
+ post={"request": "getDownloadURL", "ajaxid": self.ajaxid})
self.handleErrors(response, '#')
- url = response.split("#")[-1]
-
+ url = response.split("#")[-1]
+
return url
-
+
def handleErrors(self, response, separator):
self.logDebug("Checking response [%s]" % response)
if "ERROR:Session timed out" in response:
@@ -144,4 +143,5 @@ class BitshareCom(SimpleHoster):
self.logDebug("Wrong captcha")
self.invalidCaptcha()
+
getInfo = create_getInfo(BitshareCom)