summaryrefslogtreecommitdiffstats
path: root/module/plugins/hoster/MegaNz.py
diff options
context:
space:
mode:
Diffstat (limited to 'module/plugins/hoster/MegaNz.py')
-rw-r--r--module/plugins/hoster/MegaNz.py30
1 files changed, 15 insertions, 15 deletions
diff --git a/module/plugins/hoster/MegaNz.py b/module/plugins/hoster/MegaNz.py
index a55220bc2..5562aad06 100644
--- a/module/plugins/hoster/MegaNz.py
+++ b/module/plugins/hoster/MegaNz.py
@@ -1,33 +1,33 @@
# -*- coding: utf-8 -*-
-import re
import random
-from array import array
-from os import remove
-from base64 import standard_b64decode
+import re
from Crypto.Cipher import AES
from Crypto.Util import Counter
+from array import array
+from base64 import standard_b64decode
+from os import remove
from module.common.json_layer import json_loads, json_dumps
from module.plugins.Hoster import Hoster
-#def getInfo(urls):
-# pass
-
class MegaNz(Hoster):
__name__ = "MegaNz"
__type__ = "hoster"
- __pattern__ = r'https?://([a-z0-9]+\.)?mega\.co\.nz/#!([a-zA-Z0-9!_\-]+)'
__version__ = "0.14"
+
+ __pattern__ = r'https?://([a-z0-9]+\.)?mega\.co\.nz/#!([a-zA-Z0-9!_\-]+)'
+
__description__ = """Mega.co.nz hoster plugin"""
- __author_name__ = ("RaNaN", )
- __author_mail__ = ("ranan@pyload.org", )
+ __author_name__ = "RaNaN"
+ __author_mail__ = "ranan@pyload.org"
API_URL = "https://g.api.mega.co.nz/cs?id=%d"
FILE_SUFFIX = ".crypted"
+
def b64_decode(self, data):
data = data.replace("-", "+").replace("_", "/")
return standard_b64decode(data + '=' * (-len(data) % 4))
@@ -110,7 +110,7 @@ class MegaNz(Hoster):
dl = self.callApi(a="g", g=1, p=node, ssl=1)[0]
if "e" in dl:
- e = dl["e"]
+ e = dl['e']
# ETEMPUNAVAIL (-18): Resource temporarily not available, please try again later
if e == -18:
self.retry()
@@ -121,12 +121,12 @@ class MegaNz(Hoster):
# EACCESS (-11): Access violation (e.g., trying to write to a read-only share)
key = self.b64_decode(key)
- attr = self.decryptAttr(dl["at"], key)
+ attr = self.decryptAttr(dl['at'], key)
- pyfile.name = attr["n"] + self.FILE_SUFFIX
+ pyfile.name = attr['n'] + self.FILE_SUFFIX
- self.download(dl["g"])
+ self.download(dl['g'])
self.decryptFile(key)
# Everything is finished and final name can be set
- pyfile.name = attr["n"]
+ pyfile.name = attr['n']