diff options
Diffstat (limited to 'module/plugins/accounts')
29 files changed, 859 insertions, 221 deletions
diff --git a/module/plugins/accounts/AlldebridCom.py b/module/plugins/accounts/AlldebridCom.py new file mode 100644 index 000000000..f87a1c881 --- /dev/null +++ b/module/plugins/accounts/AlldebridCom.py @@ -0,0 +1,40 @@ +from module.plugins.Account import Account
+import xml.dom.minidom as dom
+from BeautifulSoup import BeautifulSoup
+from time import time
+import re
+
+class AlldebridCom(Account):
+ __name__ = "AlldebridCom"
+ __version__ = "0.2"
+ __type__ = "account"
+ __description__ = """AllDebrid.com account plugin"""
+ __author_name__ = ("Andy, Voigt")
+ __author_mail__ = ("spamsales@online.de")
+
+ def loadAccountInfo(self, user, req):
+ data = self.getAccountData(user)
+ page = req.load("http://www.alldebrid.com/account/")
+ soup=BeautifulSoup(page)
+ #Try to parse expiration date directly from the control panel page (better accuracy)
+ try:
+ time_text=soup.find('div',attrs={'class':'remaining_time_text'}).strong.string
+ self.log.debug("Account expires in: %s" % time_text)
+ p = re.compile('\d+')
+ exp_data=p.findall(time_text)
+ exp_time=time()+int(exp_data[0])*24*60*60+int(exp_data[1])*60*60+(int(exp_data[2])-1)*60
+ #Get expiration date from API
+ except:
+ data = self.getAccountData(user)
+ page = req.load("http://www.alldebrid.com/api.php?action=info_user&login=%s&pw=%s" % (user, data["password"]))
+ self.log.debug(page)
+ xml = dom.parseString(page)
+ exp_time=time()+int(xml.getElementsByTagName("date")[0].childNodes[0].nodeValue)*86400
+ account_info = {"validuntil": exp_time, "trafficleft": -1}
+ return account_info
+
+ def login(self, user, data, req):
+ page = req.load("http://www.alldebrid.com/register/?action=login&login_login=%s&login_password=%s" % (user, data["password"]))
+
+ if "This login doesn't exist" in page:
+ self.wrongPassword()
diff --git a/module/plugins/accounts/BayfilesCom.py b/module/plugins/accounts/BayfilesCom.py new file mode 100644 index 000000000..0d036488b --- /dev/null +++ b/module/plugins/accounts/BayfilesCom.py @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- + +""" + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, + or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, see <http://www.gnu.org/licenses/>. + + @author: zoidberg +""" + +from module.plugins.Account import Account +from module.common.json_layer import json_loads +import re +from time import time, mktime, strptime + +class BayfilesCom(Account): + __name__ = "BayfilesCom" + __version__ = "0.02" + __type__ = "account" + __description__ = """bayfiles.com account plugin""" + __author_name__ = ("zoidberg") + __author_mail__ = ("zoidberg@mujmail.cz") + + def loadAccountInfo(self, user, req): + for i in range(2): + response = json_loads(req.load("http://api.bayfiles.com/v1/account/info")) + self.logDebug(response) + if not response["error"]: + break + self.logWarning(response["error"]) + self.relogin() + + return {"premium": bool(response['premium']), \ + "trafficleft": -1, \ + "validuntil": response['expires'] if response['expires'] >= int(time()) else -1} + + def login(self, user, data, req): + response = json_loads(req.load("http://api.bayfiles.com/v1/account/login/%s/%s" % (user, data["password"]))) + self.logDebug(response) + if response["error"]: + self.logError(response["error"]) + self.wrongPassword()
\ No newline at end of file diff --git a/module/plugins/accounts/BitshareCom.py b/module/plugins/accounts/BitshareCom.py index b0cd1efcd..a4f56e31c 100644 --- a/module/plugins/accounts/BitshareCom.py +++ b/module/plugins/accounts/BitshareCom.py @@ -21,7 +21,7 @@ from module.plugins.Account import Account class BitshareCom(Account): __name__ = "BitshareCom" - __version__ = "0.1" + __version__ = "0.11" __type__ = "account" __description__ = """Bitshare account plugin""" __author_name__ = ("Paul King") @@ -39,6 +39,6 @@ class BitshareCom(Account): def login(self, user, data, req): - page = req.load("http://bitshare.com/login.html", post={ "user" : user, "pass" : data["password"], "submit" :"1"}, cookies=True) - if "Wrong Username or Password" in page: + page = req.load("http://bitshare.com/login.html", post={ "user" : user, "password" : data["password"], "submit" :"Login"}, cookies=True) + if "login" in req.lastEffectiveURL: self.wrongPassword() diff --git a/module/plugins/accounts/CoolshareCz.py b/module/plugins/accounts/CoolshareCz.py new file mode 100644 index 000000000..03686c729 --- /dev/null +++ b/module/plugins/accounts/CoolshareCz.py @@ -0,0 +1,71 @@ +# -*- coding: utf-8 -*- + +""" + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, + or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, see <http://www.gnu.org/licenses/>. + + @author: zoidberg +""" + +#shares code with WarserverCz + +from module.plugins.Account import Account +import re +from time import mktime, strptime + +class CoolshareCz(Account): + __name__ = "CoolshareCz" + __version__ = "0.01" + __type__ = "account" + __description__ = """CoolShare.cz account plugin""" + __author_name__ = ("zoidberg") + __author_mail__ = ("zoidberg@mujmail.cz") + + VALID_UNTIL_PATTERN = ur'<li>Neomezené stahování do: <strong>(.+?)<' + TRAFFIC_LEFT_PATTERN = ur'<li>Kredit: <strong>.*?\(\s*(.+?)\s*B\)' + + DOMAIN = "http://www.coolshare.cz" + + def loadAccountInfo(self, user, req): + html = req.load("%s/uzivatele/prehled" % self.DOMAIN, decode = True) + + validuntil = trafficleft = None + premium = False + + found = re.search(self.VALID_UNTIL_PATTERN, html) + if found: + self.logDebug("VALID_UNTIL", found.group(1)) + try: + #validuntil = mktime(strptime(found.group(1), "%d %B %Y")) + premium = True + trafficleft = -1 + except Exception, e: + self.logError(e) + + found = re.search(self.TRAFFIC_LEFT_PATTERN, html) + if found: + self.logDebug("TRAFFIC_LEFT", found.group(1)) + trafficleft = int(found.group(1).replace(" ","")) // 1024 + premium = True if trafficleft > 1 << 18 else False + + return ({"validuntil": validuntil, "trafficleft": trafficleft, "premium": premium}) + + def login(self, user, data, req): + html = req.load('%s/uzivatele/prihlaseni?do=prihlaseni-submit' % self.DOMAIN, + post = {"username": user, + "password": data['password'], + "send": u"Přihlásit"}, + decode = True) + + if '<p class="chyba">' in html: + self.wrongPassword()
\ No newline at end of file diff --git a/module/plugins/accounts/DdlstorageCom.py b/module/plugins/accounts/DdlstorageCom.py new file mode 100644 index 000000000..01d165f23 --- /dev/null +++ b/module/plugins/accounts/DdlstorageCom.py @@ -0,0 +1,12 @@ +# -*- coding: utf-8 -*- +from module.plugins.internal.XFSPAccount import XFSPAccount + +class DdlstorageCom(XFSPAccount): + __name__ = "DdlstorageCom" + __version__ = "0.01" + __type__ = "account" + __description__ = """DDLStorage.com account plugin""" + __author_name__ = ("zoidberg") + __author_mail__ = ("zoidberg@mujmail.cz") + + MAIN_PAGE = "http://ddlstorage.com/"
\ No newline at end of file diff --git a/module/plugins/accounts/EasybytezCom.py b/module/plugins/accounts/EasybytezCom.py index cf2b16394..ba7829b83 100644 --- a/module/plugins/accounts/EasybytezCom.py +++ b/module/plugins/accounts/EasybytezCom.py @@ -18,13 +18,14 @@ """ from module.plugins.Account import Account +from module.plugins.internal.SimpleHoster import parseHtmlForm import re from module.utils import parseFileSize from time import mktime, strptime class EasybytezCom(Account): __name__ = "EasybytezCom" - __version__ = "0.01" + __version__ = "0.02" __type__ = "account" __description__ = """EasyBytez.com account plugin""" __author_name__ = ("zoidberg") @@ -33,36 +34,40 @@ class EasybytezCom(Account): VALID_UNTIL_PATTERN = r'<TR><TD>Premium account expire:</TD><TD><b>([^<]+)</b>' TRAFFIC_LEFT_PATTERN = r'<TR><TD>Traffic available today:</TD><TD><b>(?P<S>[^<]+)</b>' - def loadAccountInfo(self, user, req): - #self.relogin(user) + def loadAccountInfo(self, user, req): html = req.load("http://www.easybytez.com/?op=my_account", decode = True) - validuntil = -1 + validuntil = trafficleft = None + premium = False + found = re.search(self.VALID_UNTIL_PATTERN, html) if found: premium = True + trafficleft = -1 try: self.logDebug(found.group(1)) validuntil = mktime(strptime(found.group(1), "%d %B %Y")) except Exception, e: self.logError(e) else: - premium = False - - #found = re.search(self.TRAFFIC_LEFT_PATTERN, html) - #trafficleft = parseFileSize(found.group('S')) / 1024 if found else 0 - #self.premium = True if trafficleft else False - trafficleft = -1 + found = re.search(self.TRAFFIC_LEFT_PATTERN, html) + if found: + trafficleft = found.group(1) + if "Unlimited" in trafficleft: + premium = True + else: + trafficleft = parseFileSize(trafficleft) / 1024 return ({"validuntil": validuntil, "trafficleft": trafficleft, "premium": premium}) def login(self, user, data, req): - html = req.load('http://www.easybytez.com/', post = { - "login": user, - "op": "login", - "password": data['password'], - "redirect": "http://easybytez.com/" - }, decode = True) + html = req.load('http://www.easybytez.com/login.html', decode = True) + action, inputs = parseHtmlForm('name="FL"', html) + inputs.update({"login": user, + "password": data['password'], + "redirect": "http://www.easybytez.com/"}) + + html = req.load(action, post = inputs, decode = True) - if 'Incorrect Login or Password' in html: + if 'Incorrect Login or Password' in html or '>Error<' in html: self.wrongPassword()
\ No newline at end of file diff --git a/module/plugins/accounts/FilecloudIo.py b/module/plugins/accounts/FilecloudIo.py new file mode 100644 index 000000000..cf9f92209 --- /dev/null +++ b/module/plugins/accounts/FilecloudIo.py @@ -0,0 +1,49 @@ +# -*- coding: utf-8 -*- + +""" + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, + or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, see <http://www.gnu.org/licenses/>. + + @author: zoidberg +""" + +from module.plugins.Account import Account + +class FilecloudIo(Account): + __name__ = "FilecloudIo" + __version__ = "0.01" + __type__ = "account" + __description__ = """FilecloudIo account plugin""" + __author_name__ = ("zoidberg") + __author_mail__ = ("zoidberg@mujmail.cz") + + def loadAccountInfo(self, user, req): + return ({"validuntil": -1, "trafficleft": -1, "premium": False}) + + def login(self, user, data, req): + req.cj.setCookie("secure.filecloud.io", "lang", "en") + html = req.load('https://secure.filecloud.io/user-login.html') + + if not hasattr(self, "form_data"): + self.form_data = {} + + self.form_data["username"] = user + self.form_data["password"] = data['password'] + + html = req.load('https://secure.filecloud.io/user-login_p.html', + post = self.form_data, + multipart = True) + + self.logged_in = True if "you have successfully logged in - filecloud.io" in html else False + self.form_data = {} +
\ No newline at end of file diff --git a/module/plugins/accounts/FilefactoryCom.py b/module/plugins/accounts/FilefactoryCom.py new file mode 100644 index 000000000..356c5d22a --- /dev/null +++ b/module/plugins/accounts/FilefactoryCom.py @@ -0,0 +1,54 @@ +# -*- coding: utf-8 -*- + +""" + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, + or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, see <http://www.gnu.org/licenses/>. + + @author: zoidberg +""" + +from module.plugins.Account import Account +import re +from time import mktime, strptime + +class FilefactoryCom(Account): + __name__ = "FilefactoryCom" + __version__ = "0.12" + __type__ = "account" + __description__ = """filefactory.com account plugin""" + __author_name__ = ("zoidberg") + __author_mail__ = ("zoidberg@mujmail.cz") + + ACCOUNT_INFO_PATTERN = r'<a href="/premium/">.*?datetime="(.*?)"' + + def loadAccountInfo(self, user, req): + html = req.load("http://www.filefactory.com/member/") + + found = re.search(self.ACCOUNT_INFO_PATTERN, html) + if found: + premium = True + validuntil = mktime(strptime(re.sub(r"(\d)[a-z]{2} ", r"\1 ", found.group(1)),"%d %B, %Y")) + else: + premium = False + validuntil = -1 + + return {"premium": premium, "trafficleft": -1, "validuntil": validuntil} + + def login(self, user, data, req): + html = req.load("http://www.filefactory.com/member/login.php", post={ + "email": user, + "password": data["password"], + "redirect": "/"}) + + if '/member/login.php?err=1' in req.http.header: + self.wrongPassword() diff --git a/module/plugins/accounts/FilejungleCom.py b/module/plugins/accounts/FilejungleCom.py new file mode 100644 index 000000000..8ac25c201 --- /dev/null +++ b/module/plugins/accounts/FilejungleCom.py @@ -0,0 +1,60 @@ +# -*- coding: utf-8 -*- + +""" + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, + or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, see <http://www.gnu.org/licenses/>. + + @author: zoidberg +""" + +from module.plugins.Account import Account +import re +from time import mktime, strptime + +class FilejungleCom(Account): + __name__ = "FilejungleCom" + __version__ = "0.11" + __type__ = "account" + __description__ = """filejungle.com account plugin""" + __author_name__ = ("zoidberg") + __author_mail__ = ("zoidberg@mujmail.cz") + + login_timeout = 60 + + URL = "http://filejungle.com/" + TRAFFIC_LEFT_PATTERN = r'"/extend_premium\.php">Until (\d+ [A-Za-z]+ \d+)<br' + LOGIN_FAILED_PATTERN = r'<span htmlfor="loginUser(Name|Password)" generated="true" class="fail_info">' + + def loadAccountInfo(self, user, req): + html = req.load(self.URL + "dashboard.php") + found = re.search(self.TRAFFIC_LEFT_PATTERN, html) + if found: + premium = True + validuntil = mktime(strptime(found.group(1), "%d %b %Y")) + else: + premium = False + validuntil = -1 + + return {"premium": premium, "trafficleft": -1, "validuntil": validuntil} + + def login(self, user, data, req): + html = req.load(self.URL + "login.php", post={ + "loginUserName": user, + "loginUserPassword": data["password"], + "loginFormSubmit": "Login", + "recaptcha_challenge_field": "", + "recaptcha_response_field": "", + "recaptcha_shortencode_field": ""}) + + if re.search(self.LOGIN_FAILED_PATTERN, html): + self.wrongPassword()
\ No newline at end of file diff --git a/module/plugins/accounts/FourSharedCom.py b/module/plugins/accounts/FourSharedCom.py new file mode 100644 index 000000000..bd3820277 --- /dev/null +++ b/module/plugins/accounts/FourSharedCom.py @@ -0,0 +1,48 @@ +# -*- coding: utf-8 -*- + +""" + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, + or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, see <http://www.gnu.org/licenses/>. + + @author: zoidberg +""" + +from module.plugins.Account import Account +from module.common.json_layer import json_loads + +class FourSharedCom(Account): + __name__ = "FourSharedCom" + __version__ = "0.01" + __type__ = "account" + __description__ = """FourSharedCom account plugin""" + __author_name__ = ("zoidberg") + __author_mail__ = ("zoidberg@mujmail.cz") + + def loadAccountInfo(self, user, req): + #fixme + return ({"validuntil": -1, "trafficleft": -1, "premium": False}) + + def login(self, user, data, req): + req.cj.setCookie("www.4shared.com", "4langcookie", "en") + response = req.load('http://www.4shared.com/login', + post = {"login": user, + "password": data['password'], + "remember": "false", + "doNotRedirect": "true"}) + self.logDebug(response) + response = json_loads(response) + + if not "ok" in response or response['ok'] != True: + if "rejectReason" in response and response['rejectReason'] != True: + self.logError(response['rejectReason']) + self.wrongPassword()
\ No newline at end of file diff --git a/module/plugins/accounts/FshareVn.py b/module/plugins/accounts/FshareVn.py index 46d2d5166..e51009f50 100644 --- a/module/plugins/accounts/FshareVn.py +++ b/module/plugins/accounts/FshareVn.py @@ -24,7 +24,7 @@ import re class FshareVn(Account): __name__ = "FshareVn" - __version__ = "0.01" + __version__ = "0.02" __type__ = "account" __description__ = """fshare.vn account plugin""" __author_name__ = ("zoidberg") @@ -47,13 +47,13 @@ class FshareVn(Account): return {"validuntil": validuntil, "trafficleft": trafficleft} def login(self, user, data, req): - req.http.c.setopt(REFERER, "http://www.fshare.vn/login.php") + req.http.c.setopt(REFERER, "https://www.fshare.vn/login.php") - html = req.load('http://www.fshare.vn/login.php', post = { + html = req.load('https://www.fshare.vn/login.php', post = { "login_password" : data['password'], "login_useremail" : user, - "url_refe" : "http://www.fshare.vn/login.php" + "url_refe" : "https://www.fshare.vn/login.php" }, referer = True, decode = True) if not '<img alt="VIP"' in html: - self.wrongPassword()
\ No newline at end of file + self.wrongPassword() diff --git a/module/plugins/accounts/HellshareCz.py b/module/plugins/accounts/HellshareCz.py index fc44e9307..8ed134f59 100644 --- a/module/plugins/accounts/HellshareCz.py +++ b/module/plugins/accounts/HellshareCz.py @@ -22,7 +22,7 @@ import re class HellshareCz(Account): __name__ = "HellshareCz" - __version__ = "0.11" + __version__ = "0.12" __type__ = "account" __description__ = """hellshare.cz account plugin""" __author_name__ = ("zoidberg") @@ -37,17 +37,19 @@ class HellshareCz(Account): found = re.search(self.CREDIT_LEFT_PATTERN, html) if found is None: credits = 0 + premium = False else: credits = int(found.group(1)) * 1024 + premium = True - return {"validuntil": -1, "trafficleft": credits} + return {"validuntil": -1, "trafficleft": credits, "premium": premium} def login(self, user, data, req): - html = req.load('http://www.hellshare.com/login?do=loginForm-submit', post={ "login": "Log in", "password": data["password"], - "username": user + "username": user, + "perm_login": "on" }) if "<p>You input a wrong user name or wrong password</p>" in html: diff --git a/module/plugins/accounts/HotfileCom.py b/module/plugins/accounts/HotfileCom.py index 9b54e6a3c..23e42dacf 100644 --- a/module/plugins/accounts/HotfileCom.py +++ b/module/plugins/accounts/HotfileCom.py @@ -14,7 +14,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, see <http://www.gnu.org/licenses/>. - @author: mkaay + @author: mkaay, JoKoT3 """ from module.plugins.Account import Account @@ -23,11 +23,11 @@ import hashlib class HotfileCom(Account): __name__ = "HotfileCom" - __version__ = "0.1" + __version__ = "0.2" __type__ = "account" __description__ = """hotfile.com account plugin""" - __author_name__ = ("mkaay") - __author_mail__ = ("mkaay@mkaay.de") + __author_name__ = ("mkaay","JoKoT3") + __author_mail__ = ("mkaay@mkaay.de","jokot3@gmail.com") def loadAccountInfo(self, user, req): resp = self.apiCall("getuserinfo", user=user) @@ -39,14 +39,18 @@ class HotfileCom(Account): key, value = p.split("=") info[key] = value - info["premium_until"] = info["premium_until"].replace("T"," ") - zone = info["premium_until"][19:] - info["premium_until"] = info["premium_until"][:19] - zone = int(zone[:3]) + if info['is_premium'] == '1': + info["premium_until"] = info["premium_until"].replace("T"," ") + zone = info["premium_until"][19:] + info["premium_until"] = info["premium_until"][:19] + zone = int(zone[:3]) + + validuntil = int(mktime(strptime(info["premium_until"], "%Y-%m-%d %H:%M:%S"))) + (zone*3600) + tmp = {"validuntil":validuntil, "trafficleft":-1, "premium":True} - validuntil = int(mktime(strptime(info["premium_until"], "%Y-%m-%d %H:%M:%S"))) + (zone*3600) - - tmp = {"validuntil":validuntil, "trafficleft":-1} + elif info['is_premium'] == '0': + tmp = {"premium":False} + return tmp def apiCall(self, method, post={}, user=None): @@ -79,4 +83,4 @@ class HotfileCom(Account): page = req.load("http://hotfile.com/login.php", post={"returnto": "/", "user": user, "pass": data["password"]}, cookies=True) if "Bad username/password" in page: - self.wrongPassword() + self.wrongPassword()
\ No newline at end of file diff --git a/module/plugins/accounts/MultishareCz.py b/module/plugins/accounts/MultishareCz.py index cc3e430af..39439cbbe 100644 --- a/module/plugins/accounts/MultishareCz.py +++ b/module/plugins/accounts/MultishareCz.py @@ -25,7 +25,7 @@ from module.utils import parseFileSize class MultishareCz(Account): __name__ = "MultishareCz" - __version__ = "0.01" + __version__ = "0.02" __type__ = "account" __description__ = """multishare.cz account plugin""" __author_name__ = ("zoidberg") @@ -54,5 +54,5 @@ class MultishareCz(Account): "jmeno": user }, decode = True) - if not u'<title>MultiShare.cz :: Profil uživatele</title>' in html: + if '<div class="akce-chyba akce">' in html: self.wrongPassword()
\ No newline at end of file diff --git a/module/plugins/accounts/NetloadIn.py b/module/plugins/accounts/NetloadIn.py index 6febf2ff1..cef3e298b 100755 --- a/module/plugins/accounts/NetloadIn.py +++ b/module/plugins/accounts/NetloadIn.py @@ -23,18 +23,18 @@ from time import time class NetloadIn(Account): __name__ = "NetloadIn" - __version__ = "0.2" + __version__ = "0.22" __type__ = "account" __description__ = """netload.in account plugin""" - __author_name__ = ("RaNaN", "DHMH") - __author_mail__ = ("RaNaN@pyload.org", "DHMH@pyload.org") + __author_name__ = ("RaNaN", "CryNickSystems") + __author_mail__ = ("RaNaN@pyload.org", "webmaster@pcProfil.de") def loadAccountInfo(self, user, req): - page = req.load("http://netload.in/index.php?id=2") - left = r">(\d+) Tage, (\d+) Stunden<" + page = req.load("http://netload.in/index.php?id=2&lang=de") + left = r">(\d+) (Tag|Tage), (\d+) Stunden<" left = re.search(left, page) if left: - validuntil = time() + int(left.group(1)) * 24 * 60 * 60 + int(left.group(2)) * 60 * 60 + validuntil = time() + int(left.group(1)) * 24 * 60 * 60 + int(left.group(3)) * 60 * 60 trafficleft = -1 premium = True else: @@ -44,6 +44,6 @@ class NetloadIn(Account): return {"validuntil": validuntil, "trafficleft": trafficleft, "premium" : premium} def login(self, user, data,req): - page = req.load("http://netload.in/index.php", None, { "txtuser" : user, "txtpass" : data['password'], "txtcheck" : "login", "txtlogin" : ""}, cookies=True) + page = req.load("http://netload.in/index.php", None, { "txtuser" : user, "txtpass" : data['password'], "txtcheck" : "login", "txtlogin" : "Login"}, cookies=True) if "password or it might be invalid!" in page: self.wrongPassword() diff --git a/module/plugins/accounts/PremiumizeMe.py b/module/plugins/accounts/PremiumizeMe.py new file mode 100644 index 000000000..768fcd783 --- /dev/null +++ b/module/plugins/accounts/PremiumizeMe.py @@ -0,0 +1,40 @@ +from module.plugins.Account import Account
+
+from module.common.json_layer import json_loads
+
+class PremiumizeMe(Account):
+ __name__ = "PremiumizeMe"
+ __version__ = "0.1"
+ __type__ = "account"
+ __description__ = """Premiumize.Me account plugin"""
+
+ __author_name__ = ("Florian Franzen")
+ __author_mail__ = ("FlorianFranzen@gmail.com")
+
+ def loadAccountInfo(self, user, req):
+
+ # Get user data from premiumize.me
+ status = self.getAccountStatus(user, req)
+
+ # Parse account info
+ account_info = {"validuntil": float(status['result']['expires']),
+ "trafficleft": status['result']['trafficleft_bytes'] / 1024}
+
+ return account_info
+
+ def login(self, user, data, req):
+
+ # Get user data from premiumize.me
+ status = self.getAccountStatus(user, req)
+
+ # Check if user and password are valid
+ if status['status'] != 200:
+ self.wrongPassword()
+
+
+ def getAccountStatus(self, user, req):
+
+ # Use premiumize.me API v1 (see https://secure.premiumize.me/?show=api) to retrieve account info and return the parsed json answer
+ answer = req.load("https://api.premiumize.me/pm-api/v1.php?method=accountstatus¶ms[login]=%s¶ms[pass]=%s" % (user, self.accounts[user]['password']))
+ return json_loads(answer)
+
\ No newline at end of file diff --git a/module/plugins/accounts/RapidshareCom.py b/module/plugins/accounts/RapidshareCom.py index e69f17e62..15722e099 100644 --- a/module/plugins/accounts/RapidshareCom.py +++ b/module/plugins/accounts/RapidshareCom.py @@ -21,7 +21,7 @@ from module.plugins.Account import Account class RapidshareCom(Account): __name__ = "RapidshareCom" - __version__ = "0.21" + __version__ = "0.22" __type__ = "account" __description__ = """Rapidshare.com account plugin""" __author_name__ = ("mkaay") @@ -41,8 +41,11 @@ class RapidshareCom(Account): continue k, v = t.split("=") info[k] = v + + validuntil = int(info["billeduntil"]) + premium = True if validuntil else False - tmp = {"validuntil":int(info["billeduntil"]), "trafficleft":-1, "maxtraffic":-1} + tmp = {"premium": premium, "validuntil": validuntil, "trafficleft":-1, "maxtraffic":-1} return tmp diff --git a/module/plugins/accounts/RealdebridCom.py b/module/plugins/accounts/RealdebridCom.py index 4a2cf9368..9460fc815 100644 --- a/module/plugins/accounts/RealdebridCom.py +++ b/module/plugins/accounts/RealdebridCom.py @@ -1,35 +1,35 @@ -#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
-from module.plugins.MultiHoster import MultiHoster
-import xml.dom.minidom as dom
-
-class RealdebridCom(MultiHoster):
- __name__ = "RealdebridCom"
- __version__ = "0.5"
- __type__ = "account"
- __description__ = """Real-Debrid.com account plugin"""
- __author_name__ = ("Devirex, Hazzard")
- __author_mail__ = ("naibaf_11@yahoo.de")
-
- 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),
- "trafficleft": -1}
-
- return account_info
-
- 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()
-
+#!/usr/bin/env python +# -*- coding: utf-8 -*- + +from module.plugins.MultiHoster import MultiHoster +import xml.dom.minidom as dom + +class RealdebridCom(MultiHoster): + __name__ = "RealdebridCom" + __version__ = "0.5" + __type__ = "account" + __description__ = """Real-Debrid.com account plugin""" + __author_name__ = ("Devirex, Hazzard") + __author_mail__ = ("naibaf_11@yahoo.de") + + 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), + "trafficleft": -1} + + return account_info + + 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/RyushareCom.py b/module/plugins/accounts/RyushareCom.py new file mode 100644 index 000000000..f734eb11b --- /dev/null +++ b/module/plugins/accounts/RyushareCom.py @@ -0,0 +1,18 @@ +# -*- coding: utf-8 -*- +from module.plugins.internal.XFSPAccount import XFSPAccount + +class RyushareCom(XFSPAccount): + __name__ = "RyushareCom" + __version__ = "0.03" + __type__ = "account" + __description__ = """ryushare.com account plugin""" + __author_name__ = ("zoidberg", "trance4us") + __author_mail__ = ("zoidberg@mujmail.cz", "") + + MAIN_PAGE = "http://ryushare.com/" + + def login(self, user, data, req): + req.lastURL = "http://ryushare.com/login.python" + html = req.load("http://ryushare.com/login.python", post={"login": user, "password": data["password"], "op": "login"}) + if 'Incorrect Login or Password' in html or '>Error<' in html: + self.wrongPassword()
\ No newline at end of file diff --git a/module/plugins/accounts/ShareRapidCom.py b/module/plugins/accounts/ShareRapidCom.py index 9828b1f7e..aad229475 100644 --- a/module/plugins/accounts/ShareRapidCom.py +++ b/module/plugins/accounts/ShareRapidCom.py @@ -5,32 +5,30 @@ from module.plugins.Account import Account class ShareRapidCom(Account): __name__ = "ShareRapidCom" - __version__ = "0.1" + __version__ = "0.31" __type__ = "account" __description__ = """ShareRapid account plugin""" __author_name__ = ("MikyWoW") def loadAccountInfo(self, user, req): src = req.load("http://share-rapid.com/mujucet/", cookies=True) - if "Kredit:" in src: - start = src.index('Kredit:</td><td>') - src = src[start+16:] - start = src.index('GB') - kredit = src[0:start-1] - ret = float(kredit)*1024*1024 - tmp = {"premium": True, "trafficleft": ret, "validuntil": -1} + found = re.search(r'<tr><td>GB:</td><td>(.*?) GB', src) + if found: + ret = float(found.group(1)) * (1 << 20) + tmp = {"premium": True, "trafficleft": ret, "validuntil": -1} else: - tmp = {"premium": False, "trafficleft": None, "validuntil": None} + tmp = {"premium": False, "trafficleft": None, "validuntil": None} return tmp def login(self, user, data, req): htm = req.load("http://share-rapid.com/prihlaseni/", cookies=True) if "Heslo:" in htm: - start = htm.index('id="inp_hash" name="hash" value="') - htm = htm[start+33:] - hashes = htm[0:32] - html = req.load("http://share-rapid.com/prihlaseni/", + start = htm.index('id="inp_hash" name="hash" value="') + htm = htm[start+33:] + hashes = htm[0:32] + htm = req.load("http://share-rapid.com/prihlaseni/", post={"hash": hashes,"login": user, "pass1": data["password"],"remember": 0, "sbmt": "P%C5%99ihl%C3%A1sit"}, cookies=True) - if "Heslo:" in html: - self.wrongPassword()
\ No newline at end of file + + #if "Heslo:" in htm: + # self.wrongPassword()
\ No newline at end of file diff --git a/module/plugins/accounts/StahnuTo.py b/module/plugins/accounts/StahnuTo.py new file mode 100644 index 000000000..8a4523bc5 --- /dev/null +++ b/module/plugins/accounts/StahnuTo.py @@ -0,0 +1,49 @@ +# -*- coding: utf-8 -*- + +""" + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, + or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, see <http://www.gnu.org/licenses/>. + + @author: zoidberg +""" + +from module.plugins.Account import Account +from module.utils import parseFileSize +import re + +class StahnuTo(Account): + __name__ = "StahnuTo" + __version__ = "0.02" + __type__ = "account" + __description__ = """StahnuTo account plugin""" + __author_name__ = ("zoidberg") + __author_mail__ = ("zoidberg@mujmail.cz") + + #login_timeout = 60 + + def loadAccountInfo(self, user, req): + html = req.load("http://www.stahnu.to/") + + found = re.search(r'>VIP: (\d+.*)<', html) + trafficleft = parseFileSize(found.group(1)) * 1024 if found else 0 + + return {"premium": trafficleft > (512 * 1024), "trafficleft": trafficleft, "validuntil": -1} + + def login(self, user, data, req): + html = req.load("http://www.stahnu.to/login.php", post={ + "username": user, + "password": data["password"], + "submit": "Login"}) + + if not '<a href="logout.php">' in html: + self.wrongPassword()
\ No newline at end of file diff --git a/module/plugins/accounts/TurbobitNet.py b/module/plugins/accounts/TurbobitNet.py new file mode 100644 index 000000000..c4b819131 --- /dev/null +++ b/module/plugins/accounts/TurbobitNet.py @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- + +""" + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, + or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, see <http://www.gnu.org/licenses/>. + + @author: zoidberg +""" + +from module.plugins.Account import Account +import re +from time import mktime, strptime + +class TurbobitNet(Account): + __name__ = "TurbobitNet" + __version__ = "0.01" + __type__ = "account" + __description__ = """TurbobitNet account plugin""" + __author_name__ = ("zoidberg") + __author_mail__ = ("zoidberg@mujmail.cz") + + #login_timeout = 60 + + def loadAccountInfo(self, user, req): + html = req.load("http://turbobit.net") + + found = re.search(r'<u>Turbo Access</u> to ([0-9.]+)', html) + if found: + premium = True + validuntil = mktime(strptime(found.group(1), "%d.%m.%Y")) + else: + premium = False + validuntil = -1 + + return {"premium": premium, "trafficleft": -1, "validuntil": validuntil} + + def login(self, user, data, req): + req.cj.setCookie("turbobit.net", "user_lang", "en") + + html = req.load("http://turbobit.net/user/login", post={ + "user[login]": user, + "user[pass]": data["password"], + "user[submit]": "Login"}) + + if not '<div class="menu-item user-name">' in html: + self.wrongPassword()
\ No newline at end of file diff --git a/module/plugins/accounts/UlozTo.py b/module/plugins/accounts/UlozTo.py index 36e1ae342..0c4ecda6a 100644 --- a/module/plugins/accounts/UlozTo.py +++ b/module/plugins/accounts/UlozTo.py @@ -5,28 +5,30 @@ import re class UlozTo(Account): __name__ = "UlozTo" - __version__ = "0.01" + __version__ = "0.03" __type__ = "account" __description__ = """uloz.to account plugin""" __author_name__ = ("zoidberg") __author_mail__ = ("zoidberg@mujmail.cz") - TRAFFIC_LEFT_PATTERN = r'<li class="credit"><a href="/kredit/" class="coins" title="[^"]* GB = ([^"]+) MB">' + TRAFFIC_LEFT_PATTERN = r'<li class="menu-kredit"><a href="/kredit/" title="[^"]*?GB = ([0-9.]+) MB">' def loadAccountInfo(self, user, req): - html = req.load("http://www.uloz.to/statistiky/", decode = True) + #this cookie gets lost somehow after each request + self.phpsessid = req.cj.getCookie("PHPSESSID") + html = req.load("http://www.ulozto.net/", decode = True) + req.cj.setCookie("www.ulozto.net", "PHPSESSID", self.phpsessid) found = re.search(self.TRAFFIC_LEFT_PATTERN, html) trafficleft = int(float(found.group(1).replace(' ','').replace(',','.')) * 1000 / 1.024) if found else 0 - self.premium = True if trafficleft else False + self.premium = True if trafficleft else False return {"validuntil": -1, "trafficleft": trafficleft} def login(self, user, data, req): - html = req.load('http://www.uloz.to/?do=authForm-submit', post = { - "login": "Přihlásit", + html = req.load('http://www.ulozto.net/login?do=loginForm-submit', post = { + "login": "Submit", "password": data['password'], - "trvale": "on", "username": user }, decode = True) diff --git a/module/plugins/accounts/UploadedTo.py b/module/plugins/accounts/UploadedTo.py index b4d194396..e10b93e8d 100644 --- a/module/plugins/accounts/UploadedTo.py +++ b/module/plugins/accounts/UploadedTo.py @@ -23,18 +23,18 @@ from time import time class UploadedTo(Account): __name__ = "UploadedTo" - __version__ = "0.21" + __version__ = "0.23" __type__ = "account" - __description__ = """ul.to account plugin""" + __description__ = """ul.net account plugin""" __author_name__ = ("mkaay") __author_mail__ = ("mkaay@mkaay.de") def loadAccountInfo(self, user, req): - req.load("http://uploaded.to/language/en") - html = req.load("http://uploaded.to/me") + req.load("http://uploaded.net/language/en") + html = req.load("http://uploaded.net/me") - premium = '<a href="me#premium"><em>Premium</em>' in html or '<em>Premium</em></th>' in html + premium = '<a href="register"><em>Premium</em>' in html or '<em>Premium</em></th>' in html if premium: raw_traffic = re.search(r'<th colspan="2"><b class="cB">([^<]+)', html).group(1) @@ -56,10 +56,10 @@ class UploadedTo(Account): def login(self, user, data, req): - req.load("http://uploaded.to/language/en") - req.cj.setCookie("uploaded.to", "lang", "en") + req.load("http://uploaded.net/language/en") + req.cj.setCookie("uploaded.net", "lang", "en") - page = req.load("http://uploaded.to/io/login", post={ "id" : user, "pw" : data["password"], "_" : ""}) + page = req.load("http://uploaded.net/io/login", post={ "id" : user, "pw" : data["password"], "_" : ""}) if "User and password do not match!" in page: self.wrongPassword() diff --git a/module/plugins/accounts/UploadheroCom.py b/module/plugins/accounts/UploadheroCom.py new file mode 100644 index 000000000..f1e0649e6 --- /dev/null +++ b/module/plugins/accounts/UploadheroCom.py @@ -0,0 +1,35 @@ +#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+from module.plugins.Account import Account
+import re,datetime,time
+
+class UploadheroCom(Account):
+ __name__ = "UploadheroCom"
+ __version__ = "0.1"
+ __type__ = "account"
+ __description__ = """Uploadhero.com account plugin"""
+ __author_name__ = ("mcmyst")
+ __author_mail__ = ("mcmyst@hotmail.fr")
+
+
+ def loadAccountInfo(self, user, req):
+ premium_pattern = re.compile('Il vous reste <span class="bleu">([0-9]+)</span> jours premium.')
+
+ data = self.getAccountData(user)
+ page = req.load("http://uploadhero.com/my-account")
+
+ if premium_pattern.search(page):
+ end_date = datetime.date.today() + datetime.timedelta(days=int(premium_pattern.search(page).group(1)))
+ end_date = time.mktime(future.timetuple())
+ account_info = {"validuntil": end_date, "trafficleft": -1, "premium": True}
+ else:
+ account_info = {"validuntil": -1, "trafficleft": -1, "premium": False}
+
+ return account_info
+
+ def login(self, user, data, req):
+ page = req.load("http://uploadhero.com/lib/connexion.php", post={"pseudo_login": user, "password_login": data["password"]})
+
+ if "mot de passe invalide" in page:
+ self.wrongPassword()
\ No newline at end of file diff --git a/module/plugins/accounts/UploadstationCom.py b/module/plugins/accounts/UploadstationCom.py new file mode 100644 index 000000000..e86cec7ce --- /dev/null +++ b/module/plugins/accounts/UploadstationCom.py @@ -0,0 +1,13 @@ +# -*- coding: utf-8 -*- + +from module.plugins.accounts.FilejungleCom import FilejungleCom + +class UploadstationCom(FilejungleCom): + __name__ = "UploadstationCom" + __version__ = "0.1" + __type__ = "account" + __description__ = """uploadstation.com account plugin""" + __author_name__ = ("zoidberg") + __author_mail__ = ("zoidberg@mujmail.cz") + + URL = "http://uploadstation.com/" diff --git a/module/plugins/accounts/WarserverCz.py b/module/plugins/accounts/WarserverCz.py new file mode 100644 index 000000000..b3cafdb5f --- /dev/null +++ b/module/plugins/accounts/WarserverCz.py @@ -0,0 +1,33 @@ +# -*- coding: utf-8 -*- + +""" + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, + or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, see <http://www.gnu.org/licenses/>. + + @author: zoidberg +""" + +from module.plugins.accounts.CoolshareCz import CoolshareCz +import re +from module.utils import parseFileSize +from time import mktime, strptime + +class WarserverCz(CoolshareCz): + __name__ = "WarserverCz" + __version__ = "0.01" + __type__ = "account" + __description__ = """Warserver.cz account plugin""" + __author_name__ = ("zoidberg") + __author_mail__ = ("zoidberg@mujmail.cz") + + DOMAIN = "http://www.warserver.cz"
\ No newline at end of file diff --git a/module/plugins/accounts/YibaishiwuCom.py b/module/plugins/accounts/YibaishiwuCom.py new file mode 100644 index 000000000..e2aa6f11d --- /dev/null +++ b/module/plugins/accounts/YibaishiwuCom.py @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- + +""" + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, + or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, see <http://www.gnu.org/licenses/>. + + @author: zoidberg +""" + +from module.plugins.Account import Account +import re + +class YibaishiwuCom(Account): + __name__ = "YibaishiwuCom" + __version__ = "0.01" + __type__ = "account" + __description__ = """115.com account plugin""" + __author_name__ = ("zoidberg") + __author_mail__ = ("zoidberg@mujmail.cz") + + ACCOUNT_INFO_PATTERN = r'var USER_PERMISSION = {(.*?)}' + + def loadAccountInfo(self, user, req): + #self.relogin(user) + html = req.load("http://115.com/", decode = True) + + found = re.search(self.ACCOUNT_INFO_PATTERN, html, re.S) + premium = True if (found and 'is_vip: 1' in found.group(1)) else False + validuntil = trafficleft = (-1 if found else 0) + return dict({"validuntil": validuntil, "trafficleft": trafficleft, "premium": premium}) + + def login(self, user, data, req): + html = req.load('http://passport.115.com/?ac=login', post = { + "back": "http://www.115.com/", + "goto": "http://115.com/", + "login[account]": user, + "login[passwd]": data['password'] + }, decode = True) + + if not 'var USER_PERMISSION = {' in html: + self.wrongPassword()
\ No newline at end of file diff --git a/module/plugins/accounts/ZeveraCom.py b/module/plugins/accounts/ZeveraCom.py index 26eac64b6..61a66cd89 100644 --- a/module/plugins/accounts/ZeveraCom.py +++ b/module/plugins/accounts/ZeveraCom.py @@ -1,105 +1,49 @@ -# -*- 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 +# -*- coding: utf-8 -*- +from module.plugins.Account import Account + +import re +from time import mktime, strptime + +class ZeveraCom(Account): + __name__ = "ZeveraCom" + __version__ = "0.21" + __type__ = "account" + __description__ = """Zevera.com account plugin""" + __author_name__ = ("zoidberg") + __author_mail__ = ("zoidberg@mujmail.cz") + + def loadAccountInfo(self, user, req): + data = self.getAPIData(req) + if data == "No traffic": + account_info = {"trafficleft": 0, "validuntil": 0, "premium": False} + else: + account_info = { + "trafficleft": int(data['availabletodaytraffic']) * 1024, + "validuntil": mktime(strptime(data['endsubscriptiondate'],"%Y/%m/%d %H:%M:%S")), + "premium": True + } + return account_info + + def login(self, user, data, req): + self.loginname = user + self.password = data["password"] + if self.getAPIData(req) == "No traffic": + self.wrongPassword() + + def getAPIData(self, req, just_header = False, **kwargs): + get_data = { + 'cmd': 'accountinfo', + 'login': self.loginname, + 'pass': self.password + } + get_data.update(kwargs) + + response = req.load("http://www.zevera.com/jDownloader.ashx", get = get_data, decode = True, just_header = just_header) + self.logDebug(response) + + if ':' in response: + if not just_header: + response = response.replace(',','\n') + return dict((y.strip().lower(), z.strip()) for (y,z) in [x.split(':',1) for x in response.splitlines() if ':' in x]) + else: + return response
\ No newline at end of file |