summaryrefslogtreecommitdiffstats
path: root/module
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2011-10-05 12:34:17 +0200
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2011-10-05 12:34:17 +0200
commit57b1f1557fab97555dada2a3f99145a50405f955 (patch)
tree84ee63f7b854e92964700f9ea329b5407ca19657 /module
parenthoster plugin fixes; new plugins: mediafire, sendspace (diff)
downloadpyload-57b1f1557fab97555dada2a3f99145a50405f955.tar.xz
closed #161
Diffstat (limited to 'module')
-rw-r--r--module/Api.py4
-rw-r--r--module/plugins/hoster/MediafireCom.py60
2 files changed, 33 insertions, 31 deletions
diff --git a/module/Api.py b/module/Api.py
index 3480f05b8..502792cf6 100644
--- a/module/Api.py
+++ b/module/Api.py
@@ -75,6 +75,10 @@ class Api(Iface):
see Thrift specification file remote/thriftbackend/pyload.thrift\
for information about data structures and what methods are usuable with rpc.
+
+ Most methods requires specific permissions, please look at the source code if you need to know.\
+ These can be configured via webinterface.
+ Admin user have all permissions, and are the only ones who can access the methods with no specific permission.
"""
EXTERNAL = Iface # let the json api know which methods are external
diff --git a/module/plugins/hoster/MediafireCom.py b/module/plugins/hoster/MediafireCom.py
index f7c122f40..ae1c13613 100644
--- a/module/plugins/hoster/MediafireCom.py
+++ b/module/plugins/hoster/MediafireCom.py
@@ -17,7 +17,6 @@
"""
import re
-from module.common.JsEngine import JsEngine
from module.plugins.Hoster import Hoster
from module.network.RequestFactory import getURL
@@ -46,6 +45,7 @@ def getInfo(urls):
result.append((name, size, 2, url))
yield result
+
class MediafireCom(Hoster):
__name__ = "MediafireCom"
__type__ = "hoster"
@@ -53,25 +53,25 @@ class MediafireCom(Hoster):
__version__ = "0.2"
__description__ = """Mediafire.com plugin - free only"""
__author_name__ = ("zoidberg")
-
+
PAGE1_FUNCTION_PATTERN = r"function %s\(qk,pk1\)\{if[^']*'loadingicon'\);[^;]*; (.*?)eval"
PAGE1_KEY_PATTERN = ";break;}\s*(\w+='';\w+=unescape.*?)eval\("
PAGE1_RESULT_PATTERN = r"(\w+)\('(?P<qk>[^']+)','(?P<pk1>[^']+)'\)"
PAGE1_DIV_PATTERN = r'getElementById\("(\w{32})"\)'
PAGE1_PKR_PATTERN = r"pKr='([^']+)';"
-
+
PAGE2_VARS_PATTERN = r'<script language="Javascript"><!--\s*(var.*?unescape.*?)eval\('
PAGE2_DZ_PATTERN = r'break;case 15:(.*)</script>'
PAGE2_LINK_PATTERN = r"(?:if.*</a>\')?(?:eval\(\")?(.*?)eval\("
FINAL_LINK_PATTERN = r'parent.document.getElementById\(\'(\w{32})\'\)\).*?"(http://download[^"]+)" \+(\w+)\+ "([^"]+)">'
-
+
FILE_NAME_PATTERN = r'<META NAME="description" CONTENT="([^"]+)"/>'
FILE_SIZE_PATTERN = r'<div style="font-size:14px;padding-top:12px;color:#777;">\(([0-9.]+) (kB|MB|GB)\)</div>'
FILE_OFFLINE_PATTERN = r'class="error_msg_title"> Invalid or Deleted File. </div>'
-
+
def process(self, pyfile):
- self.html = self.load(pyfile.url, decode = True, cookies = True)
-
+ self.html = self.load(pyfile.url, decode=True)
+
try:
pyfile.name = re.search(self.FILE_NAME_PATTERN, self.html).group(1)
found = re.search(self.FILE_SIZE_PATTERN, self.html)
@@ -79,52 +79,50 @@ class MediafireCom(Hoster):
except Exception, e:
self.logError(e)
self.retry(3, 0, "Parse error - file info")
-
- self.handleFree(pyfile)
-
- def handleFree(self, pyfile):
- js = JsEngine()
-
+
+ self.handleFree()
+
+ def handleFree(self):
found = re.search(self.PAGE1_KEY_PATTERN, self.html)
if found:
- result = js.eval(found.group(1))
- found = re.search(self.PAGE1_RESULT_PATTERN, result)
+ result = self.js.eval(found.group(1))
+ found = re.search(self.PAGE1_RESULT_PATTERN, result)
else:
self.fail("Parse error - javascript")
-
- param_dict = found.groupdict()
+
+ param_dict = found.groupdict()
param_dict['r'] = re.search(self.PAGE1_PKR_PATTERN, self.html).group(1)
self.logDebug(param_dict)
key_func = found.group(1)
self.logDebug("KEY_FUNC: %s" % key_func)
-
+
found = re.search(self.PAGE1_FUNCTION_PATTERN % key_func, self.html)
- result = js.eval(found.group(1))
- key_div = found = re.search(self.PAGE1_DIV_PATTERN, result).group(1)
+ result = self.js.eval(found.group(1))
+ key_div = re.search(self.PAGE1_DIV_PATTERN, result).group(1)
self.logDebug("KEY_DIV: %s" % key_div)
-
- self.html = self.load("http://www.mediafire.com/dynamic/download.php", get = param_dict, cookies = True)
- result = js.eval(re.search(self.PAGE2_VARS_PATTERN, self.html).group(1))
+
+ self.html = self.load("http://www.mediafire.com/dynamic/download.php", get=param_dict)
+ result = self.js.eval(re.search(self.PAGE2_VARS_PATTERN, self.html).group(1))
var_list = dict(re.findall("([^=]+)='([^']+)';", result))
-
+
page2_dz = re.search(self.PAGE2_DZ_PATTERN, self.html, re.DOTALL).group(1)
-
+
final_link = None
for link_enc in re.finditer(self.PAGE2_LINK_PATTERN, page2_dz):
#self.logDebug("LINK_ENC: %s..." % link_enc.group(1)[:20])
try:
- link_dec = js.eval(link_enc.group(1).replace(r"\'",r"'"))
+ link_dec = self.js.eval(link_enc.group(1).replace(r"\'", r"'"))
except:
self.logError("Unable to decrypt link %s" % link_enc.group(1)[:20])
- self.logDebug(link_enc.group(1).replace(r"\'",r"'"))
+ self.logDebug(link_enc.group(1).replace(r"\'", r"'"))
continue
-
+
found = re.search(self.FINAL_LINK_PATTERN, link_dec)
if found and found.group(1) == key_div:
final_link = found.group(2) + var_list[found.group(3)] + found.group(4)
- break;
+ break
else:
self.fail("Final link not found")
-
+
self.logDebug("FINAL LINK: %s" % final_link)
- self.download(final_link, cookies=True) \ No newline at end of file
+ self.download(final_link) \ No newline at end of file