summaryrefslogtreecommitdiffstats
path: root/module/plugins/hoster
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-06-17 18:59:20 +0200
committerGravatar Walter Purcaro <vuolter@users.noreply.github.com> 2015-06-24 22:42:40 +0200
commit20b6a2ec022202b0efb6cb69415239fb8f4d1445 (patch)
treefdbb3ad42854144b1cace0221145a472b36ef84d /module/plugins/hoster
parentSpare code cosmetics (diff)
downloadpyload-20b6a2ec022202b0efb6cb69415239fb8f4d1445.tar.xz
Spare code cosmetics (2)
Diffstat (limited to 'module/plugins/hoster')
-rw-r--r--module/plugins/hoster/BitshareCom.py26
-rw-r--r--module/plugins/hoster/CzshareCom.py20
-rw-r--r--module/plugins/hoster/DlFreeFr.py4
-rw-r--r--module/plugins/hoster/FileSharkPl.py2
-rw-r--r--module/plugins/hoster/FilepostCom.py16
-rw-r--r--module/plugins/hoster/FilesMailRu.py22
-rw-r--r--module/plugins/hoster/FileserveCom.py6
-rw-r--r--module/plugins/hoster/FlyFilesNet.py2
-rw-r--r--module/plugins/hoster/FreakshareCom.py8
-rw-r--r--module/plugins/hoster/FreeWayMe.py8
-rw-r--r--module/plugins/hoster/Ftp.py2
-rw-r--r--module/plugins/hoster/Keep2ShareCc.py6
-rw-r--r--module/plugins/hoster/KingfilesNet.py4
-rw-r--r--module/plugins/hoster/LoadTo.py6
-rw-r--r--module/plugins/hoster/LuckyShareNet.py4
-rw-r--r--module/plugins/hoster/MegaCoNz.py46
-rw-r--r--module/plugins/hoster/MegacrypterCom.py14
-rw-r--r--module/plugins/hoster/MegasharesCom.py4
-rw-r--r--module/plugins/hoster/NitroflareCom.py2
-rw-r--r--module/plugins/hoster/NoPremiumPl.py4
-rw-r--r--module/plugins/hoster/NosuploadCom.py6
-rw-r--r--module/plugins/hoster/OboomCom.py2
-rw-r--r--module/plugins/hoster/PornhostCom.py4
-rw-r--r--module/plugins/hoster/PornhubCom.py2
-rw-r--r--module/plugins/hoster/PremiumTo.py2
-rw-r--r--module/plugins/hoster/PremiumizeMe.py14
-rw-r--r--module/plugins/hoster/PromptfileCom.py2
-rw-r--r--module/plugins/hoster/QuickshareCz.py8
-rw-r--r--module/plugins/hoster/RPNetBiz.py14
-rw-r--r--module/plugins/hoster/RapideoPl.py4
-rw-r--r--module/plugins/hoster/ShareplaceCom.py2
-rw-r--r--module/plugins/hoster/SmoozedCom.py12
-rw-r--r--module/plugins/hoster/SoundcloudCom.py2
-rw-r--r--module/plugins/hoster/StreamCz.py2
-rw-r--r--module/plugins/hoster/TurbobitNet.py6
-rw-r--r--module/plugins/hoster/UlozTo.py10
-rw-r--r--module/plugins/hoster/UploadableCh.py10
-rw-r--r--module/plugins/hoster/UploadedTo.py2
-rw-r--r--module/plugins/hoster/UpstoreNet.py8
-rw-r--r--module/plugins/hoster/VeehdCom.py2
-rw-r--r--module/plugins/hoster/Xdcc.py24
-rw-r--r--module/plugins/hoster/YourfilesTo.py2
-rw-r--r--module/plugins/hoster/YoutubeCom.py10
-rw-r--r--module/plugins/hoster/ZippyshareCom.py16
44 files changed, 186 insertions, 186 deletions
diff --git a/module/plugins/hoster/BitshareCom.py b/module/plugins/hoster/BitshareCom.py
index f3d513adf..2736d98a8 100644
--- a/module/plugins/hoster/BitshareCom.py
+++ b/module/plugins/hoster/BitshareCom.py
@@ -40,25 +40,25 @@ class BitshareCom(SimpleHoster):
if self.premium:
self.account.relogin(self.user)
- # File id
+ #: File id
m = re.match(self.__pattern__, pyfile.url)
self.file_id = max(m.group('ID1'), m.group('ID2'))
self.logDebug("File id is [%s]" % self.file_id)
- # Load main page
+ #: Load main page
self.html = self.load(pyfile.url, ref=False)
- # Check offline
+ #: Check offline
if re.search(self.OFFLINE_PATTERN, self.html):
self.offline()
- # Check Traffic used up
+ #: Check Traffic used up
if re.search(self.TRAFFIC_USED_UP, self.html):
self.logInfo(_("Your Traffic is used up for today"))
self.wait(30 * 60, True)
self.retry()
- # File name
+ #: File name
m = re.match(self.__pattern__, pyfile.url)
name1 = m.group('NAME') if m else None
@@ -67,11 +67,11 @@ class BitshareCom(SimpleHoster):
pyfile.name = max(name1, name2)
- # Ajax file id
+ #: Ajax file id
self.ajaxid = re.search(self.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
+ #: This may either download our file or forward us to an error page
self.link = self.getDownloadUrl()
if self.checkDownload({"error": ">Error occured<"}):
@@ -79,13 +79,13 @@ class BitshareCom(SimpleHoster):
def getDownloadUrl(self):
- # Return location if direct download is active
+ #: Return location if direct download is active
if self.premium:
header = self.load(self.pyfile.url, just_header=True)
if 'location' in header:
return header['location']
- # Get download info
+ #: Get download info
self.logDebug("Getting download info")
res = self.load("http://bitshare.com/files-ajax/" + self.file_id + "/request.html",
post={"request": "generateID", "ajaxid": self.ajaxid})
@@ -99,7 +99,7 @@ class BitshareCom(SimpleHoster):
self.logDebug("Download info [type: '%s', waiting: %d, captcha: %d]" % (filetype, wait, captcha))
- # Waiting
+ #: Waiting
if wait > 0:
self.logDebug("Waiting %d seconds." % wait)
if wait < 120:
@@ -108,12 +108,12 @@ class BitshareCom(SimpleHoster):
self.wait(wait - 55, True)
self.retry()
- # Resolve captcha
+ #: Resolve captcha
if captcha == 1:
self.logDebug("File is captcha protected")
recaptcha = ReCaptcha(self)
- # Try up to 3 times
+ #: Try up to 3 times
for i in xrange(3):
response, challenge = recaptcha.challenge()
res = self.load("http://bitshare.com/files-ajax/" + self.file_id + "/request.html",
@@ -124,7 +124,7 @@ class BitshareCom(SimpleHoster):
if self.handleCaptchaErrors(res):
break
- # Get download URL
+ #: Get download URL
self.logDebug("Getting download url")
res = self.load("http://bitshare.com/files-ajax/" + self.file_id + "/request.html",
post={"request": "getDownloadURL", "ajaxid": self.ajaxid})
diff --git a/module/plugins/hoster/CzshareCom.py b/module/plugins/hoster/CzshareCom.py
index e3d89a2a5..01e120e5e 100644
--- a/module/plugins/hoster/CzshareCom.py
+++ b/module/plugins/hoster/CzshareCom.py
@@ -40,7 +40,7 @@ class CzshareCom(SimpleHoster):
def checkTrafficLeft(self):
- # check if user logged in
+ #: check if user logged in
m = re.search(self.USER_CREDIT_PATTERN, self.html)
if m is None:
self.account.relogin(self.user)
@@ -49,7 +49,7 @@ class CzshareCom(SimpleHoster):
if m is None:
return False
- # check user credit
+ #: check user credit
try:
credit = parseFileSize(m.group(1).replace(' ', ''), m.group(2))
self.logInfo(_("Premium download for %i KiB of Credit") % (self.pyfile.size / 1024))
@@ -58,14 +58,14 @@ class CzshareCom(SimpleHoster):
self.logInfo(_("Not enough credit to download file: %s") % self.pyfile.name)
return False
except Exception, e:
- # let's continue and see what happens...
+ #: let's continue and see what happens...
self.logError(e)
return True
def handlePremium(self, pyfile):
- # parse download link
+ #: parse download link
try:
form = re.search(self.PREMIUM_FORM_PATTERN, self.html, re.S).group(1)
inputs = dict(re.findall(self.FORM_INPUT_PATTERN, form))
@@ -73,12 +73,12 @@ class CzshareCom(SimpleHoster):
self.logError(e)
self.resetAccount()
- # download the file, destination is determined by pyLoad
+ #: download the file, destination is determined by pyLoad
self.download("http://sdilej.cz/profi_down.php", post=inputs, disposition=True)
def handleFree(self, pyfile):
- # get free url
+ #: get free url
m = re.search(self.FREE_URL_PATTERN, self.html)
if m is None:
self.error(_("FREE_URL_PATTERN not found"))
@@ -87,7 +87,7 @@ class CzshareCom(SimpleHoster):
self.logDebug("PARSED_URL:" + parsed_url)
- # get download ticket and parse html
+ #: get download ticket and parse html
self.html = self.load(parsed_url)
if re.search(self.MULTIDL_PATTERN, self.html):
self.wait(5 * 60, 12, _("Download limit reached"))
@@ -101,7 +101,7 @@ class CzshareCom(SimpleHoster):
self.logError(e)
self.error(_("Form"))
- # get and decrypt captcha
+ #: get and decrypt captcha
captcha_url = 'http://sdilej.cz/captcha.php'
for _i in xrange(5):
inputs['captchastring2'] = self.decryptCaptcha(captcha_url)
@@ -122,7 +122,7 @@ class CzshareCom(SimpleHoster):
m = re.search("countdown_number = (\d+);", self.html)
self.setWait(int(m.group(1)) if m else 50)
- # download the file, destination is determined by pyLoad
+ #: download the file, destination is determined by pyLoad
self.logDebug("WAIT URL", self.req.lastEffectiveURL)
m = re.search("free_wait.php\?server=(.*?)&(.*)", self.req.lastEffectiveURL)
@@ -135,7 +135,7 @@ class CzshareCom(SimpleHoster):
def checkFile(self):
- # check download
+ #: check download
check = self.checkDownload({
"temp offline" : re.compile(r"^Soubor je do.*asn.* nedostupn.*$"),
"credit" : re.compile(r"^Nem.*te dostate.*n.* kredit.$"),
diff --git a/module/plugins/hoster/DlFreeFr.py b/module/plugins/hoster/DlFreeFr.py
index ff5ee7b92..e3be19782 100644
--- a/module/plugins/hoster/DlFreeFr.py
+++ b/module/plugins/hoster/DlFreeFr.py
@@ -76,11 +76,11 @@ class DlFreeFr(SimpleHoster):
if headers.get('code') == 200:
content_type = headers.get('content-type')
if content_type and content_type.startswith("text/html"):
- # Undirect acces to requested file, with a web page providing it (captcha)
+ #: Undirect acces to requested file, with a web page providing it (captcha)
self.html = self.load(valid_url)
self.handleFree(pyfile)
else:
- # Direct access to requested file for users using free.fr as Internet Service Provider.
+ #: Direct access to requested file for users using free.fr as Internet Service Provider.
self.link = valid_url
self.download(self.link, disposition=True)
diff --git a/module/plugins/hoster/FileSharkPl.py b/module/plugins/hoster/FileSharkPl.py
index 5be339896..d01a34bad 100644
--- a/module/plugins/hoster/FileSharkPl.py
+++ b/module/plugins/hoster/FileSharkPl.py
@@ -47,7 +47,7 @@ class FileSharkPl(SimpleHoster):
def checkErrors(self):
- # check if file is now available for download (-> file name can be found in html body)
+ #: check if file is now available for download (-> file name can be found in html body)
m = re.search(self.WAIT_PATTERN, self.html)
if m:
errmsg = self.info['error'] = _("Another download already run")
diff --git a/module/plugins/hoster/FilepostCom.py b/module/plugins/hoster/FilepostCom.py
index 1f3de6717..b2891a9e8 100644
--- a/module/plugins/hoster/FilepostCom.py
+++ b/module/plugins/hoster/FilepostCom.py
@@ -40,7 +40,7 @@ class FilepostCom(SimpleHoster):
self.error(_("Captcha key"))
captcha_key = m.group(1)
- # Get wait time
+ #: Get wait time
get_dict = {'SID': self.req.cj.getCookie('SID'), 'JsHttpRequest': str(int(time.time() * 10000)) + '-xml'}
post_dict = {'action': 'set_download', 'token': flp_token, 'code': self.info['pattern']['ID']}
wait_time = int(self.getJsonResponse(get_dict, post_dict, 'wait_time'))
@@ -51,7 +51,7 @@ class FilepostCom(SimpleHoster):
post_dict = {"token": flp_token, "code": self.info['pattern']['ID'], "file_pass": ''}
if 'var is_pass_exists = true;' in self.html:
- # Solve password
+ #: Solve password
password = self.getPassword()
if password:
@@ -68,7 +68,7 @@ class FilepostCom(SimpleHoster):
self.fail(_("No password found"))
else:
- # Solve recaptcha
+ #: Solve recaptcha
recaptcha = ReCaptcha(self)
for i in xrange(5):
@@ -93,15 +93,15 @@ class FilepostCom(SimpleHoster):
if not 'js' in res:
self.error(_("JSON %s 1") % field)
- # i changed js_answer to res['js'] since js_answer is nowhere set.
- # i don't know the JSON-HTTP specs in detail, but the previous author
- # accessed res['js']['error'] as well as js_answer['error'].
- # see the two lines commented out with "# ~?".
+ #: i changed js_answer to res['js'] since js_answer is nowhere set.
+ #: i don't know the JSON-HTTP specs in detail, but the previous author
+ #: accessed res['js']['error'] as well as js_answer['error'].
+ #: see the two lines commented out with "# ~?".
if 'error' in res['js']:
if res['js']['error'] == 'download_delay':
self.retry(wait_time=res['js']['params']['next_download'])
- # ~? self.retry(wait_time=js_answer['params']['next_download'])
+ #: ~? self.retry(wait_time=js_answer['params']['next_download'])
elif 'Wrong file password' in res['js']['error'] \
or 'You entered a wrong CAPTCHA code' in res['js']['error'] \
diff --git a/module/plugins/hoster/FilesMailRu.py b/module/plugins/hoster/FilesMailRu.py
index 66f715962..f93281702 100644
--- a/module/plugins/hoster/FilesMailRu.py
+++ b/module/plugins/hoster/FilesMailRu.py
@@ -24,8 +24,8 @@ def getInfo(urls):
except Exception:
pass
- # status 1=OFFLINE, 2=OK, 3=UNKNOWN
- # result.append((#name,#size,#status,#url))
+ #: status 1=OFFLINE, 2=OK, 3=UNKNOWN
+ #: result.append((#name,#size,#status,#url))
yield result
@@ -93,16 +93,16 @@ class FilesMailRu(Hoster):
def myPostProcess(self):
- # searches the file for HTMl-Code. Sometimes the Redirect
- # doesn't work (maybe a curl Problem) and you get only a small
- # HTML file and the Download is marked as "finished"
- # then the download will be restarted. It's only bad for these
- # who want download a HTML-File (it's one in a million ;-) )
+ #: searches the file for HTMl-Code. Sometimes the Redirect
+ #: doesn't work (maybe a curl Problem) and you get only a small
+ #: HTML file and the Download is marked as "finished"
+ #: then the download will be restarted. It's only bad for these
+ #: who want download a HTML-File (it's one in a million ;-) )
#
- # The maximum UploadSize allowed on files.mail.ru at the moment is 100MB
- # so i set it to check every download because sometimes there are downloads
- # that contain the HTML-Text and 60MB ZEROs after that in a xyzfile.part1.rar file
- # (Loading 100MB in to ram is not an option)
+ #: The maximum UploadSize allowed on files.mail.ru at the moment is 100MB
+ #: so i set it to check every download because sometimes there are downloads
+ #: that contain the HTML-Text and 60MB ZEROs after that in a xyzfile.part1.rar file
+ #: (Loading 100MB in to ram is not an option)
check = self.checkDownload({"html": "<meta name="}, read_size=50000)
if check == "html":
self.logInfo(_(
diff --git a/module/plugins/hoster/FileserveCom.py b/module/plugins/hoster/FileserveCom.py
index 3f4c7d6ed..71cdb1fae 100644
--- a/module/plugins/hoster/FileserveCom.py
+++ b/module/plugins/hoster/FileserveCom.py
@@ -108,13 +108,13 @@ class FileserveCom(Hoster):
else:
self.error(_("Unknown server response"))
- # show download link
+ #: show download link
res = self.load(self.url, post={"downloadLink": "show"})
self.logDebug("Show downloadLink response: %s" % res)
if "fail" in res:
self.error(_("Couldn't retrieve download url"))
- # this may either download our file or forward us to an error page
+ #: this may either download our file or forward us to an error page
self.download(self.url, post={"download": "normal"})
self.logDebug(self.req.http.lastEffectiveURL)
@@ -135,7 +135,7 @@ class FileserveCom(Hoster):
self.wait()
self.retry()
- self.thread.m.reconnecting.wait(3) # Ease issue with later downloads appearing to be in parallel
+ self.thread.m.reconnecting.wait(3) #: Ease issue with later downloads appearing to be in parallel
def doTimmer(self):
diff --git a/module/plugins/hoster/FlyFilesNet.py b/module/plugins/hoster/FlyFilesNet.py
index 689eb3c66..fb57baffd 100644
--- a/module/plugins/hoster/FlyFilesNet.py
+++ b/module/plugins/hoster/FlyFilesNet.py
@@ -31,7 +31,7 @@ class FlyFilesNet(SimpleHoster):
url = "http://flyfiles.net"
- # get download URL
+ #: get download URL
parsed_url = getURL(url, post={"getDownLink": session})
self.logDebug("Parsed URL: %s" % parsed_url)
diff --git a/module/plugins/hoster/FreakshareCom.py b/module/plugins/hoster/FreakshareCom.py
index 5abded2ac..f8e72e62f 100644
--- a/module/plugins/hoster/FreakshareCom.py
+++ b/module/plugins/hoster/FreakshareCom.py
@@ -87,7 +87,7 @@ class FreakshareCom(Hoster):
def download_html(self):
- self.load("http://freakshare.com/index.php", {"language": "EN"}) # Set english language in server session
+ self.load("http://freakshare.com/index.php", {"language": "EN"}) #: Set english language in server session
self.html = self.load(self.pyfile.url)
@@ -98,7 +98,7 @@ class FreakshareCom(Hoster):
if not self.html:
self.download_html()
if not self.wantReconnect:
- self.req_opts = self.get_download_options() # get the Post options for the Request
+ self.req_opts = self.get_download_options() #: get the Post options for the Request
#file_url = self.pyfile.url
#return file_url
else:
@@ -165,11 +165,11 @@ class FreakshareCom(Hoster):
def get_download_options(self):
re_envelope = re.search(r".*?value=\"Free\sDownload\".*?\n*?(.*?<.*?>\n*)*?\n*\s*?</form>",
- self.html).group(0) # get the whole request
+ self.html).group(0) #: get the whole request
to_sort = re.findall(r"<input\stype=\"hidden\"\svalue=\"(.*?)\"\sname=\"(.*?)\"\s\/>", re_envelope)
request_options = dict((n, v) for (v, n) in to_sort)
- herewego = self.load(self.pyfile.url, None, request_options) # the actual download-Page
+ herewego = self.load(self.pyfile.url, None, request_options) #: the actual download-Page
to_sort = re.findall(r"<input\stype=\".*?\"\svalue=\"(\S*?)\".*?name=\"(\S*?)\"\s.*?\/>", herewego)
request_options = dict((n, v) for (v, n) in to_sort)
diff --git a/module/plugins/hoster/FreeWayMe.py b/module/plugins/hoster/FreeWayMe.py
index bb6d9f29d..215dd8f5a 100644
--- a/module/plugins/hoster/FreeWayMe.py
+++ b/module/plugins/hoster/FreeWayMe.py
@@ -26,7 +26,7 @@ class FreeWayMe(MultiHoster):
user, data = self.account.selectAccount()
for _i in xrange(5):
- # try it five times
+ #: try it five times
header = self.load("http://www.free-way.bz/load.php", #@TODO: Revert to `https` in 0.4.10
get={'multiget': 7,
'url' : pyfile.url,
@@ -38,14 +38,14 @@ class FreeWayMe(MultiHoster):
if 'location' in header:
headers = self.load(header['location'], just_header=True)
if headers['code'] == 500:
- # error on 2nd stage
+ #: error on 2nd stage
self.logError(_("Error [stage2]"))
else:
- # seems to work..
+ #: seems to work..
self.download(header['location'])
break
else:
- # error page first stage
+ #: error page first stage
self.logError(_("Error [stage1]"))
#@TODO: handle errors
diff --git a/module/plugins/hoster/Ftp.py b/module/plugins/hoster/Ftp.py
index 2e10de971..f4d6380ee 100644
--- a/module/plugins/hoster/Ftp.py
+++ b/module/plugins/hoster/Ftp.py
@@ -68,7 +68,7 @@ class Ftp(Hoster):
pyfile.url = pyfile.url.rstrip('/')
pkgname = "/".join([pyfile.package().name, urlparse.urlparse(pyfile.url).path.rpartition('/')[2]])
pyfile.url += '/'
- self.req.http.c.setopt(48, 1) # CURLOPT_DIRLISTONLY
+ self.req.http.c.setopt(48, 1) #: CURLOPT_DIRLISTONLY
res = self.load(pyfile.url, decode=False)
links = [pyfile.url + x for x in res.splitlines()]
self.logDebug("LINKS", links)
diff --git a/module/plugins/hoster/Keep2ShareCc.py b/module/plugins/hoster/Keep2ShareCc.py
index 19a8f2ba6..d90466904 100644
--- a/module/plugins/hoster/Keep2ShareCc.py
+++ b/module/plugins/hoster/Keep2ShareCc.py
@@ -55,7 +55,7 @@ class Keep2ShareCc(SimpleHoster):
if m:
self.logDebug("Hoster told us to wait for %s" % m.group(1))
- # string to time convert courtesy of https://stackoverflow.com/questions/10663720
+ #: string to time convert courtesy of https://stackoverflow.com/questions/10663720
ftr = [3600, 60, 1]
wait_time = sum(a * b for a, b in zip(ftr, map(int, m.group(1).split(':'))))
@@ -69,8 +69,8 @@ class Keep2ShareCc(SimpleHoster):
self.fid = re.search(r'<input type="hidden" name="slow_id" value="(.+?)">', self.html).group(1)
self.html = self.load(pyfile.url, post={'yt0': '', 'slow_id': self.fid})
- # self.logDebug(self.fid)
- # self.logDebug(pyfile.url)
+ #: self.logDebug(self.fid)
+ #: self.logDebug(pyfile.url)
self.checkErrors()
diff --git a/module/plugins/hoster/KingfilesNet.py b/module/plugins/hoster/KingfilesNet.py
index a25c39b21..f14cbd8b4 100644
--- a/module/plugins/hoster/KingfilesNet.py
+++ b/module/plugins/hoster/KingfilesNet.py
@@ -36,7 +36,7 @@ class KingfilesNet(SimpleHoster):
def handleFree(self, pyfile):
- # Click the free user button
+ #: Click the free user button
post_data = {'op' : "download1",
'usr_login' : "",
'id' : self.info['pattern']['ID'],
@@ -49,7 +49,7 @@ class KingfilesNet(SimpleHoster):
solvemedia = SolveMedia(self)
response, challenge = solvemedia.challenge()
- # Make the downloadlink appear and load the file
+ #: Make the downloadlink appear and load the file
m = re.search(self.RAND_ID_PATTERN, self.html)
if m is None:
self.error(_("Random key not found"))
diff --git a/module/plugins/hoster/LoadTo.py b/module/plugins/hoster/LoadTo.py
index 7a9be86e1..e974b9f3d 100644
--- a/module/plugins/hoster/LoadTo.py
+++ b/module/plugins/hoster/LoadTo.py
@@ -40,19 +40,19 @@ class LoadTo(SimpleHoster):
def handleFree(self, pyfile):
- # Search for Download URL
+ #: Search for Download URL
m = re.search(self.LINK_FREE_PATTERN, self.html)
if m is None:
self.error(_("LINK_FREE_PATTERN not found"))
self.link = m.group(1)
- # Set Timer - may be obsolete
+ #: Set Timer - may be obsolete
m = re.search(self.WAIT_PATTERN, self.html)
if m:
self.wait(m.group(1))
- # Load.to is using solvemedia captchas since ~july 2014:
+ #: Load.to is using solvemedia captchas since ~july 2014:
solvemedia = SolveMedia(self)
captcha_key = solvemedia.detect_key()
diff --git a/module/plugins/hoster/LuckyShareNet.py b/module/plugins/hoster/LuckyShareNet.py
index 293dab8f9..c08203346 100644
--- a/module/plugins/hoster/LuckyShareNet.py
+++ b/module/plugins/hoster/LuckyShareNet.py
@@ -40,8 +40,8 @@ class LuckyShareNet(SimpleHoster):
return json_loads(rep)
- # TODO: There should be a filesize limit for free downloads
- # TODO: Some files could not be downloaded in free mode
+ #@TODO: There should be a filesize limit for free downloads
+ # Some files could not be downloaded in free mode
def handleFree(self, pyfile):
rep = self.load(r"http://luckyshare.net/download/request/type/time/file/" + self.info['pattern']['ID'])
diff --git a/module/plugins/hoster/MegaCoNz.py b/module/plugins/hoster/MegaCoNz.py
index 20b879aba..2e6dcfda6 100644
--- a/module/plugins/hoster/MegaCoNz.py
+++ b/module/plugins/hoster/MegaCoNz.py
@@ -84,7 +84,7 @@ class MegaCoNz(Hoster):
"""
Dispatch a call to the api, see https://mega.co.nz/#developers
"""
- # generate a session id, no idea where to obtain elsewhere
+ #: generate a session id, no idea where to obtain elsewhere
uid = random.randint(10 << 9, 10 ** 10)
res = self.load(self.API_URL, get={'id': uid}, post=json_dumps([kwargs]))
@@ -101,7 +101,7 @@ class MegaCoNz(Hoster):
if not attr.startswith("MEGA"):
self.fail(_("Decryption failed"))
- # Data is padded, 0-bytes must be stripped
+ #: Data is padded, 0-bytes must be stripped
return json_loads(re.search(r'{.+?}', attr).group(0))
@@ -109,10 +109,10 @@ class MegaCoNz(Hoster):
"""
Decrypts the file at lastDownload`
"""
- # upper 64 bit of counter start
+ #: upper 64 bit of counter start
n = self.b64_decode(key)[16:24]
- # convert counter to long and shift bytes
+ #: convert counter to long and shift bytes
k, iv, meta_mac = self.getCipherKey(key)
ctr = Counter.new(128, initial_value=long(n.encode("hex"), 16) << 64)
cipher = AES.new(k, AES.MODE_CTR, counter=ctr)
@@ -130,8 +130,8 @@ class MegaCoNz(Hoster):
except IOError, e:
self.fail(e)
- chunk_size = 2 ** 15 # buffer size, 32k
- # file_mac = [0, 0, 0, 0] # calculate CBC-MAC for checksum
+ chunk_size = 2 ** 15 #: buffer size, 32k
+ #: file_mac = [0, 0, 0, 0] # calculate CBC-MAC for checksum
chunks = os.path.getsize(file_crypted) / chunk_size + 1
for i in xrange(chunks):
@@ -144,27 +144,27 @@ class MegaCoNz(Hoster):
self.pyfile.setProgress(int((100.0 / chunks) * i))
- # chunk_mac = [iv[0], iv[1], iv[0], iv[1]]
- # for i in xrange(0, chunk_size, 16):
- # block = chunk[i:i+16]
- # if len(block) % 16:
- # block += '=' * (16 - (len(block) % 16))
- # block = array.array("I", block)
+ #: chunk_mac = [iv[0], iv[1], iv[0], iv[1]]
+ #: for i in xrange(0, chunk_size, 16):
+ #: block = chunk[i:i+16]
+ #: if len(block) % 16:
+ #: block += '=' * (16 - (len(block) % 16))
+ #: block = array.array("I", block)
- # chunk_mac = [chunk_mac[0] ^ a_[0], chunk_mac[1] ^ block[1], chunk_mac[2] ^ block[2], chunk_mac[3] ^ block[3]]
- # chunk_mac = aes_cbc_encrypt_a32(chunk_mac, k)
+ #: chunk_mac = [chunk_mac[0] ^ a_[0], chunk_mac[1] ^ block[1], chunk_mac[2] ^ block[2], chunk_mac[3] ^ block[3]]
+ #: chunk_mac = aes_cbc_encrypt_a32(chunk_mac, k)
- # file_mac = [file_mac[0] ^ chunk_mac[0], file_mac[1] ^ chunk_mac[1], file_mac[2] ^ chunk_mac[2], file_mac[3] ^ chunk_mac[3]]
- # file_mac = aes_cbc_encrypt_a32(file_mac, k)
+ #: file_mac = [file_mac[0] ^ chunk_mac[0], file_mac[1] ^ chunk_mac[1], file_mac[2] ^ chunk_mac[2], file_mac[3] ^ chunk_mac[3]]
+ #: file_mac = aes_cbc_encrypt_a32(file_mac, k)
self.pyfile.setProgress(100)
f.close()
df.close()
- # if file_mac[0] ^ file_mac[1], file_mac[2] ^ file_mac[3] != meta_mac:
- # os.remove(file_decrypted)
- # self.fail(_("Checksum mismatch"))
+ #: if file_mac[0] ^ file_mac[1], file_mac[2] ^ file_mac[3] != meta_mac:
+ #: os.remove(file_decrypted)
+ #: self.fail(_("Checksum mismatch"))
os.remove(file_crypted)
self.lastDownload = fs_decode(file_decrypted)
@@ -194,8 +194,8 @@ class MegaCoNz(Hoster):
self.logDebug("ID: %s" % id, "Key: %s" % key, "Type: %s" % ("public" if public else "node"))
- # g is for requesting a download url
- # this is similar to the calls in the mega js app, documentation is very bad
+ #: g is for requesting a download url
+ #: this is similar to the calls in the mega js app, documentation is very bad
if public:
mega = self.api_response(a="g", g=1, p=id, ssl=1)[0]
else:
@@ -211,11 +211,11 @@ class MegaCoNz(Hoster):
pyfile.name = attr['n'] + self.FILE_SUFFIX
pyfile.size = mega['s']
- # self.req.http.c.setopt(pycurl.SSL_CIPHER_LIST, "RC4-MD5:DEFAULT")
+ #: self.req.http.c.setopt(pycurl.SSL_CIPHER_LIST, "RC4-MD5:DEFAULT")
self.download(mega['g'])
self.decryptFile(key)
- # Everything is finished and final name can be set
+ #: Everything is finished and final name can be set
pyfile.name = attr['n']
diff --git a/module/plugins/hoster/MegacrypterCom.py b/module/plugins/hoster/MegacrypterCom.py
index aea564ded..27c3c7253 100644
--- a/module/plugins/hoster/MegacrypterCom.py
+++ b/module/plugins/hoster/MegacrypterCom.py
@@ -34,18 +34,18 @@ class MegacrypterCom(MegaCoNz):
def process(self, pyfile):
- # match is guaranteed because plugin was chosen to handle url
+ #: match is guaranteed because plugin was chosen to handle url
node = re.match(self.__pattern__, pyfile.url).group(0)
- # get Mega.co.nz link info
+ #: get Mega.co.nz link info
info = self.api_response(link=node, m="info")
- # get crypted file URL
+ #: get crypted file URL
dl = self.api_response(link=node, m="dl")
- # TODO: map error codes, implement password protection
- # if info['pass'] is True:
- # crypted_file_key, md5_file_key = info['key'].split("#")
+ #@TODO: map error codes, implement password protection
+ # if info['pass'] is True:
+ # crypted_file_key, md5_file_key = info['key'].split("#")
key = self.b64_decode(info['key'])
@@ -55,5 +55,5 @@ class MegacrypterCom(MegaCoNz):
self.decryptFile(key)
- # Everything is finished and final name can be set
+ #: Everything is finished and final name can be set
pyfile.name = info['name']
diff --git a/module/plugins/hoster/MegasharesCom.py b/module/plugins/hoster/MegasharesCom.py
index ed2363fe3..0c74e380d 100644
--- a/module/plugins/hoster/MegasharesCom.py
+++ b/module/plugins/hoster/MegasharesCom.py
@@ -83,7 +83,7 @@ class MegasharesCom(SimpleHoster):
self.logDebug("Waiting %d seconds for a new passport" % renew)
self.retry(wait_time=renew, reason=_("Passport renewal"))
- # Check traffic left on passport
+ #: Check traffic left on passport
m = re.search(self.PASSPORT_LEFT_PATTERN, self.html, re.M | re.S)
if m is None:
self.fail(_("Passport not found"))
@@ -99,7 +99,7 @@ class MegasharesCom(SimpleHoster):
def handleDownload(self, premium=False):
- # Find download link;
+ #: Find download link
m = re.search(self.LINK_PATTERN % (1 if premium else 2), self.html)
msg = _('%s download URL' % ('Premium' if premium else 'Free'))
if m is None:
diff --git a/module/plugins/hoster/NitroflareCom.py b/module/plugins/hoster/NitroflareCom.py
index a0734d9b1..efd54dd62 100644
--- a/module/plugins/hoster/NitroflareCom.py
+++ b/module/plugins/hoster/NitroflareCom.py
@@ -32,7 +32,7 @@ class NitroflareCom(SimpleHoster):
def handleFree(self, pyfile):
- # used here to load the cookies which will be required later
+ #: used here to load the cookies which will be required later
self.load(pyfile.url, post={'goToFreePage': ""})
self.load("http://nitroflare.com/ajax/setCookie.php", post={'fileId': self.info['pattern']['ID']})
diff --git a/module/plugins/hoster/NoPremiumPl.py b/module/plugins/hoster/NoPremiumPl.py
index 23343cd3f..ec3699a08 100644
--- a/module/plugins/hoster/NoPremiumPl.py
+++ b/module/plugins/hoster/NoPremiumPl.py
@@ -78,10 +78,10 @@ class NoPremiumPl(MultiHoster):
if "errno" in parsed.keys():
if parsed["errno"] in self.ERROR_CODES:
- # error code in known
+ #: error code in known
self.fail(self.ERROR_CODES[parsed["errno"]] % self.__name__)
else:
- # error code isn't yet added to plugin
+ #: error code isn't yet added to plugin
self.fail(
parsed["errstring"]
or _("Unknown error (code: %s)") % parsed["errno"]
diff --git a/module/plugins/hoster/NosuploadCom.py b/module/plugins/hoster/NosuploadCom.py
index 0b4af511c..4f3f34ddb 100644
--- a/module/plugins/hoster/NosuploadCom.py
+++ b/module/plugins/hoster/NosuploadCom.py
@@ -24,18 +24,18 @@ class NosuploadCom(XFSHoster):
def getDownloadLink(self):
- # stage1: press the "Free Download" button
+ #: stage1: press the "Free Download" button
data = self.getPostParameters()
self.html = self.load(self.pyfile.url, post=data)
- # stage2: wait some time and press the "Download File" button
+ #: stage2: wait some time and press the "Download File" button
data = self.getPostParameters()
wait_time = re.search(self.WAIT_PATTERN, self.html, re.M | re.S).group(1)
self.logDebug("Hoster told us to wait %s seconds" % wait_time)
self.wait(wait_time)
self.html = self.load(self.pyfile.url, post=data)
- # stage3: get the download link
+ #: stage3: get the download link
return re.search(self.LINK_PATTERN, self.html, re.S).group(1)
diff --git a/module/plugins/hoster/OboomCom.py b/module/plugins/hoster/OboomCom.py
index e2a9c114a..4f845394a 100644
--- a/module/plugins/hoster/OboomCom.py
+++ b/module/plugins/hoster/OboomCom.py
@@ -100,7 +100,7 @@ class OboomCom(Hoster):
self.retry(5, 15 * 60, _("Service unavailable"))
elif result[0] == 403:
- if result[1] == -1: # another download is running
+ if result[1] == -1: #: another download is running
self.setWait(15 * 60)
else:
self.setWait(result[1], True)
diff --git a/module/plugins/hoster/PornhostCom.py b/module/plugins/hoster/PornhostCom.py
index 55e04e5f6..708abf40a 100644
--- a/module/plugins/hoster/PornhostCom.py
+++ b/module/plugins/hoster/PornhostCom.py
@@ -26,7 +26,7 @@ class PornhostCom(Hoster):
self.download(self.get_file_url())
- # Old interface
+ #: Old interface
def download_html(self):
url = self.pyfile.url
self.html = self.load(url)
@@ -46,7 +46,7 @@ class PornhostCom(Hoster):
url = re.search(r'width: 894px; height: 675px">.*?<img src="(.*?)"', self.html)
if url is None:
url = re.search(r'"http://file\d+\.pornhost\.com/\d+/.*?"',
- self.html) # TODO: fix this one since it doesn't match
+ self.html) #@TODO: fix this one since it doesn't match
return url.group(1).strip()
diff --git a/module/plugins/hoster/PornhubCom.py b/module/plugins/hoster/PornhubCom.py
index 857bb404c..92119df56 100644
--- a/module/plugins/hoster/PornhubCom.py
+++ b/module/plugins/hoster/PornhubCom.py
@@ -40,7 +40,7 @@ class PornhubCom(Hoster):
url = "http://www.pornhub.com//gateway.php"
video_id = self.pyfile.url.split('=')[-1]
- # thanks to jD team for this one v
+ #: thanks to jD team for this one v
post_data = "\x00\x03\x00\x00\x00\x01\x00\x0c\x70\x6c\x61\x79\x65\x72\x43\x6f\x6e\x66\x69\x67\x00\x02\x2f\x31\x00\x00\x00\x44\x0a\x00\x00\x00\x03\x02\x00"
post_data += chr(len(video_id))
post_data += video_id
diff --git a/module/plugins/hoster/PremiumTo.py b/module/plugins/hoster/PremiumTo.py
index 2007eefa7..c810a1f5a 100644
--- a/module/plugins/hoster/PremiumTo.py
+++ b/module/plugins/hoster/PremiumTo.py
@@ -41,7 +41,7 @@ class PremiumTo(MultiHoster):
err = ''
if self.req.http.code == '420':
- # Custom error code send - fail
+ #: Custom error code send - fail
file = fs_encode(self.lastDownload)
with open(file, "rb") as f:
err = f.read(256).strip()
diff --git a/module/plugins/hoster/PremiumizeMe.py b/module/plugins/hoster/PremiumizeMe.py
index e1f982d78..8e7d74012 100644
--- a/module/plugins/hoster/PremiumizeMe.py
+++ b/module/plugins/hoster/PremiumizeMe.py
@@ -18,27 +18,27 @@ class PremiumizeMe(MultiHoster):
def handlePremium(self, pyfile):
- # In some cases hostsers do not supply us with a filename at download, so we
- # are going to set a fall back filename (e.g. for freakshare or xfileshare)
- pyfile.name = pyfile.name.split('/').pop() # Remove everthing before last slash
+ #: In some cases hostsers do not supply us with a filename at download, so we
+ #: are going to set a fall back filename (e.g. for freakshare or xfileshare)
+ pyfile.name = pyfile.name.split('/').pop() #: Remove everthing before last slash
- # Correction for automatic assigned filename: Removing html at end if needed
+ #: Correction for automatic assigned filename: Removing html at end if needed
suffix_to_remove = ["html", "htm", "php", "php3", "asp", "shtm", "shtml", "cfml", "cfm"]
temp = pyfile.name.split('.')
if temp.pop() in suffix_to_remove:
pyfile.name = ".".join(temp)
- # Get account data
+ #: Get account data
user, data = self.account.selectAccount()
- # Get rewritten link using the premiumize.me api v1 (see https://secure.premiumize.me/?show=api)
+ #: Get rewritten link using the premiumize.me api v1 (see https://secure.premiumize.me/?show=api)
data = json_loads(self.load("http://api.premiumize.me/pm-api/v1.php", #@TODO: Revert to `https` in 0.4.10
get={'method' : "directdownloadlink",
'params[login]': user,
'params[pass]' : data['password'],
'params[link]' : pyfile.url}))
- # Check status and decide what to do
+ #: Check status and decide what to do
status = data['status']
if status == 200:
diff --git a/module/plugins/hoster/PromptfileCom.py b/module/plugins/hoster/PromptfileCom.py
index 4a1b07f05..c6878cbb0 100644
--- a/module/plugins/hoster/PromptfileCom.py
+++ b/module/plugins/hoster/PromptfileCom.py
@@ -34,7 +34,7 @@ class PromptfileCom(SimpleHoster):
chash = m.group(1)
self.logDebug("Read chash %s" % chash)
- # continue to stage2
+ #: continue to stage2
self.html = self.load(pyfile.url, post={'chash': chash})
# STAGE 2: get the direct link
diff --git a/module/plugins/hoster/QuickshareCz.py b/module/plugins/hoster/QuickshareCz.py
index 8cfb72c9a..26bb1e2df 100644
--- a/module/plugins/hoster/QuickshareCz.py
+++ b/module/plugins/hoster/QuickshareCz.py
@@ -28,12 +28,12 @@ class QuickshareCz(SimpleHoster):
self.html = self.load(pyfile.url)
self.getFileInfo()
- # parse js variables
+ #: parse js variables
self.jsvars = dict((x, y.strip("'")) for x, y in re.findall(r"var (\w+) = ([\d.]+|'.+?')", self.html))
self.logDebug(self.jsvars)
pyfile.name = self.jsvars['ID3']
- # determine download type - free or premium
+ #: determine download type - free or premium
if self.premium:
if 'UU_prihlasen' in self.jsvars:
if self.jsvars['UU_prihlasen'] == '0':
@@ -54,7 +54,7 @@ class QuickshareCz(SimpleHoster):
def handleFree(self, pyfile):
- # get download url
+ #: get download url
download_url = '%s/download.php' % self.jsvars['server']
data = dict((x, self.jsvars[x]) for x in self.jsvars if x in ("ID1", "ID2", "ID3", "ID4"))
self.logDebug("FREE URL1:" + download_url, data)
@@ -71,7 +71,7 @@ class QuickshareCz(SimpleHoster):
self.link = m.group(1).rstrip() #@TODO: Remove .rstrip() in 0.4.10
self.logDebug("FREE URL2:" + self.link)
- # check errors
+ #: check errors
m = re.search(r'/chyba/(\d+)', self.link)
if m:
if m.group(1) == '1':
diff --git a/module/plugins/hoster/RPNetBiz.py b/module/plugins/hoster/RPNetBiz.py
index d783e1b8f..47f18afff 100644
--- a/module/plugins/hoster/RPNetBiz.py
+++ b/module/plugins/hoster/RPNetBiz.py
@@ -26,7 +26,7 @@ class RPNetBiz(MultiHoster):
def handlePremium(self, pyfile):
user, data = self.account.selectAccount()
- # Get the download link
+ #: Get the download link
res = self.load("https://premium.rpnet.biz/client_api.php",
get={"username": user,
"password": data['password'],
@@ -34,15 +34,15 @@ class RPNetBiz(MultiHoster):
"links" : pyfile.url})
self.logDebug("JSON data: %s" % res)
- link_status = json_loads(res)['links'][0] # get the first link... since we only queried one
+ link_status = json_loads(res)['links'][0] #: get the first link... since we only queried one
- # Check if we only have an id as a HDD link
+ #: Check if we only have an id as a HDD link
if 'id' in link_status:
self.logDebug("Need to wait at least 30 seconds before requery")
- self.setWait(30) # wait for 30 seconds
+ self.setWait(30) #: wait for 30 seconds
self.wait()
- # Lets query the server again asking for the status on the link,
- # we need to keep doing this until we reach 100
+ #: Lets query the server again asking for the status on the link,
+ #: we need to keep doing this until we reach 100
max_tries = 30
my_try = 0
while (my_try <= max_tries):
@@ -66,7 +66,7 @@ class RPNetBiz(MultiHoster):
self.wait()
my_try += 1
- if my_try > max_tries: # We went over the limit!
+ if my_try > max_tries: #: We went over the limit!
self.fail(_("Waited for about 15 minutes for download to finish but failed"))
if 'generated' in link_status:
diff --git a/module/plugins/hoster/RapideoPl.py b/module/plugins/hoster/RapideoPl.py
index daefcd5a8..6304bd38a 100644
--- a/module/plugins/hoster/RapideoPl.py
+++ b/module/plugins/hoster/RapideoPl.py
@@ -78,10 +78,10 @@ class RapideoPl(MultiHoster):
if "errno" in parsed.keys():
if parsed["errno"] in self.ERROR_CODES:
- # error code in known
+ #: error code in known
self.fail(self.ERROR_CODES[parsed["errno"]] % self.__name__)
else:
- # error code isn't yet added to plugin
+ #: error code isn't yet added to plugin
self.fail(
parsed["errstring"]
or _("Unknown error (code: %s)") % parsed["errno"]
diff --git a/module/plugins/hoster/ShareplaceCom.py b/module/plugins/hoster/ShareplaceCom.py
index 47ad05a8c..815f54c79 100644
--- a/module/plugins/hoster/ShareplaceCom.py
+++ b/module/plugins/hoster/ShareplaceCom.py
@@ -39,7 +39,7 @@ class ShareplaceCom(Hoster):
if not self.html:
self.download_html()
- #var zzipitime = 15;
+ # var zzipitime = 15
m = re.search(r'var zzipitime = (\d+);', self.html)
if m:
sec = int(m.group(1))
diff --git a/module/plugins/hoster/SmoozedCom.py b/module/plugins/hoster/SmoozedCom.py
index bf9f387b4..af6c8b68e 100644
--- a/module/plugins/hoster/SmoozedCom.py
+++ b/module/plugins/hoster/SmoozedCom.py
@@ -22,18 +22,18 @@ class SmoozedCom(MultiHoster):
def handleFree(self, pyfile):
- # In some cases hostsers do not supply us with a filename at download, so we
- # are going to set a fall back filename (e.g. for freakshare or xfileshare)
- pyfile.name = pyfile.name.split('/').pop() # Remove everthing before last slash
+ #: In some cases hostsers do not supply us with a filename at download, so we
+ #: are going to set a fall back filename (e.g. for freakshare or xfileshare)
+ pyfile.name = pyfile.name.split('/').pop() #: Remove everthing before last slash
- # Correction for automatic assigned filename: Removing html at end if needed
+ #: Correction for automatic assigned filename: Removing html at end if needed
suffix_to_remove = ["html", "htm", "php", "php3", "asp", "shtm", "shtml", "cfml", "cfm"]
temp = pyfile.name.split('.')
if temp.pop() in suffix_to_remove:
pyfile.name = ".".join(temp)
- # Check the link
+ #: Check the link
get_data = {'session_key': self.account.getAccountInfo(self.user)['session'],
'url' : pyfile.url}
@@ -51,7 +51,7 @@ class SmoozedCom(MultiHoster):
pyfile.name = data["data"]["name"]
pyfile.size = int(data["data"]["size"])
- # Start the download
+ #: Start the download
header = self.load("http://www2.smoozed.com/api/download", get=get_data, just_header=True)
if not "location" in header:
diff --git a/module/plugins/hoster/SoundcloudCom.py b/module/plugins/hoster/SoundcloudCom.py
index 8dff4f42a..2b041bb94 100644
--- a/module/plugins/hoster/SoundcloudCom.py
+++ b/module/plugins/hoster/SoundcloudCom.py
@@ -37,7 +37,7 @@ class SoundcloudCom(SimpleHoster):
except Exception:
client_id = "b45b1aa10f1ac2941910a7f0d10f8e28"
- # url to retrieve the actual song url
+ #: url to retrieve the actual song url
streams = json_loads(self.load("https://api.soundcloud.com/tracks/%s/streams" % song_id,
get={'client_id': client_id}))
diff --git a/module/plugins/hoster/StreamCz.py b/module/plugins/hoster/StreamCz.py
index a2fe32c5c..24b725722 100644
--- a/module/plugins/hoster/StreamCz.py
+++ b/module/plugins/hoster/StreamCz.py
@@ -13,7 +13,7 @@ def getInfo(urls):
html = getURL(url)
if re.search(StreamCz.OFFLINE_PATTERN, html):
- # File offline
+ #: File offline
result.append((url, 0, 1, url))
else:
result.append((url, 0, 2, url))
diff --git a/module/plugins/hoster/TurbobitNet.py b/module/plugins/hoster/TurbobitNet.py
index b70f9e72b..efff6521a 100644
--- a/module/plugins/hoster/TurbobitNet.py
+++ b/module/plugins/hoster/TurbobitNet.py
@@ -100,10 +100,10 @@ class TurbobitNet(SimpleHoster):
if not rtUpdate:
if self.getStorage("version") != self.__version__ \
or int(self.getStorage("timestamp", 0)) + 86400000 < timestamp():
- # that's right, we are even using jdownloader updates
+ #: that's right, we are even using jdownloader updates
rtUpdate = getURL("http://update0.jdownloader.org/pluginstuff/tbupdate.js")
rtUpdate = self.decrypt(rtUpdate.splitlines()[1])
- # but we still need to fix the syntax to work with other engines than rhino
+ #: but we still need to fix the syntax to work with other engines than rhino
rtUpdate = re.sub(r'for each\(var (\w+) in(\[[^\]]+\])\)\{',
r'zza=\2;for(var zzi=0;zzi<zza.length;zzi++){\1=zza[zzi];', rtUpdate)
rtUpdate = re.sub(r"for\((\w+)=", r"for(var \1=", rtUpdate)
@@ -145,7 +145,7 @@ class TurbobitNet(SimpleHoster):
self.logError(e)
else:
if self.retries >= 2:
- # retry with updated js
+ #: retry with updated js
self.delStorage("rtUpdate")
else:
self.retry()
diff --git a/module/plugins/hoster/UlozTo.py b/module/plugins/hoster/UlozTo.py
index 2edc929ea..6a2836b50 100644
--- a/module/plugins/hoster/UlozTo.py
+++ b/module/plugins/hoster/UlozTo.py
@@ -8,7 +8,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
def convertDecimalPrefix(m):
- # decimal prefixes used in filesize and traffic
+ #: decimal prefixes used in filesize and traffic
return ("%%.%df" % {'k': 3, 'M': 6, 'G': 9}[m.group(2)] % float(m.group(1))).replace('.', '')
@@ -54,9 +54,9 @@ class UlozTo(SimpleHoster):
self.error(_("Free download form not found"))
self.logDebug("inputs.keys = " + str(inputs.keys()))
- # get and decrypt captcha
+ #: get and decrypt captcha
if all(key in inputs for key in ("captcha_value", "captcha_id", "captcha_key")):
- # Old version - last seen 9.12.2013
+ #: Old version - last seen 9.12.2013
self.logDebug('Using "old" version')
captcha_value = self.decryptCaptcha("http://img.uloz.to/captcha/%s.png" % inputs['captcha_id'])
@@ -65,7 +65,7 @@ class UlozTo(SimpleHoster):
inputs.update({'captcha_id': inputs['captcha_id'], 'captcha_key': inputs['captcha_key'], 'captcha_value': captcha_value})
elif all(key in inputs for key in ("captcha_value", "timestamp", "salt", "hash")):
- # New version - better to get new parameters (like captcha reload) because of image url - since 6.12.2013
+ #: New version - better to get new parameters (like captcha reload) because of image url - since 6.12.2013
self.logDebug('Using "new" version')
xapca = self.load("http://www.ulozto.net/reloadXapca.php", get={'rnd': str(int(time.time()))})
@@ -124,7 +124,7 @@ class UlozTo(SimpleHoster):
"wrong_captcha": re.compile(r'<ul class="error">\s*<li>Error rewriting the text.</li>'),
"offline" : re.compile(self.OFFLINE_PATTERN),
"passwd" : self.PASSWD_PATTERN,
- "server_error" : 'src="http://img.ulozto.cz/error403/vykricnik.jpg"', # paralell dl, server overload etc.
+ "server_error" : 'src="http://img.ulozto.cz/error403/vykricnik.jpg"', #: paralell dl, server overload etc.
"not_found" : "<title>Ulož.to</title>"
})
diff --git a/module/plugins/hoster/UploadableCh.py b/module/plugins/hoster/UploadableCh.py
index b33c81ae7..b2323644f 100644
--- a/module/plugins/hoster/UploadableCh.py
+++ b/module/plugins/hoster/UploadableCh.py
@@ -33,13 +33,13 @@ class UploadableCh(SimpleHoster):
def handleFree(self, pyfile):
- # Click the "free user" button and wait
+ #: Click the "free user" button and wait
a = self.load(pyfile.url, post={'downloadLink': "wait"})
self.logDebug(a)
self.wait(30)
- # Make the recaptcha appear and show it the pyload interface
+ #: Make the recaptcha appear and show it the pyload interface
b = self.load(pyfile.url, post={'checkDownload': "check"})
self.logDebug(b) #: Expected output: {"success":"showCaptcha"}
@@ -47,7 +47,7 @@ class UploadableCh(SimpleHoster):
response, challenge = recaptcha.challenge(self.RECAPTCHA_KEY)
- # Submit the captcha solution
+ #: Submit the captcha solution
self.load("http://www.uploadable.ch/checkReCaptcha.php",
post={'recaptcha_challenge_field' : challenge,
'recaptcha_response_field' : response,
@@ -55,12 +55,12 @@ class UploadableCh(SimpleHoster):
self.wait(3)
- # Get ready for downloading
+ #: Get ready for downloading
self.load(pyfile.url, post={'downloadLink': "show"})
self.wait(3)
- # Download the file
+ #: Download the file
self.download(pyfile.url, post={'download': "normal"}, disposition=True)
diff --git a/module/plugins/hoster/UploadedTo.py b/module/plugins/hoster/UploadedTo.py
index 46ed863d9..b88ac5f0b 100644
--- a/module/plugins/hoster/UploadedTo.py
+++ b/module/plugins/hoster/UploadedTo.py
@@ -62,7 +62,7 @@ class UploadedTo(SimpleHoster):
def setup(self):
self.multiDL = self.resumeDownload = self.premium
- self.chunkLimit = 1 # critical problems with more chunks
+ self.chunkLimit = 1 #: critical problems with more chunks
def handleFree(self, pyfile):
diff --git a/module/plugins/hoster/UpstoreNet.py b/module/plugins/hoster/UpstoreNet.py
index e7b6d044f..342009c98 100644
--- a/module/plugins/hoster/UpstoreNet.py
+++ b/module/plugins/hoster/UpstoreNet.py
@@ -34,7 +34,7 @@ class UpstoreNet(SimpleHoster):
self.error(_("CHASH_PATTERN not found"))
chash = m.group(1)
self.logDebug("Read hash " + chash)
- # continue to stage2
+ #: continue to stage2
post_data = {'hash': chash, 'free': 'Slow download'}
self.html = self.load(pyfile.url, post=post_data)
@@ -42,17 +42,17 @@ class UpstoreNet(SimpleHoster):
# first get the infos we need: recaptcha key and wait time
recaptcha = ReCaptcha(self)
- # try the captcha 5 times
+ #: try the captcha 5 times
for i in xrange(5):
m = re.search(self.WAIT_PATTERN, self.html)
if m is None:
self.error(_("Wait pattern not found"))
wait_time = int(m.group(1))
- # then, do the waiting
+ #: then, do the waiting
self.wait(wait_time)
- # then, handle the captcha
+ #: then, handle the captcha
response, challenge = recaptcha.challenge()
post_data.update({'recaptcha_challenge_field': challenge,
'recaptcha_response_field' : response})
diff --git a/module/plugins/hoster/VeehdCom.py b/module/plugins/hoster/VeehdCom.py
index 11c70ebff..9f8e77d94 100644
--- a/module/plugins/hoster/VeehdCom.py
+++ b/module/plugins/hoster/VeehdCom.py
@@ -58,7 +58,7 @@ class VeehdCom(Hoster):
name = m.group(1)
- # replace unwanted characters in filename
+ #: replace unwanted characters in filename
if self.getConfig('filename_spaces'):
pattern = '[^\w ]+'
else:
diff --git a/module/plugins/hoster/Xdcc.py b/module/plugins/hoster/Xdcc.py
index 20f800967..f1508f0e4 100644
--- a/module/plugins/hoster/Xdcc.py
+++ b/module/plugins/hoster/Xdcc.py
@@ -27,13 +27,13 @@ class Xdcc(Hoster):
def setup(self):
- self.debug = 0 # 0,1,2
+ self.debug = 0 #: 0,1,2
self.timeout = 30
self.multiDL = False
def process(self, pyfile):
- # change request type
+ #: change request type
self.req = self.core.requestFactory.getRequest(self.__name__, type="XDCC")
self.pyfile = pyfile
@@ -60,7 +60,7 @@ class Xdcc(Hoster):
def doDownload(self, url):
- self.pyfile.setStatus("waiting") # real link
+ self.pyfile.setStatus("waiting") #: real link
m = re.match(r'xdcc://(.*?)/#?(.*?)/(.*?)/#?(\d+)/?', url)
server = m.group(1)
@@ -81,13 +81,13 @@ class Xdcc(Hoster):
self.fail(_("Invalid hostname for IRC Server: %s") % server)
#######################
- # CONNECT TO IRC AND IDLE FOR REAL LINK
+ #: CONNECT TO IRC AND IDLE FOR REAL LINK
dl_time = time.time()
sock = socket.socket()
sock.connect((host, int(port)))
if nick == "pyload":
- nick = "pyload-%d" % (time.time() % 1000) # last 3 digits
+ nick = "pyload-%d" % (time.time() % 1000) #: last 3 digits
sock.send("NICK %s\r\n" % nick)
sock.send("USER %s %s bla :%s\r\n" % (ident, host, real))
@@ -97,14 +97,14 @@ class Xdcc(Hoster):
sock.send("JOIN #%s\r\n" % chan)
sock.send("PRIVMSG %s :xdcc send #%s\r\n" % (bot, pack))
- # IRC recv loop
+ #: IRC recv loop
readbuffer = ""
done = False
retry = None
m = None
while True:
- # done is set if we got our real link
+ #: done is set if we got our real link
if done:
break
@@ -115,7 +115,7 @@ class Xdcc(Hoster):
sock.send("PRIVMSG %s :xdcc send #%s\r\n" % (bot, pack))
else:
- if (dl_time + self.timeout) < time.time(): # todo: add in config
+ if (dl_time + self.timeout) < time.time(): #@TODO: add in config
sock.send("QUIT :byebye\r\n")
sock.close()
self.fail(_("XDCC Bot did not answer"))
@@ -159,7 +159,7 @@ class Xdcc(Hoster):
self.logDebug("Sending CTCP TIME")
sock.send("NOTICE %s :%d\r\n" % (msg['origin'], time.time()))
elif msg['text'] == "\x01LAG\x01":
- pass # don't know how to answer
+ pass #: don't know how to answer
if not (bot == msg['origin'][0:len(bot)]
and nick == msg['target'][0:len(nick)]
@@ -179,7 +179,7 @@ class Xdcc(Hoster):
if m:
done = True
- # get connection data
+ #: get connection data
ip = socket.inet_ntoa(struct.pack('L', socket.ntohl(int(m.group(2)))))
port = int(m.group(3))
packname = m.group(1)
@@ -200,8 +200,8 @@ class Xdcc(Hoster):
self.logInfo(_("%(name)s saved as %(newname)s") % {"name": self.pyfile.name, "newname": newname})
filename = newname
- # kill IRC socket
- # sock.send("QUIT :byebye\r\n")
+ #: kill IRC socket
+ #: sock.send("QUIT :byebye\r\n")
sock.close()
self.lastDownload = filename
diff --git a/module/plugins/hoster/YourfilesTo.py b/module/plugins/hoster/YourfilesTo.py
index f64ac1a43..7db6129e2 100644
--- a/module/plugins/hoster/YourfilesTo.py
+++ b/module/plugins/hoster/YourfilesTo.py
@@ -40,7 +40,7 @@ class YourfilesTo(Hoster):
if not self.html:
self.download_html()
- #var zzipitime = 15;
+ # var zzipitime = 15
m = re.search(r'var zzipitime = (\d+);', self.html)
if m:
sec = int(m.group(1))
diff --git a/module/plugins/hoster/YoutubeCom.py b/module/plugins/hoster/YoutubeCom.py
index b2696ddfb..c4e1ebf28 100644
--- a/module/plugins/hoster/YoutubeCom.py
+++ b/module/plugins/hoster/YoutubeCom.py
@@ -52,10 +52,10 @@ class YoutubeCom(Hoster):
URL_REPLACEMENTS = [(r'youtu\.be/', 'youtube.com/')]
- # Invalid characters that must be removed from the file name
+ #: Invalid characters that must be removed from the file name
invalidChars = u'\u2605:?><"|\\'
- # name, width, height, quality ranking, 3D
+ #: name, width, height, quality ranking, 3D
formats = {5 : (".flv" , 400 , 240 , 1 , False),
6 : (".flv" , 640 , 400 , 4 , False),
17 : (".3gp" , 176 , 144 , 0 , False),
@@ -119,7 +119,7 @@ class YoutubeCom(Hoster):
streams = [dict((y.split('=', 1)) for y in x) for x in streams]
streams = [(int(x['itag']), urllib.unquote(x['url'])) for x in streams]
- # self.logDebug("Found links: %s" % streams)
+ #: self.logDebug("Found links: %s" % streams)
self.logDebug("AVAILABLE STREAMS: %s" % [x[0] for x in streams])
@@ -140,7 +140,7 @@ class YoutubeCom(Hoster):
if desired_fmt in fmt_dict and allowed(desired_fmt):
fmt = desired_fmt
else:
- sel = lambda x: self.formats[x][3] # select quality index
+ sel = lambda x: self.formats[x][3] #: select quality index
comp = lambda x, y: abs(sel(x) - sel(y))
self.logDebug("Choosing nearest fmt: %s" % [(x, allowed(x), comp(x, desired_fmt)) for x in fmt_dict.keys()])
@@ -159,7 +159,7 @@ class YoutubeCom(Hoster):
file_name_pattern = '<meta name="title" content="(.+?)">'
name = re.search(file_name_pattern, html).group(1).replace("/", "")
- # Cleaning invalid characters from the file name
+ #: Cleaning invalid characters from the file name
name = name.encode('ascii', 'replace')
for c in self.invalidChars:
name = name.replace(c, '_')
diff --git a/module/plugins/hoster/ZippyshareCom.py b/module/plugins/hoster/ZippyshareCom.py
index d776e5928..7bae8cc19 100644
--- a/module/plugins/hoster/ZippyshareCom.py
+++ b/module/plugins/hoster/ZippyshareCom.py
@@ -58,35 +58,35 @@ class ZippyshareCom(SimpleHoster):
def get_link(self):
- # get all the scripts inside the html body
+ #: get all the scripts inside the html body
soup = BeautifulSoup(self.html)
scripts = (s.getText().strip() for s in soup.body.findAll('script', type='text/javascript'))
- # meant to be populated with the initialization of all the DOM elements found in the scripts
+ #: meant to be populated with the initialization of all the DOM elements found in the scripts
initScripts = set()
def replElementById(element):
- id = element.group(1) # id might be either 'x' (a real id) or x (a variable)
- attr = element.group(4) # attr might be None
+ id = element.group(1) #: id might be either 'x' (a real id) or x (a variable)
+ attr = element.group(4) #: attr might be None
varName = re.sub(r'-', '', 'GVAR[%s+"_%s"]' %(id, attr))
realid = id.strip('"\'')
- if id != realid: #id is not a variable, so look for realid.attr in the html
+ if id != realid: #: id is not a variable, so look for realid.attr in the html
initValues = filter(None, [elt.get(attr, None) for elt in soup.findAll(id=realid)])
initValue = '"%s"' % initValues[-1] if initValues else 'null'
initScripts.add('%s = %s;' % (varName, initValue))
return varName
- # handle all getElementById
+ #: handle all getElementById
reVar = r'document.getElementById\(([\'"\w-]+)\)(\.)?(getAttribute\([\'"])?(\w+)?([\'"]\))?'
scripts = [re.sub(reVar, replElementById, script) for script in scripts if script]
- # add try/catch in JS to handle deliberate errors
+ #: add try/catch in JS to handle deliberate errors
scripts = ['\n'.join(('try{', script, '} catch(err){}')) for script in scripts]
- # get the file's url by evaluating all the scripts
+ #: get the file's url by evaluating all the scripts
scripts = ['var GVAR = {}'] + list(initScripts) + scripts + ['GVAR["dlbutton_href"]']
return self.js.eval('\n'.join(scripts))