summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar fragonib <devnull@localhost> 2011-05-02 16:11:26 +0200
committerGravatar fragonib <devnull@localhost> 2011-05-02 16:11:26 +0200
commite0d6aec7d6d3ab7d741d7dfcbf0a407cdc4ae731 (patch)
tree6c8be60c605254c969e69f504e373b86f2b90361
parentclosed #294, #295 (diff)
downloadpyload-e0d6aec7d6d3ab7d741d7dfcbf0a407cdc4ae731.tar.xz
Serveral Plugins: Clean up
-rw-r--r--module/plugins/crypter/LinkSaveIn.py33
-rw-r--r--module/plugins/crypter/NetfolderIn.py16
-rw-r--r--module/plugins/crypter/RelinkUs.py20
3 files changed, 32 insertions, 37 deletions
diff --git a/module/plugins/crypter/LinkSaveIn.py b/module/plugins/crypter/LinkSaveIn.py
index 2497b3693..d77556b0d 100644
--- a/module/plugins/crypter/LinkSaveIn.py
+++ b/module/plugins/crypter/LinkSaveIn.py
@@ -26,7 +26,8 @@ class LinkSaveIn(Crypter):
if not self.fileExists():
self.offline()
- self.checkCaptcha()
+ # Handle captcha protection
+ self.handleCaptcha()
# Get package name and folder
(package_name, folder_name) = self.getPackageNameAndFolder()
@@ -40,15 +41,23 @@ class LinkSaveIn(Crypter):
def fileExists(self):
if "<title>LinkSave.in - Error 404</title>" in self.html:
- self.log.debug("LinkSaveIn: File not found")
+ self.log.debug("%s: File not found" % self.__name__)
return False
return True
def getPackageNameAndFolder(self):
name = self.pyfile.package().name
folder = self.pyfile.package().folder
- self.log.debug("LinkSaveIn: Default to pyfile name [%s] and folder [%s] for package" % (name, folder))
+ self.log.debug("%s: Default to pyfile name [%s] and folder [%s] for package" % (self.__name__, name, folder))
return (name, folder)
+
+ def handleCaptcha(self):
+ if "<b>Captcha:</b>" in self.html:
+ id = re.search(r'name="id" value="([^"]+)', self.html).group(1)
+ hash = re.search(r'name="hash" value="([^"]+)', self.html).group(1)
+ url = re.search(r'src=".(/captcha/cap.php\?hsh=[^"]+)', self.html).group(1)
+ value = self.decryptCaptcha("http://linksave.in" + url, forceUser=True)
+ self.html = self.load(self.pyfile.url, post={"id": id, "hash": hash, "code": value})
def getCipherParams(self):
@@ -63,14 +72,14 @@ class LinkSaveIn(Crypter):
crypted = m.group('crypted')
# Log and return
- self.log.debug("LinkSaveIn: Javascript cipher key function [%s]" % jk)
+ self.log.debug("%s: Javascript cipher key function [%s]" % (self.__name__, jk))
return (crypted, jk)
def getLinks(self, crypted, jk):
# Get key
jreturn = self.js.eval("%s f()" % jk)
- self.log.debug("LinkSaveIn: JsEngine returns value [%s]" % jreturn)
+ self.log.debug("%s: JsEngine returns value [%s]" % (self.__name__, jreturn))
key = binascii.unhexlify(jreturn)
# Decode crypted
@@ -88,17 +97,5 @@ class LinkSaveIn(Crypter):
links = filter(lambda x: x != "", links)
# Log and return
- self.log.debug("LinkSaveIn: Package has %d links" % len(links))
+ self.log.debug("%s: Package has %d links" % (self.__name__, len(links)))
return links
-
- def checkCaptcha(self):
-
- if "<b>Captcha:</b>" in self.html:
-
- id = re.search(r'name="id" value="([^"]+)', self.html).group(1)
- hash = re.search(r'name="hash" value="([^"]+)', self.html).group(1)
- url = re.search(r'src=".(/captcha/cap.php\?hsh=[^"]+)', self.html).group(1)
-
- value = self.decryptCaptcha("http://linksave.in"+url, forceUser=True)
-
- self.html = self.load(self.pyfile.url, post={"id": id, "hash": hash, "code": value}) \ No newline at end of file
diff --git a/module/plugins/crypter/NetfolderIn.py b/module/plugins/crypter/NetfolderIn.py
index 99b39b335..9d27c33d6 100644
--- a/module/plugins/crypter/NetfolderIn.py
+++ b/module/plugins/crypter/NetfolderIn.py
@@ -36,7 +36,7 @@ class NetfolderIn(Crypter):
def isPasswordProtected(self):
if '<input type="password" name="password"' in self.html:
- self.log.debug("NetfolderIn: Links are password protected")
+ self.log.debug("%s: Links are password protected" % self.__name__)
return True
return False
@@ -47,19 +47,19 @@ class NetfolderIn(Crypter):
m = re.match(self.__pattern__, self.pyfile.url)
id = max(m.group('id1'), m.group('id2'))
except AttributeError:
- self.log.debug("NetfolderIn: Unable to get package id from url [%s]" % (url))
+ self.log.debug("%s: Unable to get package id from url [%s]" % (self.__name__, url))
return
url = "http://netfolder.in/folder.php?folder_id=" + id
password = self.pyfile.package().password
# Submit package password
post = { 'password' : password, 'save' : 'Absenden' }
- self.log.debug("NetfolderIn: Submitting password [%s] for protected links with id [%s]" % (password, id))
+ self.log.debug("%s: Submitting password [%s] for protected links with id [%s]" % (self.__name__, password, id))
html = self.load(url, {}, post)
# Check for invalid password
if '<div class="InPage_Error">' in html:
- self.log.debug("NetfolderIn: Incorrect password, please set right password on Edit package form and retry")
+ self.log.debug("%s: Incorrect password, please set right password on Edit package form and retry" % self.__name__)
return None
return html
@@ -70,18 +70,16 @@ class NetfolderIn(Crypter):
m = re.search(title_re, self.html)
if m is not None:
name = folder = m.group('title')
- self.log.debug("NetfolderIn: Found name [%s] and folder [%s] in package info" % (name, folder))
+ self.log.debug("%s: Found name [%s] and folder [%s] in package info" % (self.__name__, name, folder))
return (name, folder)
else:
name = self.pyfile.package().name
folder = self.pyfile.package().folder
- self.log.debug("NetfolderIn: Package info not found, defaulting to pyfile name [%s] and folder [%s]" % (name, folder))
+ self.log.debug("%s: Package info not found, defaulting to pyfile name [%s] and folder [%s]" % (self.__name__, name, folder))
return (name, folder)
def getLinks(self):
links = re.search(r'name="list" value="(.*?)"', self.html).group(1).split(",")
- #links = re.findall(r'href="(http://(?:www\.)?netload\.in/(?:datei\w+/.*?|index.php\?.*?file_id=\w+))"', self.html)
- #links = [x[0] for x in links]
- self.log.debug("NetfolderIn: Package has %d links" % len(links))
+ self.log.debug("%s: Package has %d links" % (self.__name__, len(links)))
return links
diff --git a/module/plugins/crypter/RelinkUs.py b/module/plugins/crypter/RelinkUs.py
index d122c9dac..8391deeb4 100644
--- a/module/plugins/crypter/RelinkUs.py
+++ b/module/plugins/crypter/RelinkUs.py
@@ -54,13 +54,13 @@ class RelinkUs(Crypter):
def isOnline(self):
if "sorry.png" in self.html:
- self.log.debug("RelinkUs: File not found")
+ self.log.debug("%s: File not found" % self.__name__)
return False
return True
def isPasswordProtected(self):
if "<h1>Container Protection</h1>" in self.html:
- self.log.debug("RelinkUs: Links are password protected")
+ self.log.debug("%s: Links are password protected" % self.__name__)
return True
return False
@@ -72,7 +72,7 @@ class RelinkUs(Crypter):
url = self.pyfile.url
m = re.match(self.__pattern__, url)
if m is None:
- self.log.debug("RelinkUs: Unable to get package id from url [%s]" % (url))
+ self.log.debug("%s: Unable to get package id from url [%s]" % (self.__name__, url))
return
id = m.group('id')
password = self.package.password
@@ -80,12 +80,12 @@ class RelinkUs(Crypter):
# Submit package password
url = "http://www.relink.us/container_password.php?id=" + id
post = { '#' : '', 'password' : password, 'pw' : 'submit' }
- self.log.debug("RelinkUs: Submitting password [%s] for protected links with id [%s]" % (password, id))
+ self.log.debug("%s: Submitting password [%s] for protected links with id [%s]" % (self.__name__, password, id))
html = self.load(url, {}, post)
# Check for invalid password
if "An error occurred!" in html:
- self.log.debug("RelinkUs: Incorrect password, please set right password on Add package form and retry")
+ self.log.debug("%s: Incorrect password, please set right password on Add package form and retry" % self.__name__)
return None
else:
return html
@@ -95,12 +95,12 @@ class RelinkUs(Crypter):
m = re.search(title_re, self.html)
if m is not None:
name = folder = m.group('title')
- self.log.debug("RelinkUs: Found name [%s] and folder [%s] in package info" % (name, folder))
+ self.log.debug("%s: Found name [%s] and folder [%s] in package info" % (self.__name__, name, folder))
return (name, folder)
else:
name = self.package.name
folder = self.package.folder
- self.log.debug("RelinkUs: Package info not found, defaulting to pyfile name [%s] and folder [%s]" % (name, folder))
+ self.log.debug("%s: Package info not found, defaulting to pyfile name [%s] and folder [%s]" % (self.__name__, name, folder))
return (name, folder)
def getCipherParams(self):
@@ -119,14 +119,14 @@ class RelinkUs(Crypter):
crypted = vars[RelinkUs._CRYPTED_KEY_]
# Log and return
- self.log.debug("RelinkUs: Javascript cipher key function [%s]" % jk)
+ self.log.debug("%s: Javascript cipher key function [%s]" % (self.__name__, jk))
return (crypted, jk)
def getLinks(self, crypted, jk):
# Get key
jreturn = self.js.eval("%s f()" % jk)
- self.log.debug("RelinkUs: JsEngine returns value key=[%s]" % jreturn)
+ self.log.debug("%s: JsEngine returns value key=[%s]" % (self.__name__, jreturn))
key = binascii.unhexlify(jreturn)
# Decode crypted
@@ -144,5 +144,5 @@ class RelinkUs(Crypter):
links = filter(lambda x: x != "", links)
# Log and return
- self.log.debug("RelinkUs: Package has %d links" % len(links))
+ self.log.debug("%s: Package has %d links" % (self.__name__, len(links)))
return links