diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2013-02-09 12:19:31 +0100 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2013-02-09 12:19:31 +0100 |
commit | 727ffe0aaa733a23e3db1aa7ef6a7e2068f565c5 (patch) | |
tree | 26a6199caa154544ce23fd93a57c5841ff26a677 /module/plugins | |
parent | mega.co.nz hoster plugin (diff) | |
download | pyload-727ffe0aaa733a23e3db1aa7ef6a7e2068f565c5.tar.xz |
closed #764
Diffstat (limited to 'module/plugins')
-rw-r--r-- | module/plugins/accounts/ShareonlineBiz.py | 23 | ||||
-rw-r--r-- | module/plugins/hoster/MegaNz.py | 10 | ||||
-rw-r--r-- | module/plugins/hoster/ShareonlineBiz.py | 6 |
3 files changed, 20 insertions, 19 deletions
diff --git a/module/plugins/accounts/ShareonlineBiz.py b/module/plugins/accounts/ShareonlineBiz.py index cdc4ebb63..fe2b412db 100644 --- a/module/plugins/accounts/ShareonlineBiz.py +++ b/module/plugins/accounts/ShareonlineBiz.py @@ -18,39 +18,38 @@ """ from module.plugins.Account import Account -from time import strptime, mktime -import re class ShareonlineBiz(Account): __name__ = "ShareonlineBiz" - __version__ = "0.23" + __version__ = "0.24" __type__ = "account" __description__ = """share-online.biz account plugin""" __author_name__ = ("mkaay", "zoidberg") __author_mail__ = ("mkaay@mkaay.de", "zoidberg@mujmail.cz") - + def getUserAPI(self, user, req): - return req.load("http://api.share-online.biz/account.php?username=%s&password=%s&act=userDetails" % (user, self.accounts[user]["password"])) + return req.load("http://api.share-online.biz/account.php", + {"username": user, "password": self.accounts[user]["password"], "act": "userDetails"}) def loadAccountInfo(self, user, req): src = self.getUserAPI(user, req) - + info = {} for line in src.splitlines(): if "=" in line: key, value = line.split("=") info[key] = value self.logDebug(info) - + if "dl" in info and info["dl"].lower() != "not_available": req.cj.setCookie("share-online.biz", "dl", info["dl"]) if "a" in info and info["a"].lower() != "not_available": - req.cj.setCookie("share-online.biz", "a", info["a"]) - - return {"validuntil": int(info["expire_date"]) if "expire_date" in info else -1, - "trafficleft": -1, + req.cj.setCookie("share-online.biz", "a", info["a"]) + + return {"validuntil": int(info["expire_date"]) if "expire_date" in info else -1, + "trafficleft": -1, "premium": True if ("dl" in info or "a" in info) and (info["group"] != "Sammler") else False} - + def login(self, user, data, req): src = self.getUserAPI(user, req) if "EXCEPTION" in src: diff --git a/module/plugins/hoster/MegaNz.py b/module/plugins/hoster/MegaNz.py index 5041fb868..1c48906ca 100644 --- a/module/plugins/hoster/MegaNz.py +++ b/module/plugins/hoster/MegaNz.py @@ -25,7 +25,7 @@ class MegaNz(Hoster): __author_mail__ = ("ranan@pyload.org", ) API_URL = "https://g.api.mega.co.nz/cs?id=%d" - FILE_PREFIX = ".crypted" + FILE_SUFFIX = ".crypted" def b64_decode(self, data): return standard_b64decode(data.replace("-", "+").replace("_", "/")+ "=") @@ -54,7 +54,7 @@ class MegaNz(Hoster): self.fail(_("Decryption failed")) # Data is padded, 0-bytes must be stripped - return json.loads(attr.replace("MEGA", "").strip("\0").strip()) + return json.loads(attr.replace("MEGA", "").rstrip("\0").strip()) def decryptFile(self, key): """ Decrypts the file at lastDownload` """ @@ -68,7 +68,7 @@ class MegaNz(Hoster): self.pyfile.setStatus("decrypting") f = open(self.lastDownload, "rb") - df = open(self.lastDownload.rstrip(self.FILE_PREFIX), "wb") + df = open(self.lastDownload.rstrip(self.FILE_SUFFIX), "wb") # TODO: calculate CBC-MAC for checksum @@ -98,7 +98,7 @@ class MegaNz(Hoster): self.fail(_("No file key provided in the URL")) # g is for requesting a download url - # this is like the calls in the mega js app, documentation is very bad + # this is similar to the calls in the mega js app, documentation is very bad dl = self.callApi(a="g", g=1, p=node, ssl=1)[0] if "e" in dl: @@ -115,7 +115,7 @@ class MegaNz(Hoster): key = self.b64_decode(key) attr = self.decryptAttr(dl["at"], key) - pyfile.name = attr["n"] + self.FILE_PREFIX + pyfile.name = attr["n"] + self.FILE_SUFFIX self.download(dl["g"]) self.decryptFile(key) diff --git a/module/plugins/hoster/ShareonlineBiz.py b/module/plugins/hoster/ShareonlineBiz.py index 383f933ff..e1867168b 100644 --- a/module/plugins/hoster/ShareonlineBiz.py +++ b/module/plugins/hoster/ShareonlineBiz.py @@ -43,7 +43,7 @@ class ShareonlineBiz(Hoster): __name__ = "ShareonlineBiz" __type__ = "hoster" __pattern__ = r"http://[\w\.]*?(share\-online\.biz|egoshare\.com)/(download.php\?id\=|dl/)[\w]+" - __version__ = "0.35" + __version__ = "0.36" __description__ = """Shareonline.biz Download Hoster""" __author_name__ = ("spoob", "mkaay", "zoidberg") __author_mail__ = ("spoob@pyload.org", "mkaay@mkaay.de", "zoidberg@mujmail.cz") @@ -165,7 +165,9 @@ class ShareonlineBiz(Hoster): def handleAPIPremium(self): #should be working better self.account.getAccountInfo(self.user, True) - src = self.load("http://api.share-online.biz/account.php?username=%s&password=%s&act=download&lid=%s" % (self.user, self.account.accounts[self.user]["password"], self.file_id), post={}) + src = self.load("http://api.share-online.biz/account.php", + {"username": self.user, "password": self.account.accounts[self.user]["password"], "act": "download", "lid": self.file_id}) + self.api_data = dlinfo = {} for line in src.splitlines(): key, value = line.split(": ") |