summaryrefslogtreecommitdiffstats
path: root/module/plugins/crypter/LinkCryptWs.py
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@gmail.com> 2014-11-20 22:07:41 +0100
committerGravatar Walter Purcaro <vuolter@gmail.com> 2014-11-20 22:07:41 +0100
commit17f00c79d9be1d087cee8da32f0cb8515004c321 (patch)
treeee065746ba94f75a47b4b6ce97365e61c16b3a5e /module/plugins/crypter/LinkCryptWs.py
parent[UptoboxCom] Fix ERROR_PATTERN (diff)
downloadpyload-17f00c79d9be1d087cee8da32f0cb8515004c321.tar.xz
[LinkCryptWs] Fix (thx NETHeader)
Diffstat (limited to 'module/plugins/crypter/LinkCryptWs.py')
-rw-r--r--module/plugins/crypter/LinkCryptWs.py65
1 files changed, 25 insertions, 40 deletions
diff --git a/module/plugins/crypter/LinkCryptWs.py b/module/plugins/crypter/LinkCryptWs.py
index b90e18490..578595228 100644
--- a/module/plugins/crypter/LinkCryptWs.py
+++ b/module/plugins/crypter/LinkCryptWs.py
@@ -15,7 +15,7 @@ from module.utils import html_unescape
class LinkCryptWs(Crypter):
__name__ = "LinkCryptWs"
__type__ = "crypter"
- __version__ = "0.05"
+ __version__ = "0.06"
__pattern__ = r'http://(?:www\.)?linkcrypt\.ws/(dir|container)/(?P<ID>\w+)'
@@ -25,25 +25,21 @@ class LinkCryptWs(Crypter):
("glukgluk", None)]
- JK_KEY = "jk"
CRYPTED_KEY = "crypted"
+ JK_KEY = "jk"
def setup(self):
- self.html = None
- self.fileid = None
self.captcha = False
- self.package = None
-
- self.preferred_sources = ['cnl', 'web', 'dlc', 'rsdf', 'ccf', ] #['cnl', 'rsdf', 'ccf', 'dlc', 'web']
+ self.links = []
+ self.sources = ['cnl', 'web', 'dlc', 'rsdf', 'ccf']
def prepare(self):
# Init
- self.package = pyfile.package()
self.fileid = re.match(self.__pattern__, pyfile.url).group('ID')
- self.req.cj.setCookie(".linkcrypt.ws", "language", "en")
+ self.req.cj.setCookie("linkcrypt.ws", "language", "en")
# Request package
self.req.http.c.setopt(pycurl.USERAGENT, "Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; rv:11.0) like Gecko") #: better chance to not get those key-captchas
@@ -51,12 +47,9 @@ class LinkCryptWs(Crypter):
def decrypt(self, pyfile):
- #check if we have js
if not self.js:
self.fail(_("Missing JS Engine"))
- package_found = None
-
self.prepare()
if not self.isOnline():
@@ -85,23 +78,15 @@ class LinkCryptWs(Crypter):
self.get_container_html()
# Extract package links
- package_links = []
+ for type in self.sources:
+ links = self.handleLinkSource(type)
- for type_ in self.preferred_sources:
- links = self.handleLinkSource(type_)
if links:
- if isinstance(links, list):
- package_links.extend(links)
- else:
- package_found = True
+ self.links.extend(links)
break
- # Pack
- if package_links:
- self.packages = [(package_name, package_links, folder_name)]
-
- elif package_found:
- self.core.api.deletePackages([self.package.id])
+ if self.links:
+ self.packages = [(package_name, self.links, folder_name)]
def isOnline(self):
@@ -187,18 +172,18 @@ class LinkCryptWs(Crypter):
self.correctCaptcha()
- def handleLinkSource(self, type_):
- if type_ is 'cnl':
+ def handleLinkSource(self, type):
+ if type == 'cnl':
return self.handleCNL2()
- elif type_ is 'web':
+ elif type == 'web':
return self.handleWebLinks()
- elif type_ in ('rsdf', 'ccf', 'dlc'):
- return self.handleContainer(type_)
+ elif type in ('rsdf', 'ccf', 'dlc'):
+ return self.handleContainer(type)
else:
- self.error(_("Unknown source type: %s") % type_)
+ self.fail(_("Unknown source type: %s") % type) #@TODO: Replace with self.error in 0.4.10
def handleWebLinks(self):
@@ -247,17 +232,17 @@ class LinkCryptWs(Crypter):
return self.js.eval(line.replace('{}))',"{}).replace('document.open();document.write','').replace(';document.close();',''))"))
- def handleContainer(self, type_):
+ def handleContainer(self, type):
package_links = []
- type_ = type_.lower()
+ type = type.lower()
- self.logDebug('Search for %s Container links' % type_.upper())
+ self.logDebug('Search for %s Container links' % type.upper())
- if not type_.isalnum(): # check to prevent broken re-pattern (cnl2,rsdf,ccf,dlc,web are all alpha-numeric)
- self.error(_("unknown container type: %s") % type_)
+ if not type.isalnum(): # check to prevent broken re-pattern (cnl2,rsdf,ccf,dlc,web are all alpha-numeric)
+ self.fail(_("Unknown container type: %s") % type) #@TODO: Replace with self.error in 0.4.10
for line in self.container_html:
- if(type_ in line):
+ if type in line:
jseval = self.handle_javascript(line)
clink = re.search(r'href=["\']([^"\']*?)["\']',jseval,re.I)
@@ -267,8 +252,8 @@ class LinkCryptWs(Crypter):
self.logDebug("clink avaible")
package_name, folder_name = self.getPackageInfo()
- self.logDebug("Added package with name %s.%s and container link %s" %( package_name, type_, clink.group(1)))
- self.core.api.uploadContainer( "%s.%s" %(package_name, type_), self.load(clink.group(1)))
+ self.logDebug("Added package with name %s.%s and container link %s" %( package_name, type, clink.group(1)))
+ self.core.api.uploadContainer( "%s.%s" %(package_name, type), self.load(clink.group(1)))
return "Found it"
return package_links
@@ -281,7 +266,7 @@ class LinkCryptWs(Crypter):
cnl_line = None
for line in self.container_html:
- if("cnl" in line):
+ if "cnl" in line:
cnl_line = line
break