summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@gmail.com> 2015-01-31 22:00:59 +0100
committerGravatar Walter Purcaro <vuolter@gmail.com> 2015-01-31 22:00:59 +0100
commit79725268402043906f619f7c09e848e02ab8a17b (patch)
tree5288f422b5f33005a19a0de2ddb53fecb99f3a21
parent[JustPremium] Rewritten (diff)
downloadpyload-79725268402043906f619f7c09e848e02ab8a17b.tar.xz
Spare code cosmetics
-rw-r--r--module/plugins/container/DLC.py14
-rw-r--r--module/plugins/container/RSDF.py3
-rw-r--r--module/plugins/crypter/EmbeduploadCom.py4
-rw-r--r--module/plugins/crypter/FilecryptCc.py7
-rw-r--r--module/plugins/crypter/LinkCryptWs.py6
-rw-r--r--module/plugins/crypter/MultiloadCz.py4
-rw-r--r--module/plugins/crypter/NCryptIn.py6
-rw-r--r--module/plugins/crypter/RelinkUs.py6
-rw-r--r--module/plugins/crypter/ShareLinksBiz.py16
-rw-r--r--module/plugins/crypter/XFileSharingProFolder.py4
-rw-r--r--module/plugins/hooks/BypassCaptcha.py4
-rw-r--r--module/plugins/hooks/Captcha9Kw.py31
-rw-r--r--module/plugins/hooks/ExpertDecoders.py8
-rw-r--r--module/plugins/hooks/ExternalScripts.py2
-rw-r--r--module/plugins/hooks/MultiHome.py2
-rw-r--r--module/plugins/hooks/XFileSharingPro.py14
-rw-r--r--module/plugins/hoster/BezvadataCz.py2
-rw-r--r--module/plugins/hoster/DailymotionCom.py2
-rw-r--r--module/plugins/hoster/FileSharkPl.py2
-rw-r--r--module/plugins/hoster/FshareVn.py2
-rw-r--r--module/plugins/hoster/Keep2ShareCc.py2
-rw-r--r--module/plugins/hoster/NitroflareCom.py4
-rw-r--r--module/plugins/hoster/ShareonlineBiz.py5
-rw-r--r--module/plugins/hoster/TurbobitNet.py4
-rw-r--r--module/plugins/hoster/VimeoCom.py2
-rw-r--r--module/plugins/hoster/XFileSharingPro.py4
-rw-r--r--module/plugins/hoster/YoutubeCom.py1
-rw-r--r--module/plugins/internal/SevenZip.py2
-rw-r--r--module/plugins/internal/SimpleHoster.py4
-rw-r--r--module/plugins/internal/UnRar.py12
-rw-r--r--module/plugins/internal/XFSHoster.py13
31 files changed, 86 insertions, 106 deletions
diff --git a/module/plugins/container/DLC.py b/module/plugins/container/DLC.py
index 184a7b25a..589beab4e 100644
--- a/module/plugins/container/DLC.py
+++ b/module/plugins/container/DLC.py
@@ -5,7 +5,6 @@ from __future__ import with_statement
import re
import xml.dom.minidom
-from base64 import standard_b64decode
from Crypto.Cipher import AES
from module.plugins.Container import Container
@@ -41,20 +40,17 @@ class DLC(Container):
data += '=' * (-len(data) % 4)
dlckey = data[-88:]
- dlcdata = standard_b64decode(data[:-88])
+ dlcdata = data[:-88].decode('base64')
try:
- rc = re.search(r'<rc>(.+)</rc>', self.load(self.API_URL % dlckey)).group(1)
+ rc = re.search(r'<rc>(.+)</rc>', self.load(self.API_URL % dlckey)).group(1).decode('base64')
except Exception:
self.fail(_("DLC file is corrupted"))
- else:
- rc = standard_b64decode(rc)
-
dlckey = AES.new(self.KEY, AES.MODE_CBC, self.IV).decrypt(rc)
- self.data = standard_b64decode(AES.new(dlckey, AES.MODE_CBC, dlckey).decrypt(dlcdata))
+ self.data = AES.new(dlckey, AES.MODE_CBC, dlckey).decrypt(dlcdata).decode('base64')
self.packages = [(entry[0] if entry[0] else pyfile.name, entry[1], entry[0] if entry[0] else pyfile.name) \
for entry in self.getPackages()]
@@ -66,10 +62,10 @@ class DLC(Container):
def parsePackages(self, startNode):
- return [(standard_b64decode(decode(node.getAttribute("name"))), self.parseLinks(node)) \
+ return [(decode(node.getAttribute("name")).decode('base64'), self.parseLinks(node)) \
for node in startNode.getElementsByTagName("package")]
def parseLinks(self, startNode):
- return [standard_b64decode(node.getElementsByTagName("url")[0].firstChild.data) \
+ return [node.getElementsByTagName("url")[0].firstChild.data.decode('base64') \
for node in startNode.getElementsByTagName("file")]
diff --git a/module/plugins/container/RSDF.py b/module/plugins/container/RSDF.py
index 20a0d34cd..06b3c3b2b 100644
--- a/module/plugins/container/RSDF.py
+++ b/module/plugins/container/RSDF.py
@@ -2,7 +2,6 @@
from __future__ import with_statement
-import base64
import binascii
import re
@@ -49,6 +48,6 @@ class RSDF(Container):
for link in binascii.unhexlify(''.join(data.split())).splitlines():
if not link:
- link = obj.decrypt(base64.b64decode(link))
+ link = obj.decrypt(link.decode('base64'))
decryptedUrl = link.replace('CCF: ', '')
self.urls.append(decryptedUrl)
diff --git a/module/plugins/crypter/EmbeduploadCom.py b/module/plugins/crypter/EmbeduploadCom.py
index be3181793..456e48a32 100644
--- a/module/plugins/crypter/EmbeduploadCom.py
+++ b/module/plugins/crypter/EmbeduploadCom.py
@@ -35,7 +35,7 @@ class EmbeduploadCom(Crypter):
self.logDebug("PF: %s" % prefered_set)
- tmp_links.extend([x[1] for x in m if x[0] in prefered_set])
+ tmp_links.extend(x[1] for x in m if x[0] in prefered_set)
self.urls = self.getLocation(tmp_links)
if not self.urls:
@@ -44,7 +44,7 @@ class EmbeduploadCom(Crypter):
self.logDebug("IG: %s" % ignored_set)
- tmp_links.extend([x[1] for x in m if x[0] not in ignored_set])
+ tmp_links.extend(x[1] for x in m if x[0] not in ignored_set)
self.urls = self.getLocation(tmp_links)
diff --git a/module/plugins/crypter/FilecryptCc.py b/module/plugins/crypter/FilecryptCc.py
index 096fd414d..6773ce9b6 100644
--- a/module/plugins/crypter/FilecryptCc.py
+++ b/module/plugins/crypter/FilecryptCc.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
# http://filecrypt.cc/Container/64E039F859.html
-import base64
+
import binascii
import re
@@ -167,14 +167,11 @@ class FilecryptCc(Crypter):
# Get key
key = binascii.unhexlify(str(jk))
- # Decode crypted
- crypted = base64.standard_b64decode(crypted)
-
# Decrypt
Key = key
IV = key
obj = AES.new(Key, AES.MODE_CBC, IV)
- text = obj.decrypt(crypted)
+ text = obj.decrypt(crypted.decode('base64'))
# Extract links
links = filter(lambda x: x != "",
diff --git a/module/plugins/crypter/LinkCryptWs.py b/module/plugins/crypter/LinkCryptWs.py
index c67372e3d..098f2542f 100644
--- a/module/plugins/crypter/LinkCryptWs.py
+++ b/module/plugins/crypter/LinkCryptWs.py
@@ -1,6 +1,5 @@
# -*- coding: utf-8 -*-
-import base64
import binascii
import re
@@ -307,14 +306,11 @@ class LinkCryptWs(Crypter):
self.logDebug("JsEngine returns value [%s]" % jreturn)
- # Decode crypted
- crypted = base64.standard_b64decode(crypted)
-
# Decrypt
Key = key
IV = key
obj = AES.new(Key, AES.MODE_CBC, IV)
- text = obj.decrypt(crypted)
+ text = obj.decrypt(crypted.decode('base64'))
# Extract links
text = text.replace("\x00", "").replace("\r", "")
diff --git a/module/plugins/crypter/MultiloadCz.py b/module/plugins/crypter/MultiloadCz.py
index fa1eb02d7..55f424f36 100644
--- a/module/plugins/crypter/MultiloadCz.py
+++ b/module/plugins/crypter/MultiloadCz.py
@@ -35,8 +35,8 @@ class MultiloadCz(Crypter):
m = re.findall(self.LINK_PATTERN, self.html)
if m:
prefered_set = set(self.getConfig("usedHoster").split('|'))
- self.urls.extend([x[1] for x in m if x[0] in prefered_set])
+ self.urls.extend(x[1] for x in m if x[0] in prefered_set)
if not self.urls:
ignored_set = set(self.getConfig("ignoredHoster").split('|'))
- self.urls.extend([x[1] for x in m if x[0] not in ignored_set])
+ self.urls.extend(x[1] for x in m if x[0] not in ignored_set)
diff --git a/module/plugins/crypter/NCryptIn.py b/module/plugins/crypter/NCryptIn.py
index f75f6d484..ecb913586 100644
--- a/module/plugins/crypter/NCryptIn.py
+++ b/module/plugins/crypter/NCryptIn.py
@@ -1,6 +1,5 @@
# -*- coding: utf-8 -*-
-import base64
import binascii
import re
@@ -296,14 +295,11 @@ class NCryptIn(Crypter):
self.logDebug("JsEngine returns value [%s]" % jreturn)
key = binascii.unhexlify(jreturn)
- # Decode crypted
- crypted = base64.standard_b64decode(crypted)
-
# Decrypt
Key = key
IV = key
obj = AES.new(Key, AES.MODE_CBC, IV)
- text = obj.decrypt(crypted)
+ text = obj.decrypt(crypted.decode('base64'))
# Extract links
text = text.replace("\x00", "").replace("\r", "")
diff --git a/module/plugins/crypter/RelinkUs.py b/module/plugins/crypter/RelinkUs.py
index 2165445b6..860dff06b 100644
--- a/module/plugins/crypter/RelinkUs.py
+++ b/module/plugins/crypter/RelinkUs.py
@@ -2,7 +2,6 @@
from __future__ import with_statement
-import base64
import binascii
import re
import os
@@ -279,14 +278,11 @@ class RelinkUs(Crypter):
self.logDebug("JsEngine returns value [%s]" % jreturn)
key = binascii.unhexlify(jreturn)
- # Decode crypted
- crypted = base64.standard_b64decode(crypted)
-
# Decrypt
Key = key
IV = key
obj = AES.new(Key, AES.MODE_CBC, IV)
- text = obj.decrypt(crypted)
+ text = obj.decrypt(crypted.decode('base64'))
# Extract links
text = text.replace("\x00", "").replace("\r", "")
diff --git a/module/plugins/crypter/ShareLinksBiz.py b/module/plugins/crypter/ShareLinksBiz.py
index df53b5879..d79735d42 100644
--- a/module/plugins/crypter/ShareLinksBiz.py
+++ b/module/plugins/crypter/ShareLinksBiz.py
@@ -1,6 +1,5 @@
# -*- coding: utf-8 -*-
-import base64
import binascii
import re
@@ -248,14 +247,12 @@ class ShareLinksBiz(Crypter):
params = res.split(";;")
# Get jk
- strlist = list(base64.standard_b64decode(params[1]))
- strlist.reverse()
- jk = ''.join(strlist)
+ strlist = list(params[1].decode('base64'))
+ jk = ''.join(strlist[::-1])
# Get crypted
- strlist = list(base64.standard_b64decode(params[2]))
- strlist.reverse()
- crypted = ''.join(strlist)
+ strlist = list(params[2].decode('base64'))
+ crypted = ''.join(strlist[::-1])
# Log and return
return crypted, jk
@@ -267,14 +264,11 @@ class ShareLinksBiz(Crypter):
self.logDebug("JsEngine returns value [%s]" % jreturn)
key = binascii.unhexlify(jreturn)
- # Decode crypted
- crypted = base64.standard_b64decode(crypted)
-
# Decrypt
Key = key
IV = key
obj = AES.new(Key, AES.MODE_CBC, IV)
- text = obj.decrypt(crypted)
+ text = obj.decrypt(crypted.decode('base64'))
# Extract links
text = text.replace("\x00", "").replace("\r", "")
diff --git a/module/plugins/crypter/XFileSharingProFolder.py b/module/plugins/crypter/XFileSharingProFolder.py
index 55cd41931..1d001772d 100644
--- a/module/plugins/crypter/XFileSharingProFolder.py
+++ b/module/plugins/crypter/XFileSharingProFolder.py
@@ -20,7 +20,7 @@ class XFileSharingProFolder(XFSCrypter):
def _log(self, type, args):
- msg = " | ".join([str(a).strip() for a in args if a])
+ msg = " | ".join(str(a).strip() for a in args if a)
logger = getattr(self.log, type)
logger("%s: %s: %s" % (self.__name__, self.HOSTER_NAME, msg or _("%s MARK" % type.upper())))
@@ -31,7 +31,7 @@ class XFileSharingProFolder(XFSCrypter):
self.__pattern__ = self.core.pluginManager.crypterPlugins[self.__name__]['pattern']
self.HOSTER_DOMAIN = re.match(self.__pattern__, self.pyfile.url).group("DOMAIN").lower()
- self.HOSTER_NAME = "".join([part.capitalize() for part in re.split(r'(\.|\d+)', self.HOSTER_DOMAIN) if part != '.'])
+ self.HOSTER_NAME = "".join(part.capitalize() for part in re.split(r'(\.|\d+)', self.HOSTER_DOMAIN) if part != '.')
if self.HOSTER_NAME[0].isdigit():
self.HOSTER_NAME = 'X' + self.HOSTER_NAME
diff --git a/module/plugins/hooks/BypassCaptcha.py b/module/plugins/hooks/BypassCaptcha.py
index 8e0d9d36e..cf8754dae 100644
--- a/module/plugins/hooks/BypassCaptcha.py
+++ b/module/plugins/hooks/BypassCaptcha.py
@@ -59,7 +59,7 @@ class BypassCaptcha(Hook):
def getCredits(self):
res = getURL(self.GETCREDITS_URL, post={"key": self.getConfig("passkey")})
- data = dict([x.split(' ', 1) for x in res.splitlines()])
+ data = dict(x.split(' ', 1) for x in res.splitlines())
return int(data['Left'])
@@ -79,7 +79,7 @@ class BypassCaptcha(Hook):
finally:
req.close()
- data = dict([x.split(' ', 1) for x in res.splitlines()])
+ data = dict(x.split(' ', 1) for x in res.splitlines())
if not data or "Value" not in data:
raise BypassCaptchaException(res)
diff --git a/module/plugins/hooks/Captcha9Kw.py b/module/plugins/hooks/Captcha9Kw.py
index 600694e78..342f3fee8 100644
--- a/module/plugins/hooks/Captcha9Kw.py
+++ b/module/plugins/hooks/Captcha9Kw.py
@@ -77,22 +77,19 @@ class Captcha9Kw(Hook):
self.logError(e)
return
- data = b64encode(data)
- mouse = 1 if task.isPositional() else 0
pluginname = re.search(r'_([^_]*)_\d+.\w+', task.captchaFile).group(1)
-
- option = {'min' : 2,
- 'max' : 50,
- 'phrase' : 0,
- 'numeric' : 0,
- 'case_sensitive': 0,
- 'math' : 0,
- 'prio' : min(max(self.getConfig("prio"), 0), 10),
- 'confirm' : self.getConfig("confirm"),
- 'timeout' : min(max(self.getConfig("timeout"), 300), 3999),
- 'selfsolve' : self.getConfig("selfsolve"),
- 'cph' : self.getConfig("captchaperhour"),
- 'cpm' : self.getConfig("captchapermin")}
+ option = {'min' : 2,
+ 'max' : 50,
+ 'phrase' : 0,
+ 'numeric' : 0,
+ 'case_sensitive': 0,
+ 'math' : 0,
+ 'prio' : min(max(self.getConfig("prio"), 0), 10),
+ 'confirm' : self.getConfig("confirm"),
+ 'timeout' : min(max(self.getConfig("timeout"), 300), 3999),
+ 'selfsolve' : self.getConfig("selfsolve"),
+ 'cph' : self.getConfig("captchaperhour"),
+ 'cpm' : self.getConfig("captchapermin")}
for opt in str(self.getConfig("hoster_options").split('|')):
@@ -130,8 +127,8 @@ class Captcha9Kw(Hook):
'pyload' : "1",
'source' : "pyload",
'base64' : "1",
- 'mouse' : mouse,
- 'file-upload-01': data,
+ 'mouse' : 1 if task.isPositional() else 0,
+ 'file-upload-01': b64encode(data),
'action' : "usercaptchaupload"}
for _i in xrange(5):
diff --git a/module/plugins/hooks/ExpertDecoders.py b/module/plugins/hooks/ExpertDecoders.py
index c80401003..c9f8204c4 100644
--- a/module/plugins/hooks/ExpertDecoders.py
+++ b/module/plugins/hooks/ExpertDecoders.py
@@ -56,15 +56,17 @@ class ExpertDecoders(Hook):
with open(task.captchaFile, 'rb') as f:
data = f.read()
- data = b64encode(data)
req = getRequest()
#raise timeout threshold
req.c.setopt(LOW_SPEED_TIME, 80)
try:
- result = req.load(self.API_URL, post={"action": "upload", "key": self.getConfig("passkey"),
- "file": data, "gen_task_id": ticket})
+ result = req.load(self.API_URL,
+ post={'action' : "upload",
+ 'key' : self.getConfig("passkey"),
+ 'file' : b64encode(data),
+ 'gen_task_id': ticket})
finally:
req.close()
diff --git a/module/plugins/hooks/ExternalScripts.py b/module/plugins/hooks/ExternalScripts.py
index 3d9a1e811..bbd442963 100644
--- a/module/plugins/hooks/ExternalScripts.py
+++ b/module/plugins/hooks/ExternalScripts.py
@@ -51,7 +51,7 @@ class ExternalScripts(Hook):
for script_type, names in self.scripts.iteritems():
if names:
- self.logInfo(_("Installed scripts for"), script_type, ", ".join([os.path.basename(x) for x in names]))
+ self.logInfo(_("Installed scripts for"), script_type, ", ".join(map(os.path.basename, names)))
def initPluginType(self, folder, path):
diff --git a/module/plugins/hooks/MultiHome.py b/module/plugins/hooks/MultiHome.py
index 105a42abd..c9f6fc30c 100644
--- a/module/plugins/hooks/MultiHome.py
+++ b/module/plugins/hooks/MultiHome.py
@@ -32,7 +32,7 @@ class MultiHome(Hook):
def toConfig(self):
- return ";".join([i.adress for i in self.interfaces])
+ return ";".join(i.adress for i in self.interfaces)
def parseInterfaces(self, interfaces):
diff --git a/module/plugins/hooks/XFileSharingPro.py b/module/plugins/hooks/XFileSharingPro.py
index e6e30ca8f..9435d35d9 100644
--- a/module/plugins/hooks/XFileSharingPro.py
+++ b/module/plugins/hooks/XFileSharingPro.py
@@ -65,22 +65,22 @@ class XFileSharingPro(Hook):
self.logInfo(_("Handling any %s I can!") % type)
pattern = self.regexp[type][0]
else:
- s = self.getConfig('%s_list' % type).replace('\\', '').replace('|', ',').replace(';', ',').lower()
- plugin_list = set([x.strip() for x in s.split(',')])
+ plugins = self.getConfig('%s_list' % type)
+ plugin_set = set(plugins.replace(' ', '').replace('\\', '').replace('|', ',').replace(';', ',').lower().split(','))
if use_builtin_list:
- plugin_list |= set([x.lower() for x in getattr(self, "%s_BUILTIN" % type.upper())])
+ plugin_set |= set(x.lower() for x in getattr(self, "%s_BUILTIN" % type.upper()))
- plugin_list -= set(('', u''))
+ plugin_set -= set(('', u''))
- if not plugin_list:
+ if not plugin_set:
self.logInfo(_("No %s to handle") % type)
self._unload(type, plugin)
return
- match_list = '|'.join(sorted(plugin_list))
+ match_list = '|'.join(sorted(plugin_set))
- len_match_list = len(plugin_list)
+ len_match_list = len(plugin_set)
self.logInfo(_("Handling %d %s%s: %s") % (len_match_list,
type,
"" if len_match_list == 1 else "s",
diff --git a/module/plugins/hoster/BezvadataCz.py b/module/plugins/hoster/BezvadataCz.py
index 8d56f1ff6..aece7813d 100644
--- a/module/plugins/hoster/BezvadataCz.py
+++ b/module/plugins/hoster/BezvadataCz.py
@@ -88,7 +88,7 @@ class BezvadataCz(SimpleHoster):
def loadcaptcha(self, data, *args, **kwargs):
- return data.decode("base64")
+ return data.decode('base64')
getInfo = create_getInfo(BezvadataCz)
diff --git a/module/plugins/hoster/DailymotionCom.py b/module/plugins/hoster/DailymotionCom.py
index dc42d1f60..cf75af3d2 100644
--- a/module/plugins/hoster/DailymotionCom.py
+++ b/module/plugins/hoster/DailymotionCom.py
@@ -86,7 +86,7 @@ class DailymotionCom(Hoster):
def getLink(self, streams, quality):
if quality > 0:
- for x, s in reversed([item for item in enumerate(streams)]):
+ for x, s in [item for item in enumerate(streams)][::-1]:
qf = s[0][1]
if qf <= quality:
idx = x
diff --git a/module/plugins/hoster/FileSharkPl.py b/module/plugins/hoster/FileSharkPl.py
index 252270c4b..e4ce711bd 100644
--- a/module/plugins/hoster/FileSharkPl.py
+++ b/module/plugins/hoster/FileSharkPl.py
@@ -127,7 +127,7 @@ class FileSharkPl(SimpleHoster):
def _decode64(self, data, *args, **kwargs):
- return data.decode("base64")
+ return data.decode('base64')
getInfo = create_getInfo(FileSharkPl)
diff --git a/module/plugins/hoster/FshareVn.py b/module/plugins/hoster/FshareVn.py
index 4912974ad..9a2b0c323 100644
--- a/module/plugins/hoster/FshareVn.py
+++ b/module/plugins/hoster/FshareVn.py
@@ -87,7 +87,7 @@ class FshareVn(SimpleHoster):
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)
self.wait()
diff --git a/module/plugins/hoster/Keep2ShareCc.py b/module/plugins/hoster/Keep2ShareCc.py
index 34bc3de54..6b7b422c5 100644
--- a/module/plugins/hoster/Keep2ShareCc.py
+++ b/module/plugins/hoster/Keep2ShareCc.py
@@ -57,7 +57,7 @@ class Keep2ShareCc(SimpleHoster):
# 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(':')))])
+ wait_time = sum(a * b for a, b in zip(ftr, map(int, m.group(1).split(':'))))
self.wantReconnect = True
self.retry(wait_time=wait_time, reason="Please wait to download this file")
diff --git a/module/plugins/hoster/NitroflareCom.py b/module/plugins/hoster/NitroflareCom.py
index e21d067b3..434d130ce 100644
--- a/module/plugins/hoster/NitroflareCom.py
+++ b/module/plugins/hoster/NitroflareCom.py
@@ -49,8 +49,8 @@ class NitroflareCom(SimpleHoster):
elif hasattr(self, 'WAIT_PATTERN'):
m = re.search(self.WAIT_PATTERN, self.html)
if m:
- wait_time = sum([int(v) * {"hr": 3600, "hour": 3600, "min": 60, "sec": 1}[u.lower()] for v, u in
- re.findall(r'(\d+)\s*(hr|hour|min|sec)', m.group(0), re.I)])
+ wait_time = sum(int(v) * {"hr": 3600, "hour": 3600, "min": 60, "sec": 1}[u.lower()] for v, u in
+ re.findall(r'(\d+)\s*(hr|hour|min|sec)', m.group(0), re.I))
self.wait(wait_time, wait_time > 300)
return
diff --git a/module/plugins/hoster/ShareonlineBiz.py b/module/plugins/hoster/ShareonlineBiz.py
index 6f49711b8..e00bf5ada 100644
--- a/module/plugins/hoster/ShareonlineBiz.py
+++ b/module/plugins/hoster/ShareonlineBiz.py
@@ -97,9 +97,8 @@ class ShareonlineBiz(SimpleHoster):
self.checkErrors()
- res = self.handleCaptcha()
-
- download_url = res.decode("base64")
+ res = self.handleCaptcha()
+ download_url = res.decode('base64')
if not download_url.startswith("http://"):
self.error(_("Wrong download url"))
diff --git a/module/plugins/hoster/TurbobitNet.py b/module/plugins/hoster/TurbobitNet.py
index 03e18a9cd..fbd054713 100644
--- a/module/plugins/hoster/TurbobitNet.py
+++ b/module/plugins/hoster/TurbobitNet.py
@@ -140,7 +140,7 @@ class TurbobitNet(SimpleHoster):
self.logDebug("URL", self.js.engine, out)
if out.startswith('/download/'):
return "http://turbobit.net%s" % out.strip()
-
+
except Exception, e:
self.logError(e)
else:
@@ -149,7 +149,7 @@ class TurbobitNet(SimpleHoster):
self.delStorage("rtUpdate")
else:
self.retry()
-
+
self.wait()
diff --git a/module/plugins/hoster/VimeoCom.py b/module/plugins/hoster/VimeoCom.py
index f7485f025..d427c1511 100644
--- a/module/plugins/hoster/VimeoCom.py
+++ b/module/plugins/hoster/VimeoCom.py
@@ -44,7 +44,7 @@ class VimeoCom(SimpleHoster):
html = self.load("https://player.vimeo.com/video/" + self.info['pattern']['ID'], get={'password': password})
pattern = r'"(?P<QL>\w+)":{"profile".*?"(?P<URL>http://pdl\.vimeocdn\.com.+?)"'
- link = dict([(l.group('QL').lower(), l.group('URL')) for l in re.finditer(pattern, html)])
+ link = dict((l.group('QL').lower(), l.group('URL')) for l in re.finditer(pattern, html))
if self.getConfig("original"):
if "original" in link:
diff --git a/module/plugins/hoster/XFileSharingPro.py b/module/plugins/hoster/XFileSharingPro.py
index 1794ae513..c66f25ad4 100644
--- a/module/plugins/hoster/XFileSharingPro.py
+++ b/module/plugins/hoster/XFileSharingPro.py
@@ -21,7 +21,7 @@ class XFileSharingPro(XFSHoster):
def _log(self, type, args):
- msg = " | ".join([str(a).strip() for a in args if a])
+ msg = " | ".join(str(a).strip() for a in args if a)
logger = getattr(self.log, type)
logger("%s: %s: %s" % (self.__name__, self.HOSTER_NAME, msg or _("%s MARK" % type.upper())))
@@ -32,7 +32,7 @@ class XFileSharingPro(XFSHoster):
self.__pattern__ = self.core.pluginManager.hosterPlugins[self.__name__]['pattern']
self.HOSTER_DOMAIN = re.match(self.__pattern__, self.pyfile.url).group("DOMAIN").lower()
- self.HOSTER_NAME = "".join([part.capitalize() for part in re.split(r'(\.|\d+)', self.HOSTER_DOMAIN) if part != '.'])
+ self.HOSTER_NAME = "".join(part.capitalize() for part in re.split(r'(\.|\d+)', self.HOSTER_DOMAIN) if part != '.')
if self.HOSTER_NAME[0].isdigit():
self.HOSTER_NAME = 'X' + self.HOSTER_NAME
diff --git a/module/plugins/hoster/YoutubeCom.py b/module/plugins/hoster/YoutubeCom.py
index 5c2489d3c..d00bf2a0e 100644
--- a/module/plugins/hoster/YoutubeCom.py
+++ b/module/plugins/hoster/YoutubeCom.py
@@ -189,4 +189,5 @@ class YoutubeCom(Hoster):
"-vcodec", "copy",
"-acodec", "copy",
filename])
+
os.remove(inputfile)
diff --git a/module/plugins/internal/SevenZip.py b/module/plugins/internal/SevenZip.py
index 05be90702..476348083 100644
--- a/module/plugins/internal/SevenZip.py
+++ b/module/plugins/internal/SevenZip.py
@@ -166,7 +166,7 @@ class SevenZip(UnRar):
#@NOTE: return codes are not reliable, some kind of threading, cleanup whatever issue
call = [self.cmd, command] + args + list(xargs)
- self.manager.logDebug(" ".join([decode(arg) for arg in call]))
+ self.manager.logDebug(" ".join(map(decode, call)))
p = Popen(call, stdout=PIPE, stderr=PIPE)
return p
diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py
index c74e33d59..da178ef9c 100644
--- a/module/plugins/internal/SimpleHoster.py
+++ b/module/plugins/internal/SimpleHoster.py
@@ -547,8 +547,8 @@ class SimpleHoster(Hoster):
elif hasattr(self, 'WAIT_PATTERN'):
m = re.search(self.WAIT_PATTERN, self.html)
if m:
- wait_time = sum([int(v) * {"hr": 3600, "hour": 3600, "min": 60, "sec": 1}[u.lower()] for v, u in
- re.findall(r'(\d+)\s*(hr|hour|min|sec)', m.group(0), re.I)])
+ wait_time = sum(int(v) * {"hr": 3600, "hour": 3600, "min": 60, "sec": 1}[u.lower()] for v, u in
+ re.findall(r'(\d+)\s*(hr|hour|min|sec)', m.group(0), re.I))
self.wait(wait_time, wait_time > 300)
return
diff --git a/module/plugins/internal/UnRar.py b/module/plugins/internal/UnRar.py
index 0738aa63b..f92a2ddd4 100644
--- a/module/plugins/internal/UnRar.py
+++ b/module/plugins/internal/UnRar.py
@@ -22,7 +22,7 @@ def renice(pid, value):
class UnRar(Extractor):
__name__ = "UnRar"
- __version__ = "1.05"
+ __version__ = "1.06"
__description__ = """Rar extractor plugin"""
__license__ = "GPLv3"
@@ -45,7 +45,7 @@ class UnRar(Extractor):
@classmethod
- def checkDeps(cls):
+ def isUsable(cls):
if os.name == "nt":
cls.CMD = os.path.join(pypath, "UnRAR.exe")
p = Popen([cls.CMD], stdout=PIPE, stderr=PIPE)
@@ -67,13 +67,13 @@ class UnRar(Extractor):
def getTargets(cls, files_ids):
targets = []
- for filename, id in files_ids:
- if not cls.isArchive(filename):
+ for fname, id in files_ids:
+ if not cls.isArchive(fname):
continue
- m = cls.re_rarpart1.match(filename)
+ m = cls.re_rarpart1.match(fname)
if not m or int(m.group(1)) == 1: #@NOTE: only add first part file
- targets.append((filename, id))
+ targets.append((fname, id))
return targets
diff --git a/module/plugins/internal/XFSHoster.py b/module/plugins/internal/XFSHoster.py
index 2054b1824..624534dbd 100644
--- a/module/plugins/internal/XFSHoster.py
+++ b/module/plugins/internal/XFSHoster.py
@@ -218,8 +218,8 @@ class XFSHoster(SimpleHoster):
self.logWarning(re.sub(r"<.*?>", " ", self.errmsg))
if 'wait' in self.errmsg:
- wait_time = sum([int(v) * {"hr": 3600, "hour": 3600, "min": 60, "sec": 1}[u.lower()] for v, u in
- re.findall(r'(\d+)\s*(hr|hour|min|sec)', self.errmsg, re.I)])
+ wait_time = sum(int(v) * {"hr": 3600, "hour": 3600, "min": 60, "sec": 1}[u.lower()] for v, u in
+ re.findall(r'(\d+)\s*(hr|hour|min|sec)', self.errmsg, re.I))
self.wait(wait_time, True)
elif 'country' in self.errmsg:
@@ -318,16 +318,21 @@ class XFSHoster(SimpleHoster):
if m:
captcha_div = m.group(1)
numerals = re.findall(r'<span.*?padding-left\s*:\s*(\d+).*?>(\d)</span>', html_unescape(captcha_div))
+
self.logDebug(captcha_div)
- inputs['code'] = "".join([a[1] for a in sorted(numerals, key=lambda num: int(num[0]))])
+
+ inputs['code'] = "".join(a[1] for a in sorted(numerals, key=lambda num: int(num[0])))
+
self.logDebug("Captcha code: %s" % inputs['code'], numerals)
return 2
recaptcha = ReCaptcha(self)
try:
captcha_key = re.search(self.RECAPTCHA_PATTERN, self.html).group(1)
+
except Exception:
captcha_key = recaptcha.detect_key()
+
else:
self.logDebug("ReCaptcha key: %s" % captcha_key)
@@ -338,8 +343,10 @@ class XFSHoster(SimpleHoster):
solvemedia = SolveMedia(self)
try:
captcha_key = re.search(self.SOLVEMEDIA_PATTERN, self.html).group(1)
+
except Exception:
captcha_key = solvemedia.detect_key()
+
else:
self.logDebug("SolveMedia key: %s" % captcha_key)