summaryrefslogtreecommitdiffstats
path: root/module
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2010-10-08 16:12:28 +0200
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2010-10-08 16:12:28 +0200
commitd0b5cbcc0f1263675f9401ef7dc9287840965954 (patch)
tree83f3d3e01322224a7c6a243580ad381a922a405c /module
parentclosed #144 (diff)
downloadpyload-d0b5cbcc0f1263675f9401ef7dc9287840965954.tar.xz
MU account parsing
Diffstat (limited to 'module')
-rw-r--r--module/JsEngine.py18
-rw-r--r--module/plugins/accounts/MegauploadCom.py20
2 files changed, 35 insertions, 3 deletions
diff --git a/module/JsEngine.py b/module/JsEngine.py
index ca5bfe4fc..2f34d54c0 100644
--- a/module/JsEngine.py
+++ b/module/JsEngine.py
@@ -17,17 +17,18 @@
@author: RaNaN
"""
+from imp import find_module
ENGINE = ""
try:
- import spidermonkey
+ find_module("spidermonkey")
ENGINE = "spidermonkey"
except:
pass
if not ENGINE:
try:
- import PyV8
+ find_module("PyV8")
ENGINE = "pyv8"
except:
pass
@@ -43,11 +44,21 @@ if not ENGINE:
class JsEngine():
def __init__(self):
self.engine = ENGINE
+ self.init = False
def __nonzero__(self):
return False if not ENGINE else True
def eval(self, script):
+ if not self.init:
+ if ENGINE == "spidermonkey":
+ import spidermonkey
+ global spidermonkey
+ elif ENGINE == "pyv8":
+ import PyV8
+ global PyV8
+ self.init = True
+
if not ENGINE:
raise Exception("No JS Engine")
elif ENGINE == "spidermonkey":
@@ -74,6 +85,9 @@ class JsEngine():
res = p.stdout.read().strip()
return res
+ def error(self):
+ return _("No js engine detected, please install either Spidermonkey, ossp-js or pyv8")
+
if __name__ == "__main__":
js = JsEngine()
import subprocess
diff --git a/module/plugins/accounts/MegauploadCom.py b/module/plugins/accounts/MegauploadCom.py
index 77a11fe25..e50c62788 100644
--- a/module/plugins/accounts/MegauploadCom.py
+++ b/module/plugins/accounts/MegauploadCom.py
@@ -17,6 +17,9 @@
@author: mkaay
"""
+import re
+from time import time
+
from module.plugins.Account import Account
class MegauploadCom(Account):
@@ -27,6 +30,21 @@ class MegauploadCom(Account):
__author_name__ = ("RaNaN")
__author_mail__ = ("RaNaN@pyload.org")
+ def loadAccountInfo(self, user):
+ req = self.getAccountRequest(user)
+ page = req.load("http://www.megaupload.com/?c=account")
+
+ if 'id="directdownloadstxt">Activate' in page:
+ self.core.log.warning(_("Activate direct Download in your MegaUpload Account"))
+
+ valid = re.search(r"(\d+) days remaining", page).group(1)
+ valid = time()+ 60 * 60 * 24 * int(valid)
+
+ return {"validuntil": valid, "trafficleft": -1}
+
+
def login(self, user, data):
req = self.getAccountRequest(user)
- req.load("http://www.megaupload.com/?c=login&next=c%3Dpremium", post={ "username" : user, "password" : data["password"], "login" :"1"}, cookies=True)
+ page = req.load("http://www.megaupload.com/?c=login&next=c%3Dpremium", post={ "username" : user, "password" : data["password"], "login" :"1"}, cookies=True)
+ if "Username and password do not match" in page:
+ self.wrongPassword() \ No newline at end of file