diff options
Diffstat (limited to 'module/plugins/accounts')
-rw-r--r-- | module/plugins/accounts/FilesonicCom.py | 13 | ||||
-rwxr-xr-x | module/plugins/accounts/OronCom.py | 9 | ||||
-rw-r--r-- | module/plugins/accounts/Premium4Me.py | 24 | ||||
-rw-r--r-- | module/plugins/accounts/RealdebridCom.py | 22 | ||||
-rw-r--r-- | module/plugins/accounts/ShareonlineBiz.py | 13 | ||||
-rw-r--r-- | module/plugins/accounts/ZeveraCom.py | 105 |
6 files changed, 153 insertions, 33 deletions
diff --git a/module/plugins/accounts/FilesonicCom.py b/module/plugins/accounts/FilesonicCom.py index 1207f1b56..1b0104b2a 100644 --- a/module/plugins/accounts/FilesonicCom.py +++ b/module/plugins/accounts/FilesonicCom.py @@ -37,10 +37,10 @@ class FilesonicCom(Account): decode=True) return json_loads(xml)["FSApi_Utility"]["getFilesonicDomainForCurrentIp"]["response"] - def loadAccountInfo(self, user, req): + def loadAccountInfo(self, req): xml = req.load(self.API_URL + "/user?method=getInfo&format=json", - post={"u": user, - "p": self.accounts[user]["password"]}, decode=True) + post={"u": self.loginname, + "p": self.password}, decode=True) self.logDebug("account status retrieved from api %s" % xml) @@ -56,15 +56,16 @@ class FilesonicCom(Account): validuntil = -1 return {"validuntil": validuntil, "trafficleft": -1, "premium": premium} - def login(self, user, data, req): + def login(self, req): domain = self.getDomain(req) post_vars = { - "email": user, - "password": data["password"], + "email": self.loginname, + "password": self.password, "rememberMe": 1 } page = req.load("http://www%s/user/login" % domain, cookies=True, post=post_vars, decode=True) if "Provided password does not match." in page or "You must be logged in to view this page." in page: self.wrongPassword() + diff --git a/module/plugins/accounts/OronCom.py b/module/plugins/accounts/OronCom.py index 793984121..1fe8a4449 100755 --- a/module/plugins/accounts/OronCom.py +++ b/module/plugins/accounts/OronCom.py @@ -23,13 +23,13 @@ from time import strptime, mktime class OronCom(Account): __name__ = "OronCom" - __version__ = "0.12" + __version__ = "0.13" __type__ = "account" __description__ = """oron.com account plugin""" __author_name__ = ("DHMH") __author_mail__ = ("DHMH@pyload.org") - def loadAccountInfo(self, user, req): + def loadAccountInfo(self, req): req.load("http://oron.com/?op=change_lang&lang=german") src = req.load("http://oron.com/?op=my_account").replace("\n", "") validuntil = re.search(r"<td>Premiumaccount läuft bis:</td>\s*<td>(.*?)</td>", src) @@ -47,8 +47,9 @@ class OronCom(Account): tmp = {"validuntil": validuntil, "trafficleft": trafficleft, "premium" : premium} return tmp - def login(self, user, data, req): + def login(self, req): req.load("http://oron.com/?op=change_lang&lang=german") - page = req.load("http://oron.com/login", post={"login": user, "password": data["password"], "op": "login"}) + page = req.load("http://oron.com/login", post={"login": self.loginname, "password": self.password, "op": "login"}) if r'<b class="err">Login oder Passwort falsch</b>' in page: self.wrongPassword() + diff --git a/module/plugins/accounts/Premium4Me.py b/module/plugins/accounts/Premium4Me.py index de4fdc219..6a52cb61a 100644 --- a/module/plugins/accounts/Premium4Me.py +++ b/module/plugins/accounts/Premium4Me.py @@ -1,23 +1,27 @@ -from module.plugins.Account import Account
+# -*- coding: utf-8 -*-
+from module.plugins.MultiHoster import MultiHoster
-class Premium4Me(Account):
+class Premium4Me(MultiHoster):
__name__ = "Premium4Me"
- __version__ = "0.02"
+ __version__ = "0.10"
__type__ = "account"
__description__ = """Premium4.me account plugin"""
__author_name__ = ("RaNaN", "zoidberg")
__author_mail__ = ("RaNaN@pyload.org", "zoidberg@mujmail.cz")
- def loadAccountInfo(self, user, req):
+ def loadAccountInfo(self, req):
traffic = req.load("http://premium4.me/api/traffic.php?authcode=%s" % self.authcode)
- account_info = {"trafficleft": int(traffic) / 1024,
- "validuntil": -1}
+ account_info = {"trafficleft": int(traffic) / 1024, "validuntil": -1}
return account_info
- def login(self, user, data, req):
- self.authcode = req.load("http://premium4.me/api/getauthcode.php?username=%s&password=%s" % (user, data["password"])).strip()
-
+ def login(self, req):
+ self.authcode = req.load("http://premium4.me/api/getauthcode.php?username=%s&password=%s" % (self.loginname, self.password)).strip()
+
if "wrong username" in self.authcode:
- self.wrongPassword()
\ No newline at end of file + self.wrongPassword()
+
+ def loadHosterList(self, req):
+ page = req.load("http://premium4.me/api/hosters.php?authcode=%s" % self.authcode)
+ return [x.strip() for x in page.replace("\"", "").split(";")]
\ No newline at end of file diff --git a/module/plugins/accounts/RealdebridCom.py b/module/plugins/accounts/RealdebridCom.py index 3137987a9..4a2cf9368 100644 --- a/module/plugins/accounts/RealdebridCom.py +++ b/module/plugins/accounts/RealdebridCom.py @@ -1,15 +1,18 @@ -from module.plugins.Account import Account
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+from module.plugins.MultiHoster import MultiHoster
import xml.dom.minidom as dom
-class RealdebridCom(Account):
+class RealdebridCom(MultiHoster):
__name__ = "RealdebridCom"
- __version__ = "0.4"
+ __version__ = "0.5"
__type__ = "account"
__description__ = """Real-Debrid.com account plugin"""
__author_name__ = ("Devirex, Hazzard")
__author_mail__ = ("naibaf_11@yahoo.de")
- def loadAccountInfo(self, user, req):
+ def loadAccountInfo(self, req):
page = req.load("http://real-debrid.com/api/account.php")
xml = dom.parseString(page)
account_info = {"validuntil": int(xml.getElementsByTagName("expiration")[0].childNodes[0].nodeValue),
@@ -17,9 +20,16 @@ class RealdebridCom(Account): return account_info
- def login(self, user, data, req):
- page = req.load("https://real-debrid.com/ajax/login.php?user=%s&pass=%s" % (user, data["password"]))
+ def login(self, req):
+ page = req.load("https://real-debrid.com/ajax/login.php?user=%s&pass=%s" % (self.loginname, self.password))
#page = req.load("https://real-debrid.com/login.html", post={"user": user, "pass": data["password"]}, cookies=True)
if "Your login informations are incorrect" in page:
self.wrongPassword()
+
+
+ def loadHosterList(self, req):
+ https = "https" if self.getConfig("https") else "http"
+ page = req.load(https + "://real-debrid.com/api/hosters.php").replace("\"","").strip()
+
+ return[x.strip() for x in page.split(",") if x.strip()]
\ No newline at end of file diff --git a/module/plugins/accounts/ShareonlineBiz.py b/module/plugins/accounts/ShareonlineBiz.py index 426f5a6a9..4dd398d6d 100644 --- a/module/plugins/accounts/ShareonlineBiz.py +++ b/module/plugins/accounts/ShareonlineBiz.py @@ -23,24 +23,23 @@ import re class ShareonlineBiz(Account): __name__ = "ShareonlineBiz" - __version__ = "0.21" + __version__ = "0.3" __type__ = "account" __description__ = """share-online.biz account plugin""" __author_name__ = ("mkaay") __author_mail__ = ("mkaay@mkaay.de") - def getUserAPI(self, user, req): - src = req.load("http://api.share-online.biz/account.php?username=%s&password=%s&act=userDetails" % (user, self.accounts[user]["password"])) + def getUserAPI(self, req): + src = req.load("http://api.share-online.biz/account.php?username=%s&password=%s&act=userDetails" % (self.loginname, self.password)) info = {} for line in src.splitlines(): - if "=" in line: - key, value = line.split("=") - info[key] = value + key, value = line.split("=") + info[key] = value return info def loadAccountInfo(self, user, req): try: - info = self.getUserAPI(user, req) + info = self.getUserAPI(req) return {"validuntil": int(info["expire_date"]), "trafficleft": -1, "premium": not info["group"] == "Sammler"} except: pass diff --git a/module/plugins/accounts/ZeveraCom.py b/module/plugins/accounts/ZeveraCom.py new file mode 100644 index 000000000..26eac64b6 --- /dev/null +++ b/module/plugins/accounts/ZeveraCom.py @@ -0,0 +1,105 @@ +# -*- coding: utf-8 -*-
+from module.plugins.MultiHoster import MultiHoster
+
+import re
+from time import mktime, strptime
+
+class ZeveraCom(MultiHoster):
+ __name__ = "ZeveraCom"
+ __version__ = "0.11"
+ __type__ = "account"
+ __description__ = """Zevera.com account plugin"""
+ __author_name__ = ("zoidberg")
+ __author_mail__ = ("zoidberg@mujmail.cz")
+
+ api_url = "http://zevera.com/API.ashx"
+
+ def loadAccountInfo(self, req):
+ dataRet = self.loadAPIRequest(req)
+ account_info = {
+ "trafficleft": dataRet['AccountInfo']['AvailableTODAYTrafficForUseInMBytes'] * 1024,
+ "validuntil": -1 #dataRet['AccountInfo']['EndSubscriptionDate']
+ }
+
+ return account_info
+
+ def login(self, req):
+ if self.loadAPIRequest(req, parse = False) == 'Login Error':
+ self.wrongPassword()
+
+ def loadHosterList(self, req):
+ page = req.load("http://www.zevera.com/jDownloader.ashx?cmd=gethosters")
+ return [x.strip() for x in page.replace("\"", "").split(",")]
+
+ def loadAPIRequest(self, req, parse = True, **kwargs):
+ get_dict = {
+ 'cmd': 'download_request',
+ 'login': self.loginname,
+ 'pass': self.password
+ }
+ get_dict.update(kwargs)
+
+ response = req.load(self.api_url, get = get_dict, decode = True)
+ self.logDebug(response)
+ return self.parseAPIRequest(response) if parse else response
+
+ def parseAPIRequest(self, api_response):
+
+ try:
+ arFields = iter(api_response.split('TAG BEGIN DATA#')[1].split('#END DATA')[0].split('#'))
+
+ retData = {
+ 'VersionMajor': arFields.next(),
+ 'VersionMinor': arFields.next(),
+ 'ErrorCode': int(arFields.next()),
+ 'ErrorMessage': arFields.next(),
+ 'Update_Wait': arFields.next()
+ }
+ serverInfo = {
+ 'DateTimeOnServer': mktime(strptime(arFields.next(),"%Y/%m/%d %H:%M:%S")),
+ 'DAY_Traffic_LimitInMBytes': int(arFields.next())
+ }
+ accountInfo = {
+ 'EndSubscriptionDate': mktime(strptime(arFields.next(),"%Y/%m/%d %H:%M:%S")),
+ 'TrafficUsedInMBytesDayToday': int(arFields.next()),
+ 'AvailableEXTRATrafficForUseInMBytes': int(arFields.next()),
+ 'AvailableTODAYTrafficForUseInMBytes': int(arFields.next())
+ }
+ fileInfo = {
+ 'FileID': arFields.next(),
+ 'Title': arFields.next(),
+ 'RealFileName': arFields.next(),
+ 'FileNameOnServer': arFields.next(),
+ 'StorageServerURL': arFields.next(),
+ 'Token': arFields.next(),
+ 'FileSizeInBytes': int(arFields.next()),
+ 'StatusID': int(arFields.next())
+ }
+ progress = {
+ 'BytesReceived': int(arFields.next()),
+ 'TotalBytesToReceive': int(arFields.next()),
+ 'Percentage': arFields.next(),
+ 'StatusText': arFields.next(),
+ 'ProgressText': arFields.next()
+ }
+ fileInfo.update({
+ 'Progress': progress,
+ 'FilePassword': arFields.next(),
+ 'Keywords': arFields.next(),
+ 'ImageURL4Download': arFields.next(),
+ 'CategoryID': arFields.next(),
+ 'CategoryText': arFields.next(),
+ 'Notes': arFields.next()
+ })
+ retData.update({
+ 'ServerInfo': serverInfo,
+ 'AccountInfo': accountInfo,
+ 'FileInfo': fileInfo
+ })
+
+ except Exception, e:
+ self.logError(e)
+ return None
+
+ self.logDebug(retData)
+ return retData
\ No newline at end of file |