summaryrefslogtreecommitdiffstats
path: root/module/plugins
diff options
context:
space:
mode:
authorGravatar zoidberg10 <zoidberg@mujmail.cz> 2012-08-24 16:51:20 +0200
committerGravatar zoidberg10 <zoidberg@mujmail.cz> 2012-08-24 16:51:20 +0200
commit737541148e42bd017abab938b805869d31916eae (patch)
tree1c8511b3ed7329f6a15bf54b13d1d223af07b935 /module/plugins
parentfilecloud.io (experimental) -- closed #659 (diff)
downloadpyload-737541148e42bd017abab938b805869d31916eae.tar.xz
udpdate zippyshare, linkdecrypter - closed #670
Diffstat (limited to 'module/plugins')
-rw-r--r--module/plugins/crypter/LinkdecrypterCom.py16
-rw-r--r--module/plugins/hooks/LinkdecrypterCom.py4
-rw-r--r--module/plugins/hoster/ZippyshareCom.py79
3 files changed, 59 insertions, 40 deletions
diff --git a/module/plugins/crypter/LinkdecrypterCom.py b/module/plugins/crypter/LinkdecrypterCom.py
index b36ee2eaa..ff21916ef 100644
--- a/module/plugins/crypter/LinkdecrypterCom.py
+++ b/module/plugins/crypter/LinkdecrypterCom.py
@@ -22,13 +22,13 @@ from module.plugins.Crypter import Crypter
class LinkdecrypterCom(Crypter):
__name__ = "LinkdecrypterCom"
__type__ = "crypter"
- __version__ = "0.25"
+ __version__ = "0.26"
__description__ = """linkdecrypter.com"""
__author_name__ = ("zoidberg", "flowlee")
TEXTAREA_PATTERN = r'<textarea name="links" wrap="off" readonly="1" class="caja_des">(.+)</textarea>'
PASSWORD_PATTERN = r'<input type="text" name="password"'
- CAPTCHA_PATTERN = r'<img class="captcha" src="(.+?)"'
+ CAPTCHA_PATTERN = r'<img class="captcha" src="(.+?)"(.*?)>'
REDIR_PATTERN = r'<i>(Click <a href="./">here</a> if your browser does not redirect you).</i>'
def decrypt(self, pyfile):
@@ -72,8 +72,16 @@ class LinkdecrypterCom(Crypter):
found = re.search(self.CAPTCHA_PATTERN, self.html)
if found:
- self.logInfo("Captcha protected link")
- captcha = self.decryptCaptcha(url='http://linkdecrypter.com/' + found.group(1))
+ captcha_url = 'http://linkdecrypter.com/' + found.group(1)
+ result_type = "positional" if "getPos" in found.group(2) else "textual"
+
+ found = re.search(r"<p><i><b>([^<]+)</b></i></p>", self.html)
+ msg = found.group(1) if found else ""
+ self.logInfo("Captcha protected link", result_type, msg)
+
+ captcha = self.decryptCaptcha(captcha_url, result_type = result_type)
+ if result_type == "positional":
+ captcha = "%d|%d" % captcha
self.html = self.load('http://linkdecrypter.com/', post={ "captcha": captcha })
retries -= 1
diff --git a/module/plugins/hooks/LinkdecrypterCom.py b/module/plugins/hooks/LinkdecrypterCom.py
index bc20713ad..ac939afd9 100644
--- a/module/plugins/hooks/LinkdecrypterCom.py
+++ b/module/plugins/hooks/LinkdecrypterCom.py
@@ -24,7 +24,7 @@ from module.utils import remove_chars
class LinkdecrypterCom(Hook):
__name__ = "LinkdecrypterCom"
- __version__ = "0.13"
+ __version__ = "0.14"
__description__ = """linkdecrypter.com - regexp loader"""
__config__ = [ ("activated", "bool", "Activated" , "True") ]
__author_name__ = ("zoidberg")
@@ -45,7 +45,7 @@ class LinkdecrypterCom(Hook):
self.logError(_("Crypter list is empty"))
return
- regexp = r"http://([^.]+\.)*?(%s)/.*" % "|".join(online)
+ regexp = r"https?://([^.]+\.)*?(%s)/.*" % "|".join(online)
dict = self.core.pluginManager.crypterPlugins[self.__name__]
dict["pattern"] = regexp
diff --git a/module/plugins/hoster/ZippyshareCom.py b/module/plugins/hoster/ZippyshareCom.py
index 001e2b296..6b0b01003 100644
--- a/module/plugins/hoster/ZippyshareCom.py
+++ b/module/plugins/hoster/ZippyshareCom.py
@@ -10,22 +10,23 @@ class ZippyshareCom(SimpleHoster):
__name__ = "ZippyshareCom"
__type__ = "hoster"
__pattern__ = r"(?P<HOST>http://www\d{0,2}\.zippyshare.com)/v(?:/|iew.jsp.*key=)(?P<KEY>\d+)"
- __version__ = "0.35"
+ __version__ = "0.36"
__description__ = """Zippyshare.com Download Hoster"""
__author_name__ = ("spoob", "zoidberg")
__author_mail__ = ("spoob@pyload.org", "zoidberg@mujmail.cz")
+ __config__ = [("swfdump_path", "string", "Path to swfdump", "")]
FILE_NAME_PATTERN = r'>Name:</font>\s*<font [^>]*>(?P<N>[^<]+)</font><br />'
FILE_SIZE_PATTERN = r'>Size:</font>\s*<font [^>]*>(?P<S>[0-9.,]+) (?P<U>[kKMG]+)i?B</font><br />'
FILE_OFFLINE_PATTERN = r'>File does not exist on this server</div>'
- DOWNLOAD_URL_PATTERN = r">([^<>]*)document\.getElementById\('dlbutton'\).href = ([^;]+);"
+ DOWNLOAD_URL_PATTERN = r"<script type=\"text/javascript\">([^<]*?)document\.getElementById\('dlbutton'\).href = ([^;]+);"
SEED_PATTERN = r'swfobject.embedSWF\("([^"]+)".*?seed: (\d+)'
CAPTCHA_KEY_PATTERN = r'Recaptcha.create\("([^"]+)"'
CAPTCHA_SHORTENCODE_PATTERN = r"shortencode: '([^']+)'"
CAPTCHA_DOWNLOAD_PATTERN = r"document.location = '([^']+)'"
- LAST_KNOWN_VALUES = (1, 1424574) #time = (seed * multimply) % modulo
+ LAST_KNOWN_VALUES = (9, 2374755) #time = (seed * multiply) % modulo
def setup(self):
self.html = None
@@ -60,27 +61,37 @@ class ZippyshareCom(SimpleHoster):
found = re.search(self.DOWNLOAD_URL_PATTERN, self.html, re.S)
if found:
#Method #1: JS eval
- self.logDebug("JS", found.groups())
- url = self.js.eval("%s%s" % (found.group(1), found.group(2)))
+ url = self.js.eval("\n".join(found.groups()))
else:
#Method #2: SWF eval
seed_search = re.search(self.SEED_PATTERN, self.html)
if seed_search:
swf_url, file_seed = seed_search.groups()
-
+
swf_sts = self.getStorage("swf_sts")
swf_stamp = int(self.getStorage("swf_stamp") or 0)
- self.logDebug("SWF", swf_sts, swf_stamp)
+ swf_version = self.getStorage("version")
+ self.logDebug("SWF", swf_sts, swf_stamp, swf_version)
- if not swf_sts:
+ if not swf_sts:
self.logDebug('Using default values')
multiply, modulo = self.LAST_KNOWN_VALUES
elif swf_sts == "1":
self.logDebug('Using stored values')
multiply = self.getStorage("multiply")
modulo = self.getStorage("modulo")
- elif swf_sts == "2" and (swf_stamp + 3600000) < timestamp():
- multiply, modulo = self.get_swf_values(self.file_info['HOST'] + swf_url)
+ elif swf_sts == "2":
+ if swf_version < self.__version__:
+ self.logDebug('Reverting to default values')
+ self.setStorage("swf_sts", "")
+ self.setStorage("version", self.__version__)
+ multiply, modulo = self.LAST_KNOWN_VALUES
+ elif (swf_stamp + 3600000) < timestamp():
+ swfdump = self.get_swfdump_path()
+ if swfdump:
+ multiply, modulo = self.get_swf_values(self.file_info['HOST'] + swf_url, swfdump)
+ else:
+ self.logWarning("Swfdump not found. Install swftools to bypass captcha.")
if multiply and modulo:
self.logDebug("TIME = (%s * %s) %s" % (file_seed, multiply, modulo))
@@ -92,7 +103,7 @@ class ZippyshareCom(SimpleHoster):
return self.file_info['HOST'] + url
- def get_swf_values(self, swf_url):
+ def get_swf_values(self, swf_url, swfdump):
self.logDebug('Parsing values from %s' % swf_url)
multiply = modulo = None
@@ -100,28 +111,7 @@ class ZippyshareCom(SimpleHoster):
try:
swf_data = self.load(swf_url)
os.write(fd, swf_data)
-
- # used for detecting if swfdump is instelled
- def is_exe(ppath):
- return os.path.isfile(ppath) and os.access(ppath, os.X_OK)
-
- program = 'swfdump'
- swfdump = None
- ppath, pname = os.path.split(program)
- if ppath:
- if is_exe(program):
- swfdump = program
- else:
- for ppath in os.environ["PATH"].split(os.pathsep):
- exe_file = os.path.join(ppath, program)
- if is_exe(exe_file):
- swfdump = exe_file
- if swfdump is None:
- self.fail("swfdump missing - install swftools")
- # ok swfdump is installed move on...
-
-
-
+
p = subprocess.Popen([swfdump, '-a', fpath], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
out, err = p.communicate()
@@ -139,6 +129,7 @@ class ZippyshareCom(SimpleHoster):
self.setStorage("multiply", multiply)
self.setStorage("modulo", modulo)
self.setStorage("swf_sts", 1)
+ self.setStorage("version", self.__version__)
else:
self.logError("Parsing SWF failed: swfdump not installed or plugin out of date")
self.setStorage("swf_sts", 2)
@@ -146,6 +137,26 @@ class ZippyshareCom(SimpleHoster):
self.setStorage("swf_stamp", timestamp())
return multiply, modulo
+
+ def get_swfdump_path(self):
+ # used for detecting if swfdump is installed
+ def is_exe(ppath):
+ return os.path.isfile(ppath) and os.access(ppath, os.X_OK)
+
+ program = self.getConfig("swfdump_path") or "swfdump"
+ swfdump = None
+ ppath, pname = os.path.split(program)
+ if ppath:
+ if is_exe(program):
+ swfdump = program
+ else:
+ for ppath in os.environ["PATH"].split(os.pathsep):
+ exe_file = os.path.join(ppath, program)
+ if is_exe(exe_file):
+ swfdump = exe_file
+
+ # return path to the executable or None if not found
+ return swfdump
def do_recaptcha(self):
self.logDebug('Trying to solve captcha')
@@ -172,4 +183,4 @@ class ZippyshareCom(SimpleHoster):
return url
-getInfo = create_getInfo(ZippyshareCom)
+getInfo = create_getInfo(ZippyshareCom) \ No newline at end of file