summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--docs/write_hooks.rst4
-rw-r--r--module/plugins/accounts/FileserveCom.py113
-rw-r--r--module/plugins/hoster/FileserveCom.py25
-rw-r--r--module/plugins/hoster/NetloadIn.py5
4 files changed, 38 insertions, 109 deletions
diff --git a/docs/write_hooks.rst b/docs/write_hooks.rst
index ffc41d705..dd60367b7 100644
--- a/docs/write_hooks.rst
+++ b/docs/write_hooks.rst
@@ -19,7 +19,7 @@ All Hooks should start with something like this: ::
from module.plugins.Hook import Hook
class YourHook(Hook):
- __name__ = "My own Hook"
+ __name__ = "YourHook"
__version__ = "0.1"
__description__ = "Does really cool stuff"
__config__ = [ ("activated" , "bool" , "Activated" , "True" ) ]
@@ -159,4 +159,4 @@ Example
-------
Sorry but you won't find an example here ;-)
- Look at :file:`module/plugins/hooks` and you will find plenty examples there. \ No newline at end of file
+ Look at :file:`module/plugins/hooks` and you will find plenty examples there.
diff --git a/module/plugins/accounts/FileserveCom.py b/module/plugins/accounts/FileserveCom.py
index e8b4547c5..316c2446e 100644
--- a/module/plugins/accounts/FileserveCom.py
+++ b/module/plugins/accounts/FileserveCom.py
@@ -17,113 +17,46 @@
@author: mkaay
"""
-import re
-from base64 import standard_b64decode
-
-from Crypto.Cipher import AES
+from time import mktime, strptime
from module.plugins.Account import Account
-def decrypt(data):
- data = standard_b64decode(data)
- key = standard_b64decode("L3hpTDJGaFNPVVlnc2FUdg==")
-
- obj = AES.new(key, AES.MODE_ECB)
-
- return obj.decrypt(data)
-
-
-def parse(data):
- ret = {}
- for line in data.splitlines():
- line = line.strip()
- k, none, v = line.partition("=")
- ret[k] = v
-
- return ret
-
-def loadSoap(req, soap):
- req.putHeader("User-Agent", "Mozilla/4.0 (compatible; MSIE 6.0; MS Web Services Client Protocol 2.0.50727.4952)")
- req.putHeader("SOAPAction", "\"urn:FileserveAPIWebServiceAction\"")
-
- ret = req.load("http://api.fileserve.com/api/fileserveAPIServer.php", post=soap, cookies=False, referer=False)
-
- req.clearHeaders()
-
- return ret
+try:
+ from json import loads as json_loads
+except ImportError:
+ from module.lib.simplejson import loads as json_loads
class FileserveCom(Account):
__name__ = "FileserveCom"
- __version__ = "0.11"
+ __version__ = "0.2"
__type__ = "account"
__description__ = """fileserve.com account plugin"""
__author_name__ = ("mkaay")
__author_mail__ = ("mkaay@mkaay.de")
- LOGIN_RE = re.compile(r"<loginReturn.*?>(.*?)</loginReturn")
- SHORTEN_RE = re.compile(r"<downloadGetShortenReturn.*?>(.*?)</downloadGetShortenReturn")
- DIRECT_RE = re.compile(r"<downloadDirectLinkReturn.*?>(.*?)</downloadDirectLinkReturn")
-
-
- def loginApi(self, user, req, data=None):
- if not data:
- data = self.getAccountData(user)
-
- soap = "<?xml version=\"1.0\" encoding=\"utf-8\"?><soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\" xmlns:tns=\"urn:FileserveAPI\" xmlns:types=\"urn:FileserveAPI/encodedTypes\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"><soap:Body soap:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\"><tns:login><username xsi:type=\"xsd:string\">%s</username><password xsi:type=\"xsd:string\">%s</password></tns:login></soap:Body></soap:Envelope>" % (
- user, data["password"])
-
- rep = loadSoap(req, soap)
-
- match = self.LOGIN_RE.search(rep)
- if not match:
- return False
-
- data = parse(decrypt(match.group(1)))
-
- self.logDebug("Login: %s" % data)
-
- return data
-
-
- def getShorten(self, req, token, fileid):
- soap = "<?xml version=\"1.0\" encoding=\"utf-8\"?><soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\" xmlns:tns=\"urn:FileserveAPI\" xmlns:types=\"urn:FileserveAPI/encodedTypes\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"><soap:Body soap:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\"><tns:downloadGetShorten><token xsi:type=\"xsd:string\">%s</token><shorten xsi:type=\"xsd:string\">%s</shorten></tns:downloadGetShorten></soap:Body></soap:Envelope>" % (
- token, fileid)
-
- rep = loadSoap(req, soap)
-
- match = self.SHORTEN_RE.search(rep)
- data = parse(decrypt(match.group(1)))
- self.logDebug("Shorten: %s" % data)
-
- return data
-
-
- def getDirectLink(self, req, token):
- soap = "<?xml version=\"1.0\" encoding=\"utf-8\"?><soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\" xmlns:tns=\"urn:FileserveAPI\" xmlns:types=\"urn:FileserveAPI/encodedTypes\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"><soap:Body soap:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\"><tns:downloadDirectLink><token xsi:type=\"xsd:string\">%s</token></tns:downloadDirectLink></soap:Body></soap:Envelope>" % token
-
- rep = loadSoap(req, soap)
-
- match = self.DIRECT_RE.search(rep)
- data = parse(decrypt(match.group(1)))
- self.logDebug("getDirect: %s" % data)
-
- return data
-
-
def loadAccountInfo(self, user, req):
- data = self.loginApi(user, req)
+ data = self.getAccountData(user)
+
+ page = req.load("http://app.fileserve.com/api/login/", post={"username": user, "password": data["password"],
+ "submit": "Submit+Query"})
+ res = json_loads(page)
- if data["user_type"] == "PREMIUM":
- validuntil = int(data["expiry_date"])
- return {"trafficleft": -1, "validuntil": validuntil}
+ if res["type"] == "premium":
+ validuntil = mktime(strptime(res["expireTime"], "%Y-%m-%d %H:%M:%S"))
+ return {"trafficleft": res["traffic"], "validuntil": validuntil}
else:
return {"premium": False, "trafficleft": None, "validuntil": None}
def login(self, user, data, req):
- ret = self.loginApi(user, req, data)
- if not ret:
- self.wrongPassword()
- elif ret["error"] == "LOGIN_FAIL":
+ page = req.load("http://app.fileserve.com/api/login/", post={"username": user, "password": data["password"],
+ "submit": "Submit+Query"})
+ res = json_loads(page)
+
+ if not res["type"]:
self.wrongPassword()
+ #login at fileserv page
+ req.load("http://www.fileserve.com/login.php",
+ post={"loginUserName": user, "loginUserPassword": data["password"], "autoLogin": "checked",
+ "loginFormSubmit": "Login"})
diff --git a/module/plugins/hoster/FileserveCom.py b/module/plugins/hoster/FileserveCom.py
index 4654e4a7e..53a970226 100644
--- a/module/plugins/hoster/FileserveCom.py
+++ b/module/plugins/hoster/FileserveCom.py
@@ -2,6 +2,7 @@
from __future__ import with_statement
import re
+from base64 import standard_b64encode
from module.plugins.Hoster import Hoster
from module.plugins.ReCaptcha import ReCaptcha
@@ -34,7 +35,7 @@ class FileserveCom(Hoster):
__name__ = "FileserveCom"
__type__ = "hoster"
__pattern__ = r"http://(www\.)?fileserve\.com/file/[a-zA-Z0-9]+"
- __version__ = "0.41"
+ __version__ = "0.42"
__description__ = """Fileserve.Com File Download Hoster"""
__author_name__ = ("jeix", "mkaay", "paul king")
__author_mail__ = ("jeix@hasnomail.de", "mkaay@mkaay.de", "")
@@ -80,17 +81,8 @@ class FileserveCom(Hoster):
def handlePremium(self):
-
- ret = self.account.loginApi(self.user, self.req)
- ret = self.account.getShorten(self.req, ret["token"].strip("\x00"), self.file_id)
-
- #110 offline
- if ret["result_code"] == "110":
- self.offline()
-
- data = self.account.getDirectLink(self.req, ret["token"].strip("\x00"))
-
- self.download(data['result_string'])
+ # handle login timeouts
+ self.download(self.pyfile.url)
def handleFree(self):
self.html = self.load(self.pyfile.url)
@@ -136,7 +128,8 @@ class FileserveCom(Hoster):
self.download(self.pyfile.url, post={"download": "normal"})
check = self.checkDownload({"expired": "Your download link has expired",
- "wait": re.compile(self.LONG_WAIT_PATTERN)})
+ "wait": re.compile(self.LONG_WAIT_PATTERN),
+ "limit": "Your daily download limit has been reached"})
if check == "expired":
self.logDebug("Download link was expired")
@@ -148,6 +141,12 @@ class FileserveCom(Hoster):
self.setWait(wait_time + 3, True)
self.wait()
self.retry()
+ elif check == "limit":
+ #download limited reached for today (not a exact time known)
+
+ self.setWait(180 * 60, True) # wait 3 hours
+ self.wait()
+ self.retry(max_tries=0)
self.thread.m.reconnecting.wait(3) # Ease issue with later downloads appearing to be in parallel
diff --git a/module/plugins/hoster/NetloadIn.py b/module/plugins/hoster/NetloadIn.py
index d913d3a6f..59786d996 100644
--- a/module/plugins/hoster/NetloadIn.py
+++ b/module/plugins/hoster/NetloadIn.py
@@ -55,9 +55,8 @@ class NetloadIn(Hoster):
__name__ = "NetloadIn"
__type__ = "hoster"
__pattern__ = r"http://.*netload\.in/(?:datei(.*?)(?:\.htm|/)|index.php?id=10&file_id=)"
- __version__ = "0.32"
+ __version__ = "0.33"
__description__ = """Netload.in Download Hoster"""
- __config__ = [ ("dumpgen", "bool", "Generate debug page dumps on stdout", "False") ]
__author_name__ = ("spoob", "RaNaN", "Gregy")
__author_mail__ = ("spoob@pyload.org", "ranan@pyload.org", "gregy@gregy.cz")
@@ -162,8 +161,6 @@ class NetloadIn(Hoster):
self.fail(_("File temporarily not available"))
self.log.debug("Netload: try number %d " % i)
- if self.getConf('dumpgen'):
- print page
if re.search(r"(We will prepare your download..)", page) is not None:
self.log.debug("Netload: We will prepare your download")