diff options
Diffstat (limited to 'module/plugins')
219 files changed, 2035 insertions, 1946 deletions
diff --git a/module/plugins/accounts/AlldebridCom.py b/module/plugins/accounts/AlldebridCom.py index 278f3af06..1f2371e28 100644 --- a/module/plugins/accounts/AlldebridCom.py +++ b/module/plugins/accounts/AlldebridCom.py @@ -13,7 +13,7 @@ from module.plugins.Account import Account class AlldebridCom(Account): __name__ = "AlldebridCom" __type__ = "account" - __version__ = "0.22" + __version__ = "0.23" __description__ = """AllDebrid.com account plugin""" __license__ = "GPLv3" @@ -55,7 +55,8 @@ class AlldebridCom(Account): html = req.load("http://www.alldebrid.com/register/", get={'action' : "login", 'login_login' : user, - 'login_password': data['password']}) + 'login_password': data['password']}, + decode=True) if "This login doesn't exist" in html \ or "The password is not valid" in html \ diff --git a/module/plugins/accounts/BackinNet.py b/module/plugins/accounts/BackinNet.py new file mode 100644 index 000000000..46c8d7ac5 --- /dev/null +++ b/module/plugins/accounts/BackinNet.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- + +from module.plugins.internal.XFSAccount import XFSAccount + + +class BackinNet(XFSAccount): + __name__ = "BackinNet" + __type__ = "account" + __version__ = "0.01" + + __description__ = """Backin.net account plugin""" + __license__ = "GPLv3" + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] + + + HOSTER_DOMAIN = "backin.net" diff --git a/module/plugins/accounts/BitshareCom.py b/module/plugins/accounts/BitshareCom.py index 960ff6c3c..412aae534 100644 --- a/module/plugins/accounts/BitshareCom.py +++ b/module/plugins/accounts/BitshareCom.py @@ -6,7 +6,7 @@ from module.plugins.Account import Account class BitshareCom(Account): __name__ = "BitshareCom" __type__ = "account" - __version__ = "0.12" + __version__ = "0.13" __description__ = """Bitshare account plugin""" __license__ = "GPLv3" @@ -27,7 +27,9 @@ class BitshareCom(Account): def login(self, user, data, req): html = req.load("http://bitshare.com/login.html", - post={"user": user, "password": data['password'], "submit": "Login"}, cookies=True) + post={"user": user, "password": data['password'], "submit": "Login"}, + cookies=True, + decode=True) if "login" in req.lastEffectiveURL: self.wrongPassword() diff --git a/module/plugins/accounts/CatShareNet.py b/module/plugins/accounts/CatShareNet.py index c33219685..bcb14bee3 100644 --- a/module/plugins/accounts/CatShareNet.py +++ b/module/plugins/accounts/CatShareNet.py @@ -10,7 +10,7 @@ from module.plugins.Account import Account class CatShareNet(Account): __name__ = "CatShareNet" __type__ = "account" - __version__ = "0.01" + __version__ = "0.02" __description__ = """CatShareNet account plugin""" __license__ = "GPLv3" @@ -50,7 +50,8 @@ class CatShareNet(Account): post={'user_email': user, 'user_password': data['password'], 'remindPassword': 0, - 'user[submit]': "Login"}) + 'user[submit]': "Login"}, + decode=True) if not '<a href="/logout">Wyloguj</a>' in html: self.wrongPassword() diff --git a/module/plugins/accounts/CloudzillaTo.py b/module/plugins/accounts/CloudzillaTo.py index f0676f42f..d22d5e4b3 100644 --- a/module/plugins/accounts/CloudzillaTo.py +++ b/module/plugins/accounts/CloudzillaTo.py @@ -8,7 +8,7 @@ from module.plugins.Account import Account class CloudzillaTo(Account): __name__ = "CloudzillaTo" __type__ = "account" - __version__ = "0.01" + __version__ = "0.02" __description__ = """Cloudzilla.to account plugin""" __license__ = "GPLv3" @@ -30,7 +30,8 @@ class CloudzillaTo(Account): html = req.load("http://www.cloudzilla.to/", post={'lusername': user, 'lpassword': data['password'], - 'w' : "dologin"}) + 'w' : "dologin"}, + decode=True) if "ERROR" in html: self.wrongPassword() diff --git a/module/plugins/accounts/CzshareCom.py b/module/plugins/accounts/CzshareCom.py index 414883228..f84bc67f3 100644 --- a/module/plugins/accounts/CzshareCom.py +++ b/module/plugins/accounts/CzshareCom.py @@ -9,7 +9,7 @@ from module.plugins.Account import Account class CzshareCom(Account): __name__ = "CzshareCom" __type__ = "account" - __version__ = "0.15" + __version__ = "0.16" __description__ = """Czshare.com account plugin, now Sdilej.cz""" __license__ = "GPLv3" @@ -33,11 +33,11 @@ class CzshareCom(Account): def login(self, user, data, req): - html = req.load('https://sdilej.cz/index.php', post={ - "Prihlasit": "Prihlasit", - "login-password": data['password'], - "login-name": user - }) + html = req.load('https://sdilej.cz/index.php', + post={"Prihlasit": "Prihlasit", + "login-password": data['password'], + "login-name": user}, + decode=True) if '<div class="login' in html: self.wrongPassword() diff --git a/module/plugins/accounts/DebridItaliaCom.py b/module/plugins/accounts/DebridItaliaCom.py index 878153fbf..50f9aea27 100644 --- a/module/plugins/accounts/DebridItaliaCom.py +++ b/module/plugins/accounts/DebridItaliaCom.py @@ -10,7 +10,7 @@ from module.plugins.Account import Account class DebridItaliaCom(Account): __name__ = "DebridItaliaCom" __type__ = "account" - __version__ = "0.12" + __version__ = "0.13" __description__ = """Debriditalia.com account plugin""" __license__ = "GPLv3" @@ -38,7 +38,8 @@ class DebridItaliaCom(Account): def login(self, user, data, req): html = req.load("http://debriditalia.com/login.php", - get={'u': user, 'p': data['password']}) + get={'u': user, 'p': data['password']}, + decode=True) if 'NO' in html: self.wrongPassword() diff --git a/module/plugins/accounts/DepositfilesCom.py b/module/plugins/accounts/DepositfilesCom.py index ec23f7a51..dfe430276 100644 --- a/module/plugins/accounts/DepositfilesCom.py +++ b/module/plugins/accounts/DepositfilesCom.py @@ -10,7 +10,7 @@ from module.plugins.Account import Account class DepositfilesCom(Account): __name__ = "DepositfilesCom" __type__ = "account" - __version__ = "0.31" + __version__ = "0.32" __description__ = """Depositfiles.com account plugin""" __license__ = "GPLv3" @@ -30,6 +30,8 @@ class DepositfilesCom(Account): def login(self, user, data, req): html = req.load("https://dfiles.eu/de/login.php", get={"return": "/de/gold/payment.php"}, - post={"login": user, "password": data['password']}) + post={"login": user, "password": data['password']}, + decode=True) + if r'<div class="error_message">Sie haben eine falsche Benutzername-Passwort-Kombination verwendet.</div>' in html: self.wrongPassword() diff --git a/module/plugins/accounts/EuroshareEu.py b/module/plugins/accounts/EuroshareEu.py index c75f8ee33..f92a4e821 100644 --- a/module/plugins/accounts/EuroshareEu.py +++ b/module/plugins/accounts/EuroshareEu.py @@ -9,7 +9,7 @@ from module.plugins.Account import Account class EuroshareEu(Account): __name__ = "EuroshareEu" __type__ = "account" - __version__ = "0.01" + __version__ = "0.02" __description__ = """Euroshare.eu account plugin""" __license__ = "GPLv3" @@ -31,11 +31,11 @@ class EuroshareEu(Account): def login(self, user, data, req): - html = req.load('http://euroshare.eu/customer-zone/login/', post={ - "trvale": "1", - "login": user, - "password": data['password'] - }, decode=True) + html = req.load('http://euroshare.eu/customer-zone/login/', + post={"trvale": "1", + "login": user, + "password": data['password']}, + decode=True) if u">Nesprávne prihlasovacie meno alebo heslo" in html: self.wrongPassword() diff --git a/module/plugins/accounts/FastixRu.py b/module/plugins/accounts/FastixRu.py index d33d611c9..51be3880f 100644 --- a/module/plugins/accounts/FastixRu.py +++ b/module/plugins/accounts/FastixRu.py @@ -7,7 +7,7 @@ from module.common.json_layer import json_loads class FastixRu(Account): __name__ = "FastixRu" __type__ = "account" - __version__ = "0.02" + __version__ = "0.03" __description__ = """Fastix account plugin""" __license__ = "GPLv3" @@ -31,8 +31,11 @@ class FastixRu(Account): def login(self, user, data, req): html = req.load("http://fastix.ru/api_v2/", get={'sub': "get_apikey", 'email': user, 'password': data['password']}) + api = json_loads(html) api = api['apikey'] + data['api'] = api + if "error_code" in html: self.wrongPassword() diff --git a/module/plugins/accounts/File4safeCom.py b/module/plugins/accounts/File4safeCom.py index 20053d895..50fe1aac8 100644 --- a/module/plugins/accounts/File4safeCom.py +++ b/module/plugins/accounts/File4safeCom.py @@ -3,12 +3,12 @@ from module.plugins.internal.XFSAccount import XFSAccount -class File4safeCom(XFSAccount): - __name__ = "File4safeCom" +class File4SafeCom(XFSAccount): + __name__ = "File4SafeCom" __type__ = "account" - __version__ = "0.04" + __version__ = "0.05" - __description__ = """File4safe.com account plugin""" + __description__ = """File4Safe.com account plugin""" __license__ = "GPLv3" __authors__ = [("stickell", "l.stickell@yahoo.it")] diff --git a/module/plugins/accounts/FilecloudIo.py b/module/plugins/accounts/FilecloudIo.py index d20f756f3..8ca55b1bc 100644 --- a/module/plugins/accounts/FilecloudIo.py +++ b/module/plugins/accounts/FilecloudIo.py @@ -7,7 +7,7 @@ from module.common.json_layer import json_loads class FilecloudIo(Account): __name__ = "FilecloudIo" __type__ = "account" - __version__ = "0.03" + __version__ = "0.04" __description__ = """FilecloudIo account plugin""" __license__ = "GPLv3" @@ -19,7 +19,7 @@ class FilecloudIo(Account): # It looks like the first API request always fails, so we retry 5 times, it should work on the second try for _i in xrange(5): rep = req.load("https://secure.filecloud.io/api-fetch_apikey.api", - post={"username": user, "password": self.accounts[user]['password']}) + post={"username": user, "password": self.getAccountData(user)['password']}) rep = json_loads(rep) if rep['status'] == 'ok': break @@ -55,5 +55,5 @@ class FilecloudIo(Account): 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 = {} + if "you have successfully logged in" not in html: + self.wrongPassword() diff --git a/module/plugins/accounts/FilefactoryCom.py b/module/plugins/accounts/FilefactoryCom.py index 8394c549e..426d572db 100644 --- a/module/plugins/accounts/FilefactoryCom.py +++ b/module/plugins/accounts/FilefactoryCom.py @@ -11,7 +11,7 @@ from module.plugins.Account import Account class FilefactoryCom(Account): __name__ = "FilefactoryCom" __type__ = "account" - __version__ = "0.14" + __version__ = "0.15" __description__ = """Filefactory.com account plugin""" __license__ = "GPLv3" @@ -40,10 +40,10 @@ class FilefactoryCom(Account): def login(self, user, data, req): req.http.c.setopt(REFERER, "http://www.filefactory.com/member/login.php") - html = req.load("http://www.filefactory.com/member/signin.php", post={ - "loginEmail": user, - "loginPassword": data['password'], - "Submit": "Sign In"}) + html = req.load("http://www.filefactory.com/member/signin.php", + post={"loginEmail" : user, + "loginPassword": data['password'], + "Submit" : "Sign In"}) if req.lastEffectiveURL != "http://www.filefactory.com/account/": self.wrongPassword() diff --git a/module/plugins/accounts/FilejungleCom.py b/module/plugins/accounts/FilejungleCom.py index a3ec7af64..9f7474207 100644 --- a/module/plugins/accounts/FilejungleCom.py +++ b/module/plugins/accounts/FilejungleCom.py @@ -9,7 +9,7 @@ from module.plugins.Account import Account class FilejungleCom(Account): __name__ = "FilejungleCom" __type__ = "account" - __version__ = "0.11" + __version__ = "0.12" __description__ = """Filejungle.com account plugin""" __license__ = "GPLv3" @@ -37,13 +37,14 @@ class FilejungleCom(Account): 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": ""}) + html = req.load(self.URL + "login.php", + post={"loginUserName": user, + "loginUserPassword": data['password'], + "loginFormSubmit": "Login", + "recaptcha_challenge_field": "", + "recaptcha_response_field": "", + "recaptcha_shortencode_field": ""}, + decode=True) if re.search(self.LOGIN_FAILED_PATTERN, html): self.wrongPassword() diff --git a/module/plugins/accounts/FilerNet.py b/module/plugins/accounts/FilerNet.py index a845e7ba4..4067445af 100644 --- a/module/plugins/accounts/FilerNet.py +++ b/module/plugins/accounts/FilerNet.py @@ -9,7 +9,7 @@ from module.plugins.Account import Account class FilerNet(Account): __name__ = "FilerNet" __type__ = "account" - __version__ = "0.03" + __version__ = "0.04" __description__ = """Filer.net account plugin""" __license__ = "GPLv3" @@ -44,9 +44,16 @@ class FilerNet(Account): def login(self, user, data, req): html = req.load("https://filer.net/login") + token = re.search(self.TOKEN_PATTERN, html).group(1) + html = req.load("https://filer.net/login_check", - post={"_username": user, "_password": data['password'], - "_remember_me": "on", "_csrf_token": token, "_target_path": "https://filer.net/"}) + post={"_username": user, + "_password": data['password'], + "_remember_me": "on", + "_csrf_token": token, + "_target_path": "https://filer.net/"}, + decode=True) + if 'Logout' not in html: self.wrongPassword() diff --git a/module/plugins/accounts/FilesMailRu.py b/module/plugins/accounts/FilesMailRu.py index f91f4d5ba..15926589e 100644 --- a/module/plugins/accounts/FilesMailRu.py +++ b/module/plugins/accounts/FilesMailRu.py @@ -6,7 +6,7 @@ from module.plugins.Account import Account class FilesMailRu(Account): __name__ = "FilesMailRu" __type__ = "account" - __version__ = "0.10" + __version__ = "0.11" __description__ = """Filesmail.ru account plugin""" __license__ = "GPLv3" @@ -20,9 +20,13 @@ class FilesMailRu(Account): def login(self, user, data, req): user, domain = user.split("@") - html = req.load("http://swa.mail.ru/cgi-bin/auth", None, - {"Domain": domain, "Login": user, "Password": data['password'], - "Page": "http://files.mail.ru/"}, cookies=True) + html = req.load("http://swa.mail.ru/cgi-bin/auth", + post={"Domain": domain, + "Login": user, + "Password": data['password'], + "Page": "http://files.mail.ru/"}, + cookies=True, + decode=True) - if "Неверное имя пользователя или пароль" in html: # @TODO seems not to work + if "Неверное имя пользователя или пароль" in html: self.wrongPassword() diff --git a/module/plugins/accounts/FourSharedCom.py b/module/plugins/accounts/FourSharedCom.py index ec19f83f5..2777a142a 100644 --- a/module/plugins/accounts/FourSharedCom.py +++ b/module/plugins/accounts/FourSharedCom.py @@ -1,13 +1,12 @@ # -*- coding: utf-8 -*- -from module.common.json_layer import json_loads from module.plugins.Account import Account class FourSharedCom(Account): __name__ = "FourSharedCom" __type__ = "account" - __version__ = "0.03" + __version__ = "0.04" __description__ = """FourShared.com account plugin""" __license__ = "GPLv3" @@ -22,12 +21,14 @@ class FourSharedCom(Account): def login(self, user, data, req): req.cj.setCookie("4shared.com", "4langcookie", "en") - res = req.load('http://www.4shared.com/web/login', - post={'login': user, - 'password': data['password'], - 'remember': "on", + + res = req.load("http://www.4shared.com/web/login", + post={'login' : user, + 'password' : data['password'], + 'remember' : "on", '_remember': "on", - 'returnTo': "http://www.4shared.com/account/home.jsp"}) + 'returnTo' : "http://www.4shared.com/account/home.jsp"}, + decode=True) if 'Please log in to access your 4shared account' in res: self.wrongPassword() diff --git a/module/plugins/accounts/FreakshareCom.py b/module/plugins/accounts/FreakshareCom.py index 576d835e2..83f4a9a84 100644 --- a/module/plugins/accounts/FreakshareCom.py +++ b/module/plugins/accounts/FreakshareCom.py @@ -10,7 +10,7 @@ from module.plugins.Account import Account class FreakshareCom(Account): __name__ = "FreakshareCom" __type__ = "account" - __version__ = "0.12" + __version__ = "0.13" __description__ = """Freakshare.com account plugin""" __license__ = "GPLv3" @@ -44,8 +44,10 @@ class FreakshareCom(Account): def login(self, user, data, req): req.load("http://freakshare.com/index.php?language=EN") - html = req.load("http://freakshare.com/login.html", None, - {"submit": "Login", "user": user, "pass": data['password']}, cookies=True) + html = req.load("http://freakshare.com/login.html", + post={"submit": "Login", "user": user, "pass": data['password']}, + cookies=True, + decode=True) if ">Wrong Username or Password" in html: self.wrongPassword() diff --git a/module/plugins/accounts/FreeWayMe.py b/module/plugins/accounts/FreeWayMe.py index 3b9841630..14b9f1e9a 100644 --- a/module/plugins/accounts/FreeWayMe.py +++ b/module/plugins/accounts/FreeWayMe.py @@ -7,7 +7,7 @@ from module.common.json_layer import json_loads class FreeWayMe(Account): __name__ = "FreeWayMe" __type__ = "account" - __version__ = "0.12" + __version__ = "0.13" __description__ = """FreeWayMe account plugin""" __license__ = "GPLv3" @@ -16,8 +16,7 @@ class FreeWayMe(Account): def loadAccountInfo(self, user, req): status = self.getAccountStatus(user, req) - if not status: - return False + self.logDebug(status) account_info = {"validuntil": -1, "premium": False} @@ -33,10 +32,6 @@ class FreeWayMe(Account): return account_info - def getpw(self, user): - return self.accounts[user]['password'] - - def login(self, user, data, req): status = self.getAccountStatus(user, req) @@ -47,9 +42,11 @@ class FreeWayMe(Account): def getAccountStatus(self, user, req): answer = req.load("https://www.free-way.me/ajax/jd.php", - get={"id": 4, "user": user, "pass": self.accounts[user]['password']}) + get={"id": 4, "user": user, "pass": self.getAccountData(user)['password']}) + self.logDebug("Login: %s" % answer) + if answer == "Invalid login": self.wrongPassword() - return False + return json_loads(answer) diff --git a/module/plugins/accounts/FshareVn.py b/module/plugins/accounts/FshareVn.py index 2da45aac6..66d912958 100644 --- a/module/plugins/accounts/FshareVn.py +++ b/module/plugins/accounts/FshareVn.py @@ -1,16 +1,16 @@ # -*- coding: utf-8 -*- -from time import mktime, strptime -from pycurl import REFERER import re +from time import mktime, strptime + from module.plugins.Account import Account class FshareVn(Account): __name__ = "FshareVn" __type__ = "account" - __version__ = "0.08" + __version__ = "0.09" __description__ = """Fshare.vn account plugin""" __license__ = "GPLv3" @@ -46,13 +46,13 @@ class FshareVn(Account): def login(self, user, data, req): - req.http.c.setopt(REFERER, "https://www.fshare.vn/login.php") - - html = req.load('https://www.fshare.vn/login.php', post={ - "login_password": data['password'], - "login_useremail": user, - "url_refe": "http://www.fshare.vn/index.php" - }, referer=True, decode=True) + html = req.load("https://www.fshare.vn/login.php", + post={'LoginForm[email]' : user, + 'LoginForm[password]' : data['password'], + 'LoginForm[rememberMe]': 1, + 'yt0' : "Login"}, + referer=True, + decode=True) if not re.search(r'<img\s+alt="VIP"', html): self.wrongPassword() diff --git a/module/plugins/accounts/HellshareCz.py b/module/plugins/accounts/HellshareCz.py index dff2fe394..e559b28e1 100644 --- a/module/plugins/accounts/HellshareCz.py +++ b/module/plugins/accounts/HellshareCz.py @@ -9,7 +9,7 @@ from module.plugins.Account import Account class HellshareCz(Account): __name__ = "HellshareCz" __type__ = "account" - __version__ = "0.15" + __version__ = "0.16" __description__ = """Hellshare.cz account plugin""" __license__ = "GPLv3" @@ -52,25 +52,28 @@ class HellshareCz(Account): def login(self, user, data, req): - html = req.load('http://www.hellshare.com/') + html = req.load('http://www.hellshare.com/', decode=True) if req.lastEffectiveURL != 'http://www.hellshare.com/': #Switch to English self.logDebug("Switch lang - URL: %s" % req.lastEffectiveURL) + json = req.load("%s?do=locRouter-show" % req.lastEffectiveURL) hash = re.search(r"(\-\-[0-9a-f]+\-)", json).group(1) + self.logDebug("Switch lang - HASH: %s" % hash) - html = req.load('http://www.hellshare.com/%s/' % hash) + + html = req.load('http://www.hellshare.com/%s/' % hash, decode=True) if re.search(self.CREDIT_LEFT_PATTERN, html): self.logDebug("Already logged in") return - html = req.load('http://www.hellshare.com/login?do=loginForm-submit', post={ - "login": "Log in", - "password": data['password'], - "username": user, - "perm_login": "on" - }) + html = req.load('http://www.hellshare.com/login?do=loginForm-submit', + post={"login": "Log in", + "password": data['password'], + "username": user, + "perm_login": "on"}, + decode=True) if "<p>You input a wrong user name or wrong password</p>" in html: self.wrongPassword() diff --git a/module/plugins/accounts/HundredEightyUploadCom.py b/module/plugins/accounts/HundredEightyUploadCom.py index 39f91a8af..319a3feee 100644 --- a/module/plugins/accounts/HundredEightyUploadCom.py +++ b/module/plugins/accounts/HundredEightyUploadCom.py @@ -6,7 +6,7 @@ from module.plugins.internal.XFSAccount import XFSAccount class HundredEightyUploadCom(XFSAccount): __name__ = "HundredEightyUploadCom" __type__ = "account" - __version__ = "0.02" + __version__ = "0.03" __description__ = """180upload.com account plugin""" __license__ = "GPLv3" diff --git a/module/plugins/accounts/Keep2shareCc.py b/module/plugins/accounts/Keep2shareCc.py index fac3cc4a6..e855fb977 100644 --- a/module/plugins/accounts/Keep2shareCc.py +++ b/module/plugins/accounts/Keep2shareCc.py @@ -7,12 +7,12 @@ from time import gmtime, mktime, strptime from module.plugins.Account import Account -class Keep2shareCc(Account): - __name__ = "Keep2shareCc" +class Keep2ShareCc(Account): + __name__ = "Keep2ShareCc" __type__ = "account" - __version__ = "0.03" + __version__ = "0.04" - __description__ = """Keep2share.cc account plugin""" + __description__ = """Keep2Share.cc account plugin""" __license__ = "GPLv3" __authors__ = [("aeronaut", "aeronaut@pianoguy.de")] @@ -35,18 +35,22 @@ class Keep2shareCc(Account): expiredate = m.group(1).strip() self.logDebug("Expire date: " + expiredate) - try: - validuntil = mktime(strptime(expiredate, "%Y.%m.%d")) + if expiredate == "LifeTime": + premium = True + validuntil = -1 + else: + try: + validuntil = mktime(strptime(expiredate, "%Y.%m.%d")) - except Exception, e: - self.logError(e) + except Exception, e: + self.logError(e) - else: - if validuntil > mktime(gmtime()): - premium = True else: - premium = False - validuntil = None + if validuntil > mktime(gmtime()): + premium = True + else: + premium = False + validuntil = None m = re.search(self.TRAFFIC_LEFT_PATTERN, html) if m: @@ -66,7 +70,8 @@ class Keep2shareCc(Account): post={'LoginForm[username]' : user, 'LoginForm[password]' : data['password'], 'LoginForm[rememberMe]': 1, - 'yt0' : ""}) + 'yt0' : ""}, + decode=True) if re.search(self.LOGIN_FAIL_PATTERN, html): self.wrongPassword() diff --git a/module/plugins/accounts/LetitbitNet.py b/module/plugins/accounts/LetitbitNet.py index b8244a06d..7f973d2d3 100644 --- a/module/plugins/accounts/LetitbitNet.py +++ b/module/plugins/accounts/LetitbitNet.py @@ -7,7 +7,7 @@ from module.plugins.Account import Account class LetitbitNet(Account): __name__ = "LetitbitNet" __type__ = "account" - __version__ = "0.01" + __version__ = "0.02" __description__ = """Letitbit.net account plugin""" __license__ = "GPLv3" @@ -16,7 +16,7 @@ class LetitbitNet(Account): def loadAccountInfo(self, user, req): ## DISABLED BECAUSE IT GET 'key exausted' EVEN IF VALID ## - # api_key = self.accounts[user]['password'] + # api_key = self.getAccountData(user)['password'] # json_data = [api_key, ['key/info']] # api_rep = req.load('http://api.letitbit.net/json', post={'r': json_dumps(json_data)}) # self.logDebug("API Key Info: " + api_rep) diff --git a/module/plugins/accounts/LinksnappyCom.py b/module/plugins/accounts/LinksnappyCom.py index 19986157b..dff28a055 100644 --- a/module/plugins/accounts/LinksnappyCom.py +++ b/module/plugins/accounts/LinksnappyCom.py @@ -9,7 +9,7 @@ from module.common.json_layer import json_loads class LinksnappyCom(Account): __name__ = "LinksnappyCom" __type__ = "account" - __version__ = "0.03" + __version__ = "0.04" __description__ = """Linksnappy.com account plugin""" __license__ = "GPLv3" @@ -20,17 +20,22 @@ class LinksnappyCom(Account): data = self.getAccountData(user) r = req.load('http://gen.linksnappy.com/lseAPI.php', get={'act': 'USERDETAILS', 'username': user, 'password': md5(data['password']).hexdigest()}) + self.logDebug("JSON data: " + r) + j = json_loads(r) if j['error']: return {"premium": False} validuntil = j['return']['expire'] + if validuntil == 'lifetime': validuntil = -1 + elif validuntil == 'expired': return {"premium": False} + else: validuntil = float(validuntil) @@ -43,8 +48,11 @@ class LinksnappyCom(Account): def login(self, user, data, req): - r = req.load('http://gen.linksnappy.com/lseAPI.php', - get={'act': 'USERDETAILS', 'username': user, 'password': md5(data['password']).hexdigest()}) + r = req.load("http://gen.linksnappy.com/lseAPI.php", + get={'act' : 'USERDETAILS', + 'username': user, + 'password': md5(data['password']).hexdigest()}, + decode=True) if 'Invalid Account Details' in r: self.wrongPassword() diff --git a/module/plugins/accounts/MegaRapidCz.py b/module/plugins/accounts/MegaRapidCz.py index 41da7ac73..b229fe47d 100644 --- a/module/plugins/accounts/MegaRapidCz.py +++ b/module/plugins/accounts/MegaRapidCz.py @@ -9,7 +9,7 @@ from module.plugins.Account import Account class MegaRapidCz(Account): __name__ = "MegaRapidCz" __type__ = "account" - __version__ = "0.34" + __version__ = "0.35" __description__ = """MegaRapid.cz account plugin""" __license__ = "GPLv3" @@ -25,19 +25,19 @@ class MegaRapidCz(Account): def loadAccountInfo(self, user, req): - html = req.load("http://megarapid.cz/mujucet/", decode=True) + htmll = req.load("http://megarapid.cz/mujucet/", decode=True) - m = re.search(self.LIMITDL_PATTERN, html) + m = re.search(self.LIMITDL_PATTERN, htmll) if m: data = self.getAccountData(user) data['options']['limitDL'] = [int(m.group(1))] - m = re.search(self.VALID_UNTIL_PATTERN, html) + m = re.search(self.VALID_UNTIL_PATTERN, htmll) if m: validuntil = mktime(strptime(m.group(1), "%d.%m.%Y - %H:%M")) return {"premium": True, "trafficleft": -1, "validuntil": validuntil} - m = re.search(self.TRAFFIC_LEFT_PATTERN, html) + m = re.search(self.TRAFFIC_LEFT_PATTERN, htmll) if m: trafficleft = float(m.group(1)) * (1 << 20) return {"premium": True, "trafficleft": trafficleft, "validuntil": -1} @@ -46,12 +46,13 @@ class MegaRapidCz(Account): def login(self, user, data, req): - htm = req.load("http://megarapid.cz/prihlaseni/") - if "Heslo:" in htm: - start = htm.index('id="inp_hash" name="hash" value="') - htm = htm[start + 33:] - hashes = htm[0:32] - htm = req.load("http://megarapid.cz/prihlaseni/", + html = req.load("http://megarapid.cz/prihlaseni/", decode=True) + + if "Heslo:" in html: + start = html.index('id="inp_hash" name="hash" value="') + html = html[start + 33:] + hashes = html[0:32] + html = req.load("http://megarapid.cz/prihlaseni/", post={"hash": hashes, "login": user, "pass1": data['password'], diff --git a/module/plugins/accounts/MegasharesCom.py b/module/plugins/accounts/MegasharesCom.py index 6e0a4358e..127ebadc8 100644 --- a/module/plugins/accounts/MegasharesCom.py +++ b/module/plugins/accounts/MegasharesCom.py @@ -9,7 +9,7 @@ from module.plugins.Account import Account class MegasharesCom(Account): __name__ = "MegasharesCom" __type__ = "account" - __version__ = "0.02" + __version__ = "0.03" __description__ = """Megashares.com account plugin""" __license__ = "GPLv3" @@ -37,12 +37,12 @@ class MegasharesCom(Account): def login(self, user, data, req): - html = req.load('http://d01.megashares.com/myms_login.php', post={ - "httpref": "", - "myms_login": "Login", - "mymslogin_name": user, - "mymspassword": data['password'] - }, decode=True) + html = req.load('http://d01.megashares.com/myms_login.php', + post={"httpref" : "", + "myms_login" : "Login", + "mymslogin_name": user, + "mymspassword" : data['password']}, + decode=True) if not '<span class="b ml">%s</span>' % user in html: self.wrongPassword() diff --git a/module/plugins/accounts/MultihostersCom.py b/module/plugins/accounts/MultihostersCom.py index 3f96fdf41..e98f17b2d 100644 --- a/module/plugins/accounts/MultihostersCom.py +++ b/module/plugins/accounts/MultihostersCom.py @@ -1,50 +1,16 @@ # -*- coding: utf-8 -*- -from time import mktime, strptime -from module.plugins.Account import Account +from module.plugins.accounts.ZeveraCom import ZeveraCom -class MultihostersCom(Account): - __name__ = "MultihostersCom" - __version__ = "0.01" - __type__ = "account" - __description__ = """Multihosters.com account plugin""" - __author_name__ = "tjeh" - __author_mail__ = "tjeh@gmx.net" - - 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() +class MultihostersCom(ZeveraCom): + __name__ = "MultihostersCom" + __type__ = "account" + __version__ = "0.03" - def getAPIData(self, req, just_header=False, **kwargs): - get_data = { - 'cmd': 'accountinfo', - 'login': self.loginname, - 'pass': self.password - } - get_data.update(kwargs) + __description__ = """Multihosters.com account plugin""" + __license__ = "GPLv3" + __authors__ = [("tjeh", "tjeh@gmx.net")] - response = req.load("http://www.multihosters.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 + HOSTER_DOMAIN = "multihosters.com" diff --git a/module/plugins/accounts/MultishareCz.py b/module/plugins/accounts/MultishareCz.py index 878413007..0ac764ee1 100644 --- a/module/plugins/accounts/MultishareCz.py +++ b/module/plugins/accounts/MultishareCz.py @@ -8,7 +8,7 @@ from module.plugins.Account import Account class MultishareCz(Account): __name__ = "MultishareCz" __type__ = "account" - __version__ = "0.04" + __version__ = "0.05" __description__ = """Multishare.cz account plugin""" __license__ = "GPLv3" @@ -34,11 +34,11 @@ class MultishareCz(Account): def login(self, user, data, req): - html = req.load('http://www.multishare.cz/html/prihlaseni_process.php', post={ - "akce": "Přihlásit", - "heslo": data['password'], - "jmeno": user - }, decode=True) + html = req.load('http://www.multishare.cz/html/prihlaseni_process.php', + post={"akce" : "Přihlásit", + "heslo": data['password'], + "jmeno": user}, + decode=True) if '<div class="akce-chyba akce">' in html: self.wrongPassword() diff --git a/module/plugins/accounts/MyfastfileCom.py b/module/plugins/accounts/MyfastfileCom.py index 36923470e..4c75b27f0 100644 --- a/module/plugins/accounts/MyfastfileCom.py +++ b/module/plugins/accounts/MyfastfileCom.py @@ -9,7 +9,7 @@ from module.plugins.Account import Account class MyfastfileCom(Account): __name__ = "MyfastfileCom" __type__ = "account" - __version__ = "0.03" + __version__ = "0.04" __description__ = """Myfastfile.com account plugin""" __license__ = "GPLv3" @@ -27,8 +27,10 @@ class MyfastfileCom(Account): def login(self, user, data, req): # Password to use is the API-Password written in http://myfastfile.com/myaccount html = req.load("http://myfastfile.com/api.php", - get={"user": user, "pass": data['password']}) + get={"user": user, "pass": data['password']}) + self.logDebug("JSON data: " + html) + self.json_data = json_loads(html) if self.json_data['status'] != 'ok': self.logError(_('Invalid login. The password to use is the API-Password you find in your "My Account" page')) diff --git a/module/plugins/accounts/NetloadIn.py b/module/plugins/accounts/NetloadIn.py index 15bad6966..1abd7fa84 100755 --- a/module/plugins/accounts/NetloadIn.py +++ b/module/plugins/accounts/NetloadIn.py @@ -9,7 +9,7 @@ from module.plugins.Account import Account class NetloadIn(Account): __name__ = "NetloadIn" __type__ = "account" - __version__ = "0.22" + __version__ = "0.23" __description__ = """Netload.in account plugin""" __license__ = "GPLv3" @@ -33,8 +33,12 @@ class NetloadIn(Account): def login(self, user, data, req): - html = req.load("http://netload.in/index.php", None, - {"txtuser": user, "txtpass": data['password'], "txtcheck": "login", "txtlogin": "Login"}, - cookies=True) + html = req.load("http://netload.in/index.php", + post={"txtuser" : user, + "txtpass" : data['password'], + "txtcheck": "login", + "txtlogin": "Login"}, + cookies=True, + decode=True) if "password or it might be invalid!" in html: self.wrongPassword() diff --git a/module/plugins/accounts/NowVideoSx.py b/module/plugins/accounts/NowVideoSx.py index e2dcaba12..f44ae3865 100644 --- a/module/plugins/accounts/NowVideoSx.py +++ b/module/plugins/accounts/NowVideoSx.py @@ -10,7 +10,7 @@ from module.plugins.Account import Account class NowVideoSx(Account): __name__ = "NowVideoSx" __type__ = "account" - __version__ = "0.02" + __version__ = "0.03" __description__ = """NowVideo.at account plugin""" __license__ = "GPLv3" @@ -50,7 +50,8 @@ class NowVideoSx(Account): def login(self, user, data, req): html = req.load("http://www.nowvideo.sx/login.php", - post={'user': user, 'pass': data['password']}) + post={'user': user, 'pass': data['password']}, + decode=True) - if ">Invalid login details" is html: + if re.search(r'>Log In<', html): self.wrongPassword() diff --git a/module/plugins/accounts/OboomCom.py b/module/plugins/accounts/OboomCom.py index 4d90e1b25..0acacbb2a 100644 --- a/module/plugins/accounts/OboomCom.py +++ b/module/plugins/accounts/OboomCom.py @@ -11,7 +11,7 @@ from module.plugins.Account import Account class OboomCom(Account): __name__ = "OboomCom" __type__ = "account" - __version__ = "0.22" + __version__ = "0.23" __description__ = """Oboom.com account plugin""" __license__ = "GPLv3" @@ -20,12 +20,15 @@ class OboomCom(Account): def loadAccountData(self, user, req): passwd = self.getAccountData(user)['password'] - salt = passwd[::-1] + salt = passwd[::-1] pbkdf2 = PBKDF2(passwd, salt, 1000).hexread(16) + result = json_loads(req.load("https://www.oboom.com/1/login", get={"auth": user, "pass": pbkdf2})) + if not result[0] == 200: self.logWarning(_("Failed to log in: %s") % result[1]) self.wrongPassword() + return result[1] diff --git a/module/plugins/accounts/OneFichierCom.py b/module/plugins/accounts/OneFichierCom.py index 2f1c914c1..1fc8d994d 100644 --- a/module/plugins/accounts/OneFichierCom.py +++ b/module/plugins/accounts/OneFichierCom.py @@ -12,7 +12,7 @@ from module.plugins.Account import Account class OneFichierCom(Account): __name__ = "OneFichierCom" __type__ = "account" - __version__ = "0.11" + __version__ = "0.12" __description__ = """1fichier.com account plugin""" __license__ = "GPLv3" @@ -49,7 +49,12 @@ class OneFichierCom(Account): req.http.c.setopt(REFERER, "https://1fichier.com/login.pl?lg=en") html = req.load("https://1fichier.com/login.pl?lg=en", - post={'mail': user, 'pass': data['password'], 'It': "on", 'purge': "off", 'valider': "Send"}) + post={'mail' : user, + 'pass' : data['password'], + 'It' : "on", + 'purge' : "off", + 'valider': "Send"}, + decode=True) if '>Invalid email address' in html or '>Invalid password' in html: self.wrongPassword() diff --git a/module/plugins/accounts/OverLoadMe.py b/module/plugins/accounts/OverLoadMe.py index 1fb2a2a10..d59944e63 100644 --- a/module/plugins/accounts/OverLoadMe.py +++ b/module/plugins/accounts/OverLoadMe.py @@ -7,7 +7,7 @@ from module.common.json_layer import json_loads class OverLoadMe(Account): __name__ = "OverLoadMe" __type__ = "account" - __version__ = "0.03" + __version__ = "0.04" __description__ = """Over-Load.me account plugin""" __license__ = "GPLv3" @@ -15,7 +15,7 @@ class OverLoadMe(Account): def loadAccountInfo(self, user, req): - https = "https" if self.getConfig("https") else "http" + https = "https" if self.getConfig("ssl") else "http" data = self.getAccountData(user) html = req.load(https + "://api.over-load.me/account.php", get={'user': user, @@ -32,7 +32,7 @@ class OverLoadMe(Account): def login(self, user, data, req): - https = "https" if self.getConfig("https") else "http" + https = "https" if self.getConfig("ssl") else "http" jsondata = req.load(https + "://api.over-load.me/account.php", get={'user': user, 'auth': data['password']}).strip() diff --git a/module/plugins/accounts/PremiumTo.py b/module/plugins/accounts/PremiumTo.py index 2c486a1dd..c8ea2fa26 100644 --- a/module/plugins/accounts/PremiumTo.py +++ b/module/plugins/accounts/PremiumTo.py @@ -6,7 +6,7 @@ from module.plugins.Account import Account class PremiumTo(Account): __name__ = "PremiumTo" __type__ = "account" - __version__ = "0.06" + __version__ = "0.08" __description__ = """Premium.to account plugin""" __license__ = "GPLv3" @@ -16,11 +16,11 @@ class PremiumTo(Account): def loadAccountInfo(self, user, req): - traffic = req.load("http://premium.to/api/traffic.php", + traffic = req.load("http://premium.to/api/straffic.php", get={'username': self.username, 'password': self.password}) if "wrong username" not in traffic: - trafficleft = float(traffic.strip()) / 1024 #@TODO: Remove `/ 1024` in 0.4.10 + trafficleft = sum(map(float, traffic.split(';'))) / 1024 #@TODO: Remove `/ 1024` in 0.4.10 return {'premium': True, 'trafficleft': trafficleft, 'validuntil': -1} else: return {'premium': False, 'trafficleft': None, 'validuntil': None} @@ -30,7 +30,8 @@ class PremiumTo(Account): self.username = user self.password = data['password'] authcode = req.load("http://premium.to/api/getauthcode.php", - get={'username': user, 'password': self.password}).strip() + get={'username': user, 'password': self.password}, + decode=True) if "wrong username" in authcode: self.wrongPassword() diff --git a/module/plugins/accounts/PremiumizeMe.py b/module/plugins/accounts/PremiumizeMe.py index c1abde309..7d061ec2d 100644 --- a/module/plugins/accounts/PremiumizeMe.py +++ b/module/plugins/accounts/PremiumizeMe.py @@ -8,7 +8,7 @@ from module.common.json_layer import json_loads class PremiumizeMe(Account): __name__ = "PremiumizeMe" __type__ = "account" - __version__ = "0.12" + __version__ = "0.13" __description__ = """Premiumize.me account plugin""" __license__ = "GPLv3" @@ -45,5 +45,5 @@ class PremiumizeMe(Account): answer = req.load("https://api.premiumize.me/pm-api/v1.php", get={'method' : "accountstatus", 'params[login]': user, - 'params[pass]' : self.accounts[user]['password']}) + 'params[pass]' : self.getAccountData(user)['password']}) return json_loads(answer) diff --git a/module/plugins/accounts/PutdriveCom.py b/module/plugins/accounts/PutdriveCom.py new file mode 100644 index 000000000..4f2fadbcc --- /dev/null +++ b/module/plugins/accounts/PutdriveCom.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- + +from module.plugins.accounts.ZeveraCom import ZeveraCom + + +class PutdriveCom(ZeveraCom): + __name__ = "PutdriveCom" + __type__ = "account" + __version__ = "0.02" + + __description__ = """Putdrive.com account plugin""" + __license__ = "GPLv3" + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] + + + HOSTER_DOMAIN = "putdrive.com" diff --git a/module/plugins/accounts/QuickshareCz.py b/module/plugins/accounts/QuickshareCz.py index 18af5f736..16141d63e 100644 --- a/module/plugins/accounts/QuickshareCz.py +++ b/module/plugins/accounts/QuickshareCz.py @@ -8,7 +8,7 @@ from module.plugins.Account import Account class QuickshareCz(Account): __name__ = "QuickshareCz" __type__ = "account" - __version__ = "0.02" + __version__ = "0.03" __description__ = """Quickshare.cz account plugin""" __license__ = "GPLv3" @@ -33,11 +33,11 @@ class QuickshareCz(Account): def login(self, user, data, req): - html = req.load('http://www.quickshare.cz/html/prihlaseni_process.php', post={ - "akce": u'Přihlásit', - "heslo": data['password'], - "jmeno": user - }, decode=True) + html = req.load('http://www.quickshare.cz/html/prihlaseni_process.php', + post={"akce": u'Přihlásit', + "heslo": data['password'], + "jmeno": user}, + decode=True) if u'>Takový uživatel neexistuje.<' in html or u'>Špatné heslo.<' in html: self.wrongPassword() diff --git a/module/plugins/accounts/RPNetBiz.py b/module/plugins/accounts/RPNetBiz.py index 813453c03..829e54a46 100644 --- a/module/plugins/accounts/RPNetBiz.py +++ b/module/plugins/accounts/RPNetBiz.py @@ -7,7 +7,7 @@ from module.common.json_layer import json_loads class RPNetBiz(Account): __name__ = "RPNetBiz" __type__ = "account" - __version__ = "0.11" + __version__ = "0.12" __description__ = """RPNet.biz account plugin""" __license__ = "GPLv3" @@ -44,7 +44,7 @@ class RPNetBiz(Account): def getAccountStatus(self, user, req): # Using the rpnet API, check if valid premium account res = req.load("https://premium.rpnet.biz/client_api.php", - get={"username": user, "password": self.accounts[user]['password'], + get={"username": user, "password": self.getAccountData(user)['password'], "action": "showAccountInformation"}) self.logDebug("JSON data: %s" % res) diff --git a/module/plugins/accounts/RapidgatorNet.py b/module/plugins/accounts/RapidgatorNet.py index 2899d5a68..b29d94228 100644 --- a/module/plugins/accounts/RapidgatorNet.py +++ b/module/plugins/accounts/RapidgatorNet.py @@ -7,7 +7,7 @@ from module.common.json_layer import json_loads class RapidgatorNet(Account): __name__ = "RapidgatorNet" __type__ = "account" - __version__ = "0.05" + __version__ = "0.06" __description__ = """Rapidgator.net account plugin""" __license__ = "GPLv3" @@ -44,7 +44,9 @@ class RapidgatorNet(Account): def login(self, user, data, req): try: json = req.load('%s/login' % self.API_URL, post={"username": user, "password": data['password']}) + self.logDebug("API:LOGIN", json) + json = json_loads(json) if json['response_status'] == 200: @@ -52,6 +54,7 @@ class RapidgatorNet(Account): return else: self.logError(json['response_details']) + except Exception, e: self.logError(e) diff --git a/module/plugins/accounts/RealdebridCom.py b/module/plugins/accounts/RealdebridCom.py index 48b17df5f..41d8a0975 100644 --- a/module/plugins/accounts/RealdebridCom.py +++ b/module/plugins/accounts/RealdebridCom.py @@ -8,7 +8,7 @@ from module.plugins.Account import Account class RealdebridCom(Account): __name__ = "RealdebridCom" __type__ = "account" - __version__ = "0.44" + __version__ = "0.45" __description__ = """Real-Debrid.com account plugin""" __license__ = "GPLv3" @@ -28,9 +28,13 @@ class RealdebridCom(Account): def login(self, user, data, req): self.pin_code = False - html = req.load("https://real-debrid.com/ajax/login.php", get={"user": user, "pass": data['password']}) + html = req.load("https://real-debrid.com/ajax/login.php", + get={"user": user, "pass": data['password']}, + decode=True) + if "Your login informations are incorrect" in html: self.wrongPassword() + elif "PIN Code required" in html: self.logWarning(_("PIN code required. Please login to https://real-debrid.com using the PIN or disable the double authentication in your control panel on https://real-debrid.com")) self.pin_code = True diff --git a/module/plugins/accounts/RehostTo.py b/module/plugins/accounts/RehostTo.py index 00a45dedd..4efe38cad 100644 --- a/module/plugins/accounts/RehostTo.py +++ b/module/plugins/accounts/RehostTo.py @@ -6,7 +6,7 @@ from module.plugins.Account import Account class RehostTo(Account): __name__ = "RehostTo" __type__ = "account" - __version__ = "0.11" + __version__ = "0.15" __description__ = """Rehost.to account plugin""" __license__ = "GPLv3" @@ -14,32 +14,41 @@ class RehostTo(Account): def loadAccountInfo(self, user, req): - data = self.getAccountData(user) + premium = False + trafficleft = None + validuntil = -1 + session = "" + html = req.load("http://rehost.to/api.php", - get={'cmd': "login", 'user': user, 'pass': data['password']}) - data = [x.split("=") for x in html.split(",")] - ses = data[0][1] - long_ses = data[1][1] - - html = req.load("http://rehost.to/api.php", - get={'cmd': "get_premium_credits", 'long_ses': long_ses}) - - traffic, valid = html.split(",") - - trafficleft = self.parseTraffic(traffic + "MB") - validuntil = float(valid) - - account_info = {"trafficleft": trafficleft, - "validuntil" : validuntil, - "long_ses" : long_ses, - "ses" : ses} - - return account_info + get={'cmd' : "login", 'user': user, + 'pass': self.getAccountData(user)['password']}) + try: + session = html.split(",")[1].split("=")[1] + + html = req.load("http://rehost.to/api.php", + get={'cmd': "get_premium_credits", 'long_ses': session}) + + if html.strip() == "0,0" or "ERROR" not in html: + self.logDebug(html) + else: + traffic, valid = html.split(",") + + premium = True + trafficleft = self.parseTraffic(traffic + "MB") + validuntil = float(valid) + + finally: + return {'premium' : premium, + 'trafficleft': trafficleft, + 'validuntil' : validuntil, + 'session' : session} def login(self, user, data, req): html = req.load("http://rehost.to/api.php", - get={'cmd': "login", 'user': user, 'pass': data['password']}) + get={'cmd': "login", 'user': user, 'pass': data['password']}, + decode=True) - if "Login failed." in html: + if "ERROR" in html: + self.logDebug(html) self.wrongPassword() diff --git a/module/plugins/accounts/RyushareCom.py b/module/plugins/accounts/RyushareCom.py index ca476366b..8c56ff20f 100644 --- a/module/plugins/accounts/RyushareCom.py +++ b/module/plugins/accounts/RyushareCom.py @@ -6,20 +6,11 @@ from module.plugins.internal.XFSAccount import XFSAccount class RyushareCom(XFSAccount): __name__ = "RyushareCom" __type__ = "account" - __version__ = "0.05" + __version__ = "0.06" __description__ = """Ryushare.com account plugin""" __license__ = "GPLv3" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), - ("trance4us", None)] + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] HOSTER_DOMAIN = "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() diff --git a/module/plugins/accounts/ShareonlineBiz.py b/module/plugins/accounts/ShareonlineBiz.py index 57fe52385..3ee6e04af 100644 --- a/module/plugins/accounts/ShareonlineBiz.py +++ b/module/plugins/accounts/ShareonlineBiz.py @@ -8,7 +8,7 @@ from module.plugins.Account import Account class ShareonlineBiz(Account): __name__ = "ShareonlineBiz" __type__ = "account" - __version__ = "0.29" + __version__ = "0.30" __description__ = """Share-online.biz account plugin""" __license__ = "GPLv3" @@ -17,7 +17,10 @@ class ShareonlineBiz(Account): def api_response(self, user, req): return req.load("http://api.share-online.biz/cgi-bin", - get={'q': "userdetails", 'aux': "traffic", "username": user, "password": self.accounts[user]['password']}) + get={'q' : "userdetails", + 'aux' : "traffic", + 'username': user, + 'password': self.getAccountData(user)['password']}) def loadAccountInfo(self, user, req): diff --git a/module/plugins/accounts/SimplyPremiumCom.py b/module/plugins/accounts/SimplyPremiumCom.py index 465757457..accb3aba8 100644 --- a/module/plugins/accounts/SimplyPremiumCom.py +++ b/module/plugins/accounts/SimplyPremiumCom.py @@ -7,7 +7,7 @@ from module.plugins.Account import Account class SimplyPremiumCom(Account): __name__ = "SimplyPremiumCom" __type__ = "account" - __version__ = "0.02" + __version__ = "0.03" __description__ = """Simply-Premium.com account plugin""" __license__ = "GPLv3" @@ -42,7 +42,7 @@ class SimplyPremiumCom(Account): else: post_data = {"login_name": user, "login_pass": data['password']} - html = req.load("http://www.simply-premium.com/login.php", post=post_data) + html = req.load("http://www.simply-premium.com/login.php", post=post_data, decode=True) if 'logout' not in html: self.wrongPassword() diff --git a/module/plugins/accounts/SimplydebridCom.py b/module/plugins/accounts/SimplydebridCom.py index 406534364..29be2f73d 100644 --- a/module/plugins/accounts/SimplydebridCom.py +++ b/module/plugins/accounts/SimplydebridCom.py @@ -8,7 +8,7 @@ from module.plugins.Account import Account class SimplydebridCom(Account): __name__ = "SimplydebridCom" __type__ = "account" - __version__ = "0.10" + __version__ = "0.11" __description__ = """Simply-Debrid.com account plugin""" __license__ = "GPLv3" @@ -27,8 +27,9 @@ class SimplydebridCom(Account): def login(self, user, data, req): self.loginname = user - self.password = data['password'] - get_data = {'login': 1, 'u': self.loginname, 'p': self.password} + self.password = data['password'] + get_data = {'login': 1, 'u': self.loginname, 'p': self.password} + res = req.load("http://simply-debrid.com/api.php", get=get_data, decode=True) if res != "02: loggin success": self.wrongPassword() diff --git a/module/plugins/accounts/SmoozedCom.py b/module/plugins/accounts/SmoozedCom.py new file mode 100644 index 000000000..d192f20cf --- /dev/null +++ b/module/plugins/accounts/SmoozedCom.py @@ -0,0 +1,62 @@ +# -*- coding: utf-8 -*- + +import hashlib + +from beaker.crypto.pbkdf2 import PBKDF2 +from time import time + +from module.common.json_layer import json_loads +from module.plugins.Account import Account + + +class SmoozedCom(Account): + __name__ = "SmoozedCom" + __type__ = "account" + __version__ = "0.02" + + __description__ = """Smoozed.com account plugin""" + __license__ = "GPLv3" + __authors__ = [("", "")] + + + def loadAccountInfo(self, user, req): + # Get user data from premiumize.me + status = self.getAccountStatus(user, req) + + self.logDebug(status) + + if status['state'] != 'ok': + info = {'validuntil' : None, + 'trafficleft': None, + 'premium' : False} + else: + # Parse account info + info = {'validuntil' : float(status["data"]["user"]["user_premium"]), + 'trafficleft': max(0, status["data"]["traffic"][1] - status["data"]["traffic"][0]), + 'session_key': status["data"]["session_key"], + 'hosters' : [hoster["name"] for hoster in status["data"]["hoster"]]} + + if info['validuntil'] < time(): + info['premium'] = False + else: + info['premium'] = True + + return 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['state'] != 'ok': + self.wrongPassword() + + + def getAccountStatus(self, user, req): + password = self.getAccountData(user)['password'] + salt = hashlib.sha256(password).hexdigest() + encrypted = PBKDF2(password, salt, iterations=1000).hexread(32) + + return json_loads(req.load("http://www2.smoozed.com/api/login", + get={'auth': user, 'password': encrypted})) diff --git a/module/plugins/accounts/StahnuTo.py b/module/plugins/accounts/StahnuTo.py index 2b08c67cd..882dbd2c3 100644 --- a/module/plugins/accounts/StahnuTo.py +++ b/module/plugins/accounts/StahnuTo.py @@ -8,7 +8,7 @@ from module.plugins.Account import Account class StahnuTo(Account): __name__ = "StahnuTo" __type__ = "account" - __version__ = "0.04" + __version__ = "0.05" __description__ = """StahnuTo account plugin""" __license__ = "GPLv3" @@ -25,10 +25,11 @@ class StahnuTo(Account): def login(self, user, data, req): - html = req.load("http://www.stahnu.to/login.php", post={ - "username": user, - "password": data['password'], - "submit": "Login"}) + html = req.load("http://www.stahnu.to/login.php", + post={"username": user, + "password": data['password'], + "submit": "Login"}, + decode=True) if not '<a href="logout.php">' in html: self.wrongPassword() diff --git a/module/plugins/accounts/TurbobitNet.py b/module/plugins/accounts/TurbobitNet.py index f87d234a7..a857649eb 100644 --- a/module/plugins/accounts/TurbobitNet.py +++ b/module/plugins/accounts/TurbobitNet.py @@ -9,7 +9,7 @@ from module.plugins.Account import Account class TurbobitNet(Account): __name__ = "TurbobitNet" __type__ = "account" - __version__ = "0.01" + __version__ = "0.02" __description__ = """TurbobitNet account plugin""" __license__ = "GPLv3" @@ -33,10 +33,11 @@ class TurbobitNet(Account): 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"}) + html = req.load("http://turbobit.net/user/login", + post={"user[login]": user, + "user[pass]": data['password'], + "user[submit]": "Login"}, + decode=True) if not '<div class="menu-item user-name">' in html: self.wrongPassword() diff --git a/module/plugins/accounts/UnrestrictLi.py b/module/plugins/accounts/UnrestrictLi.py index f5db3f888..6a8187234 100644 --- a/module/plugins/accounts/UnrestrictLi.py +++ b/module/plugins/accounts/UnrestrictLi.py @@ -7,7 +7,7 @@ from module.common.json_layer import json_loads class UnrestrictLi(Account): __name__ = "UnrestrictLi" __type__ = "account" - __version__ = "0.04" + __version__ = "0.05" __description__ = """Unrestrict.li account plugin""" __license__ = "GPLv3" @@ -30,7 +30,7 @@ class UnrestrictLi(Account): def login(self, user, data, req): req.cj.setCookie("unrestrict.li", "lang", "EN") - html = req.load("https://unrestrict.li/sign_in") + html = req.load("https://unrestrict.li/sign_in", decode=True) if 'solvemedia' in html: self.logError(_("A Captcha is required. Go to http://unrestrict.li/sign_in and login, then retry")) @@ -38,7 +38,7 @@ class UnrestrictLi(Account): post_data = {"username": user, "password": data['password'], "remember_me": "remember", "signin": "Sign in"} - html = req.load("https://unrestrict.li/sign_in", post=post_data) + html = req.load("https://unrestrict.li/sign_in", post=post_data, decode=True) if 'sign_out' not in html: self.wrongPassword() diff --git a/module/plugins/accounts/UploadableCh.py b/module/plugins/accounts/UploadableCh.py index 14c19adda..86ae5dd17 100644 --- a/module/plugins/accounts/UploadableCh.py +++ b/module/plugins/accounts/UploadableCh.py @@ -6,7 +6,7 @@ from module.plugins.Account import Account class UploadableCh(Account): __name__ = "UploadableCh" __type__ = "account" - __version__ = "0.02" + __version__ = "0.03" __description__ = """Uploadable.ch account plugin""" __license__ = "GPLv3" @@ -27,7 +27,8 @@ class UploadableCh(Account): post={'userName' : user, 'userPassword' : data["password"], 'autoLogin' : "1", - 'action__login': "normalLogin"}) + 'action__login': "normalLogin"}, + decode=True) if "Login failed" in html: self.wrongPassword() diff --git a/module/plugins/accounts/UploadedTo.py b/module/plugins/accounts/UploadedTo.py index c09726799..1b6df97fb 100644 --- a/module/plugins/accounts/UploadedTo.py +++ b/module/plugins/accounts/UploadedTo.py @@ -9,7 +9,7 @@ from module.plugins.Account import Account class UploadedTo(Account): __name__ = "UploadedTo" __type__ = "account" - __version__ = "0.29" + __version__ = "0.30" __description__ = """Uploaded.to account plugin""" __license__ = "GPLv3" @@ -59,10 +59,11 @@ class UploadedTo(Account): def login(self, user, data, req): - req.cj.setCookie("uploaded.net", "lang", "en") + # req.cj.setCookie("uploaded.net", "lang", "en") html = req.load("http://uploaded.net/io/login", - post={'id': user, 'pw': data['password'], '_': ""}) + post={'id': user, 'pw': data['password'], '_': ""}, + decode=True) - if "User and password do not match" in html: + if '"err"' in html: self.wrongPassword() diff --git a/module/plugins/accounts/UploadheroCom.py b/module/plugins/accounts/UploadheroCom.py index 1e30b3771..714f5b0a6 100644 --- a/module/plugins/accounts/UploadheroCom.py +++ b/module/plugins/accounts/UploadheroCom.py @@ -10,7 +10,7 @@ from module.plugins.Account import Account class UploadheroCom(Account): __name__ = "UploadheroCom" __type__ = "account" - __version__ = "0.20" + __version__ = "0.21" __description__ = """Uploadhero.co account plugin""" __license__ = "GPLv3" @@ -35,7 +35,8 @@ class UploadheroCom(Account): def login(self, user, data, req): html = req.load("http://uploadhero.co/lib/connexion.php", - post={"pseudo_login": user, "password_login": data['password']}) + post={"pseudo_login": user, "password_login": data['password']}, + decode=True) if "mot de passe invalide" in html: self.wrongPassword() diff --git a/module/plugins/accounts/YibaishiwuCom.py b/module/plugins/accounts/YibaishiwuCom.py index 92a6bfedf..863588495 100644 --- a/module/plugins/accounts/YibaishiwuCom.py +++ b/module/plugins/accounts/YibaishiwuCom.py @@ -8,7 +8,7 @@ from module.plugins.Account import Account class YibaishiwuCom(Account): __name__ = "YibaishiwuCom" __type__ = "account" - __version__ = "0.01" + __version__ = "0.02" __description__ = """115.com account plugin""" __license__ = "GPLv3" @@ -29,12 +29,12 @@ class YibaishiwuCom(Account): 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) + 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() diff --git a/module/plugins/accounts/ZeveraCom.py b/module/plugins/accounts/ZeveraCom.py index e8e3431e3..6c69a974f 100644 --- a/module/plugins/accounts/ZeveraCom.py +++ b/module/plugins/accounts/ZeveraCom.py @@ -8,43 +8,65 @@ from module.plugins.Account import Account class ZeveraCom(Account): __name__ = "ZeveraCom" __type__ = "account" - __version__ = "0.22" + __version__ = "0.24" __description__ = """Zevera.com account plugin""" __license__ = "GPLv3" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] + __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), + ("Walter Purcaro", "vuolter@gmail.com")] + + + HOSTER_DOMAIN = "zevera.com" + + + def __init__(self, manager, accounts): #@TODO: remove in 0.4.10 + self.init() + return super(ZeveraCom, self).__init__(manager, accounts) + + + def init(self): + if not self.HOSTER_DOMAIN: + self.logError(_("Missing HOSTER_DOMAIN")) + + if not hasattr(self, "API_URL"): + self.API_URL = "http://api.%s/jDownloader.ashx" % (self.HOSTER_DOMAIN or "") 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": float(data['availabletodaytraffic']) * 1024, - "validuntil": mktime(strptime(data['endsubscriptiondate'], "%Y/%m/%d %H:%M:%S")), - "premium": True - } - return account_info + validuntil = None + trafficleft = None + premium = False + + api = self.api_response(req) + + if api != "No trafic": + validuntil = mktime(strptime(api['endsubscriptiondate'], "%Y/%m/%d %H:%M:%S")) + trafficleft = float(api['availabletodaytraffic']) * 1024 if api['orondaytrafficlimit'] != '0' else -1 + premium = True + + return {'validuntil': validuntil, 'trafficleft': trafficleft, 'premium': premium} def login(self, user, data, req): - self.loginname = user + self.user = user self.password = data['password'] - if self.getAPIData(req) == "No traffic": + + if self.api_response(req) == "No trafic": self.wrongPassword() - def getAPIData(self, req, just_header=False, **kwargs): - get_data = { - 'cmd': 'accountinfo', - 'login': self.loginname, - 'pass': self.password - } + def api_response(self, req, just_header=False, **kwargs): + get_data = {'cmd' : "accountinfo", + 'login': self.user, + 'pass' : self.password} + get_data.update(kwargs) - res = req.load("http://www.zevera.com/jDownloader.ashx", get=get_data, - decode=True, just_header=just_header) + res = req.load(self.API_URL, + get=get_data, + just_header=just_header, + decode=True) + self.logDebug(res) if ':' in res: diff --git a/module/plugins/crypter/C1neonCom.py b/module/plugins/crypter/C1neonCom.py index bc58fbf1c..926633ff7 100644 --- a/module/plugins/crypter/C1neonCom.py +++ b/module/plugins/crypter/C1neonCom.py @@ -3,8 +3,8 @@ from module.plugins.internal.DeadCrypter import DeadCrypter, create_getInfo -class C1neonCom(DeadCrypter): - __name__ = "C1neonCom" +class C1NeonCom(DeadCrypter): + __name__ = "C1NeonCom" __type__ = "crypter" __version__ = "0.05" @@ -16,4 +16,4 @@ class C1neonCom(DeadCrypter): __authors__ = [("godofdream", "soilfiction@gmail.com")] -getInfo = create_getInfo(C1neonCom) +getInfo = create_getInfo(C1NeonCom) diff --git a/module/plugins/crypter/FilefactoryComFolder.py b/module/plugins/crypter/FilefactoryComFolder.py index 26e28acbd..261c7e01a 100644 --- a/module/plugins/crypter/FilefactoryComFolder.py +++ b/module/plugins/crypter/FilefactoryComFolder.py @@ -6,7 +6,7 @@ from module.plugins.internal.SimpleCrypter import SimpleCrypter, create_getInfo class FilefactoryComFolder(SimpleCrypter): __name__ = "FilefactoryComFolder" __type__ = "crypter" - __version__ = "0.31" + __version__ = "0.32" __pattern__ = r'https?://(?:www\.)?filefactory\.com/(?:f|folder)/\w+' __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), @@ -17,15 +17,15 @@ class FilefactoryComFolder(SimpleCrypter): __authors__ = [("stickell", "l.stickell@yahoo.it")] - LINK_PATTERN = r'<td><a href="([^"]+)">' - NAME_PATTERN = r'<h1>Files in <span>(?P<N>.+)</span></h1>' - PAGES_PATTERN = r'data-paginator-totalPages="(\d+)"' - COOKIES = [("filefactory.com", "locale", "en_US.utf8")] + LINK_PATTERN = r'<td>\s*<a href="(.+?)"' + NAME_PATTERN = r'<h1>Files in <span>(?P<N>.+?)<' + PAGES_PATTERN = r'data-paginator-totalPages="(\d+)' + def loadPage(self, page_n): - return self.load(self.pyfile.url, get={'page': page_n}) + return self.load(self.pyfile.url, get={'page': page_n, 'show': 100}) getInfo = create_getInfo(FilefactoryComFolder) diff --git a/module/plugins/crypter/FourChanOrg.py b/module/plugins/crypter/FourChanOrg.py index d6c5c86cc..c3fe3db4b 100644 --- a/module/plugins/crypter/FourChanOrg.py +++ b/module/plugins/crypter/FourChanOrg.py @@ -10,7 +10,7 @@ from module.plugins.Crypter import Crypter class FourChanOrg(Crypter): __name__ = "FourChanOrg" __type__ = "crypter" - __version__ = "0.30" + __version__ = "0.31" __pattern__ = r'http://(?:www\.)?boards\.4chan\.org/\w+/res/(\d+)' __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), diff --git a/module/plugins/crypter/LinkdecrypterCom.py b/module/plugins/crypter/LinkdecrypterCom.py index 7eb5d3096..7f24784c7 100644 --- a/module/plugins/crypter/LinkdecrypterCom.py +++ b/module/plugins/crypter/LinkdecrypterCom.py @@ -7,7 +7,7 @@ from module.plugins.Crypter import Crypter class LinkdecrypterCom(Crypter): __name__ = "LinkdecrypterCom" __type__ = "crypter" - __version__ = "0.28" + __version__ = "0.29" __pattern__ = r'^unmatchable$' __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), @@ -31,40 +31,15 @@ class LinkdecrypterCom(Crypter): def decrypt(self, pyfile): - # API not working anymore - self.urls = self.decryptHTML() - - - def decryptAPI(self): - get_dict = {"t": "link", "url": self.pyfile.url, "lcache": "1"} - self.html = self.load('http://linkdecrypter.com/api', get=get_dict) - if self.html.startswith('http://'): - return self.html.splitlines() - - if self.html == 'INTERRUPTION(PASSWORD)': - get_dict['pass'] = self.password - - self.html = self.load('http://linkdecrypter.com/api', get=get_dict) - if self.html.startswith('http://'): - return self.html.splitlines() - - self.logError("API", self.html) - if self.html == 'INTERRUPTION(PASSWORD)': - self.fail(_("No or incorrect password")) - - return None - - - def decryptHTML(self): retries = 5 - post_dict = {"link_cache": "on", "pro_links": self.pyfile.url, "modo_links": "text"} + post_dict = {"link_cache": "on", "pro_links": pyfile.url, "modo_links": "text"} self.html = self.load('http://linkdecrypter.com/', post=post_dict, cookies=True, decode=True) while retries: m = re.search(self.TEXTAREA_PATTERN, self.html, flags=re.S) if m: - return [x for x in m.group(1).splitlines() if '[LINK-ERROR]' not in x] + self.urls = [x for x in m.group(1).splitlines() if '[LINK-ERROR]' not in x] m = re.search(self.CAPTCHA_PATTERN, self.html) if m: @@ -91,5 +66,3 @@ class LinkdecrypterCom(Crypter): else: retries -= 1 self.html = self.load('http://linkdecrypter.com/', cookies=True, decode=True) - - return None diff --git a/module/plugins/crypter/MegaCoNzFolder.py b/module/plugins/crypter/MegaCoNzFolder.py index caa2ab563..bec4eba22 100644 --- a/module/plugins/crypter/MegaCoNzFolder.py +++ b/module/plugins/crypter/MegaCoNzFolder.py @@ -1,14 +1,16 @@ # -*- coding: utf-8 -*- +import re + from module.plugins.internal.Crypter import Crypter class MegaCoNzFolder(Crypter): __name__ = "MegaCoNzFolder" __type__ = "crypter" - __version__ = "0.02" + __version__ = "0.03" - __pattern__ = r'https?://(?:www\.)?mega\.co\.nz/#F![\w+^_]![\w,\\-]+' + __pattern__ = r'(?:https?://(?:www\.)?mega\.co\.nz/|mega:|chrome:.+?)#F!(?P<ID>[\w+^_])!(?P<KEY>[\w,\\-]+)' __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), ("subfolder_per_package", "bool", "Create a subfolder for each package", True)] @@ -22,7 +24,8 @@ class MegaCoNzFolder(Crypter): def decrypt(self, pyfile): - self.html = self.load("http://rapidgen.org/linkfinder", post={'linklisturl': self.pyfile.url}) + url = "https://mega.co.nz/#F!%s!%s" % re.match(self.__pattern__, pyfile.url).groups() + self.html = self.load("http://rapidgen.org/linkfinder", post={'linklisturl': url}) self.urls = re.findall(r'(https://mega.co.nz/#N!.+?)<', self.html) if not self.urls: #@TODO: Remove in 0.4.10 diff --git a/module/plugins/crypter/Movie2kTo.py b/module/plugins/crypter/Movie2kTo.py index 7d71950fd..76bf702ac 100644 --- a/module/plugins/crypter/Movie2kTo.py +++ b/module/plugins/crypter/Movie2kTo.py @@ -3,8 +3,8 @@ from module.plugins.internal.DeadCrypter import DeadCrypter, create_getInfo -class Movie2kTo(DeadCrypter): - __name__ = "Movie2kTo" +class Movie2KTo(DeadCrypter): + __name__ = "Movie2KTo" __type__ = "crypter" __version__ = "0.51" @@ -16,4 +16,4 @@ class Movie2kTo(DeadCrypter): __authors__ = [("4Christopher", "4Christopher@gmx.de")] -getInfo = create_getInfo(Movie2kTo) +getInfo = create_getInfo(Movie2KTo) diff --git a/module/plugins/crypter/OneKhDe.py b/module/plugins/crypter/OneKhDe.py index cfb084da8..3e75d97b5 100644 --- a/module/plugins/crypter/OneKhDe.py +++ b/module/plugins/crypter/OneKhDe.py @@ -3,13 +3,14 @@ import re from module.unescape import unescape + from module.plugins.Crypter import Crypter class OneKhDe(Crypter): __name__ = "OneKhDe" __type__ = "crypter" - __version__ = "0.10" + __version__ = "0.11" __pattern__ = r'http://(?:www\.)?1kh\.de/f/' __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), diff --git a/module/plugins/crypter/SafelinkingNet.py b/module/plugins/crypter/SafelinkingNet.py index 709083b51..a56a0a44c 100644 --- a/module/plugins/crypter/SafelinkingNet.py +++ b/module/plugins/crypter/SafelinkingNet.py @@ -14,7 +14,7 @@ from module.plugins.internal.CaptchaService import SolveMedia class SafelinkingNet(Crypter): __name__ = "SafelinkingNet" __type__ = "crypter" - __version__ = "0.11" + __version__ = "0.13" __pattern__ = r'https?://(?:www\.)?safelinking\.net/([pd])/\w+' __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), @@ -42,6 +42,8 @@ class SafelinkingNet(Crypter): else: postData = {"post-protect": "1"} + self.html = self.load(url) + if "link-password" in self.html: postData['link-password'] = self.getPassword() diff --git a/module/plugins/crypter/XFileSharingProFolder.py b/module/plugins/crypter/XFileSharingProFolder.py index 10e4d8c83..55cd41931 100644 --- a/module/plugins/crypter/XFileSharingProFolder.py +++ b/module/plugins/crypter/XFileSharingProFolder.py @@ -8,7 +8,7 @@ from module.plugins.internal.XFSCrypter import XFSCrypter, create_getInfo class XFileSharingProFolder(XFSCrypter): __name__ = "XFileSharingProFolder" __type__ = "crypter" - __version__ = "0.03" + __version__ = "0.04" __pattern__ = r'^unmatchable$' __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), @@ -30,21 +30,26 @@ class XFileSharingProFolder(XFSCrypter): self.__pattern__ = self.core.pluginManager.crypterPlugins[self.__name__]['pattern'] - self.HOSTER_DOMAIN = re.match(self.__pattern__, self.pyfile.url).group(1).lower() - self.HOSTER_NAME = "".join([str.capitalize() for str in self.HOSTER_DOMAIN.split('.')]) + self.HOSTER_DOMAIN = re.match(self.__pattern__, self.pyfile.url).group("DOMAIN").lower() + self.HOSTER_NAME = "".join([part.capitalize() for part in re.split(r'(\.|\d+)', self.HOSTER_DOMAIN) if part != '.']) + + if self.HOSTER_NAME[0].isdigit(): + self.HOSTER_NAME = 'X' + self.HOSTER_NAME account = self.core.accountManager.getAccountPlugin(self.HOSTER_NAME) if account and account.canUse(): self.account = account + elif self.account: self.account.HOSTER_DOMAIN = self.HOSTER_DOMAIN + else: return self.user, data = self.account.selectAccount() - self.req = self.account.getAccountRequest(self.user) - self.premium = self.account.isPremium(self.user) + self.req = self.account.getAccountRequest(self.user) + self.premium = self.account.isPremium(self.user) getInfo = create_getInfo(XFileSharingProFolder) diff --git a/module/plugins/hooks/AlldebridCom.py b/module/plugins/hooks/AlldebridCom.py index e1f63c31b..dddd97c0c 100644 --- a/module/plugins/hooks/AlldebridCom.py +++ b/module/plugins/hooks/AlldebridCom.py @@ -6,13 +6,16 @@ from module.plugins.internal.MultiHook import MultiHook class AlldebridCom(MultiHook): __name__ = "AlldebridCom" __type__ = "hook" - __version__ = "0.15" + __version__ = "0.16" - __config__ = [("https", "bool", "Enable HTTPS", False), - ("mode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), - ("pluginlist", "str", "Hoster list (comma separated)", ""), - ("revertfailed", "bool", "Revert to standard download if download fails", False), - ("interval", "int", "Reload interval in hours (0 to disable)", 24)] + __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), + ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), + ("revertfailed" , "bool" , "Revert to standard download if fails", True ), + ("retry" , "int" , "Number of retries before revert" , 10 ), + ("retryinterval" , "int" , "Retry interval in minutes" , 1 ), + ("reload" , "bool" , "Reload plugin list" , True ), + ("reloadinterval", "int" , "Reload interval in hours" , 12 ), + ("ssl" , "bool" , "Use HTTPS" , True )] __description__ = """Alldebrid.com hook plugin""" __license__ = "GPLv3" @@ -20,7 +23,7 @@ class AlldebridCom(MultiHook): def getHosters(self): - https = "https" if self.getConfig("https") else "http" + https = "https" if self.getConfig("ssl") else "http" page = self.getURL(https + "://www.alldebrid.com/api.php", get={'action': "get_host"}).replace("\"", "").strip() return [x.strip() for x in page.split(",") if x.strip()] diff --git a/module/plugins/hooks/Captcha9kw.py b/module/plugins/hooks/Captcha9kw.py index 6eb4ef305..600694e78 100755 --- a/module/plugins/hooks/Captcha9kw.py +++ b/module/plugins/hooks/Captcha9kw.py @@ -13,8 +13,8 @@ from module.network.RequestFactory import getURL from module.plugins.Hook import Hook, threaded -class Captcha9kw(Hook): - __name__ = "Captcha9kw" +class Captcha9Kw(Hook): + __name__ = "Captcha9Kw" __type__ = "hook" __version__ = "0.27" diff --git a/module/plugins/hooks/CaptchaBrotherhood.py b/module/plugins/hooks/CaptchaBrotherhood.py index 9a9f05b29..3c08f5e36 100644 --- a/module/plugins/hooks/CaptchaBrotherhood.py +++ b/module/plugins/hooks/CaptchaBrotherhood.py @@ -38,7 +38,7 @@ class CaptchaBrotherhoodException(Exception): class CaptchaBrotherhood(Hook): __name__ = "CaptchaBrotherhood" __type__ = "hook" - __version__ = "0.07" + __version__ = "0.08" __config__ = [("username", "str", "Username", ""), ("force", "bool", "Force CT even if client is connected", False), @@ -118,14 +118,14 @@ class CaptchaBrotherhood(Hook): for _i in xrange(15): sleep(5) - res = self.get_api("askCaptchaResult", ticket) + res = self.api_response("askCaptchaResult", ticket) if res.startswith("OK-answered"): return ticket, res[12:] raise CaptchaBrotherhoodException("No solution received in time") - def get_api(self, api, ticket): + def api_response(self, api, ticket): res = getURL("%s%s.aspx" % (self.API_URL, api), get={"username": self.getConfig("username"), "password": self.getConfig("passkey"), @@ -160,7 +160,7 @@ class CaptchaBrotherhood(Hook): def captchaInvalid(self, task): if task.data['service'] == self.__name__ and "ticket" in task.data: - res = self.get_api("complainCaptcha", task.data['ticket']) + res = self.api_response("complainCaptcha", task.data['ticket']) @threaded diff --git a/module/plugins/hooks/DeathByCaptcha.py b/module/plugins/hooks/DeathByCaptcha.py index 98412c218..050b6fe15 100644 --- a/module/plugins/hooks/DeathByCaptcha.py +++ b/module/plugins/hooks/DeathByCaptcha.py @@ -51,7 +51,7 @@ class DeathByCaptchaException(Exception): class DeathByCaptcha(Hook): __name__ = "DeathByCaptcha" __type__ = "hook" - __version__ = "0.05" + __version__ = "0.06" __config__ = [("username", "str", "Username", ""), ("passkey", "password", "Password", ""), @@ -75,7 +75,7 @@ class DeathByCaptcha(Hook): self.info = {} #@TODO: Remove in 0.4.10 - def call_api(self, api="captcha", post=False, multipart=False): + def api_response(self, api="captcha", post=False, multipart=False): req = getRequest() req.c.setopt(HTTPHEADER, ["Accept: application/json", "User-Agent: pyLoad %s" % self.core.version]) @@ -117,7 +117,7 @@ class DeathByCaptcha(Hook): def getCredits(self): - res = self.call_api("user", True) + res = self.api_response("user", True) if 'is_banned' in res and res['is_banned']: raise DeathByCaptchaException('banned') @@ -128,7 +128,7 @@ class DeathByCaptcha(Hook): def getStatus(self): - res = self.call_api("status", False) + res = self.api_response("status", False) if 'is_service_overloaded' in res and res['is_service_overloaded']: raise DeathByCaptchaException('service-overload') @@ -145,7 +145,7 @@ class DeathByCaptcha(Hook): data = f.read() data = "base64:" + b64encode(data) - res = self.call_api("captcha", {"captchafile": data}, multipart) + res = self.api_response("captcha", {"captchafile": data}, multipart) if "captcha" not in res: raise DeathByCaptchaException(res) @@ -153,7 +153,7 @@ class DeathByCaptcha(Hook): for _i in xrange(24): sleep(5) - res = self.call_api("captcha/%d" % ticket, False) + res = self.api_response("captcha/%d" % ticket, False) if res['text'] and res['is_correct']: break else: @@ -200,7 +200,7 @@ class DeathByCaptcha(Hook): def captchaInvalid(self, task): if task.data['service'] == self.__name__ and "ticket" in task.data: try: - res = self.call_api("captcha/%d/report" % task.data['ticket'], True) + res = self.api_response("captcha/%d/report" % task.data['ticket'], True) except DeathByCaptchaException, e: self.logError(e.getDesc()) diff --git a/module/plugins/hooks/DebridItaliaCom.py b/module/plugins/hooks/DebridItaliaCom.py index d18be5384..719f3dd3a 100644 --- a/module/plugins/hooks/DebridItaliaCom.py +++ b/module/plugins/hooks/DebridItaliaCom.py @@ -8,12 +8,15 @@ from module.plugins.internal.MultiHook import MultiHook class DebridItaliaCom(MultiHook): __name__ = "DebridItaliaCom" __type__ = "hook" - __version__ = "0.11" - - __config__ = [("mode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), - ("pluginlist", "str", "Hoster list (comma separated)", ""), - ("revertfailed", "bool", "Revert to standard download if download fails", False), - ("interval", "int", "Reload interval in hours (0 to disable)", 24)] + __version__ = "0.12" + + __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), + ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), + ("revertfailed" , "bool" , "Revert to standard download if fails", True ), + ("retry" , "int" , "Number of retries before revert" , 10 ), + ("retryinterval" , "int" , "Retry interval in minutes" , 1 ), + ("reload" , "bool" , "Reload plugin list" , True ), + ("reloadinterval", "int" , "Reload interval in hours" , 12 )] __description__ = """Debriditalia.com hook plugin""" __license__ = "GPLv3" diff --git a/module/plugins/hooks/EasybytezCom.py b/module/plugins/hooks/EasybytezCom.py index 1606c9f30..e08127514 100644 --- a/module/plugins/hooks/EasybytezCom.py +++ b/module/plugins/hooks/EasybytezCom.py @@ -8,10 +8,15 @@ from module.plugins.internal.MultiHook import MultiHook class EasybytezCom(MultiHook): __name__ = "EasybytezCom" __type__ = "hook" - __version__ = "0.06" + __version__ = "0.07" - __config__ = [("mode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), - ("pluginlist", "str", "Hoster list (comma separated)", "")] + __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), + ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), + ("revertfailed" , "bool" , "Revert to standard download if fails", True ), + ("retry" , "int" , "Number of retries before revert" , 10 ), + ("retryinterval" , "int" , "Retry interval in minutes" , 1 ), + ("reload" , "bool" , "Reload plugin list" , True ), + ("reloadinterval", "int" , "Reload interval in hours" , 12 )] __description__ = """EasyBytez.com hook plugin""" __license__ = "GPLv3" @@ -21,18 +26,7 @@ class EasybytezCom(MultiHook): def getHosters(self): user, data = self.account.selectAccount() - try: - req = self.account.getAccountRequest(user) - page = req.load("http://www.easybytez.com") + req = self.account.getAccountRequest(user) + page = req.load("http://www.easybytez.com") - hosters = re.search(r'</textarea>\s*Supported sites:(.*)', page).group(1).split(',') - - except Exception, e: - self.logWarning(_("Unable to load supported hoster list, using last known")) - self.logDebug(e) - - hosters = ["bitshare.com", "crocko.com", "ddlstorage.com", "depositfiles.com", "extabit.com", "hotfile.com", - "mediafire.com", "netload.in", "rapidgator.net", "rapidshare.com", "uploading.com", "uload.to", - "uploaded.to"] - finally: - return hosters + return re.search(r'</textarea>\s*Supported sites:(.*)', page).group(1).split(',') diff --git a/module/plugins/hooks/FastixRu.py b/module/plugins/hooks/FastixRu.py index a4b423fb7..25126fbd3 100644 --- a/module/plugins/hooks/FastixRu.py +++ b/module/plugins/hooks/FastixRu.py @@ -7,11 +7,15 @@ from module.plugins.internal.MultiHook import MultiHook class FastixRu(MultiHook): __name__ = "FastixRu" __type__ = "hook" - __version__ = "0.04" + __version__ = "0.05" - __config__ = [("mode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), - ("revertfailed", "bool", "Revert to standard download if download fails", False), - ("interval", "int", "Reload interval in hours (0 to disable)", 24)] + __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), + ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), + ("revertfailed" , "bool" , "Revert to standard download if fails", True ), + ("retry" , "int" , "Number of retries before revert" , 10 ), + ("retryinterval" , "int" , "Retry interval in minutes" , 1 ), + ("reload" , "bool" , "Reload plugin list" , True ), + ("reloadinterval", "int" , "Reload interval in hours" , 12 )] __description__ = """Fastix.ru hook plugin""" __license__ = "GPLv3" diff --git a/module/plugins/hooks/FreeWayMe.py b/module/plugins/hooks/FreeWayMe.py index 6cbea3417..6fec037d8 100644 --- a/module/plugins/hooks/FreeWayMe.py +++ b/module/plugins/hooks/FreeWayMe.py @@ -6,12 +6,15 @@ from module.plugins.internal.MultiHook import MultiHook class FreeWayMe(MultiHook): __name__ = "FreeWayMe" __type__ = "hook" - __version__ = "0.13" + __version__ = "0.14" - __config__ = [("mode", "all;listed;unlisted", "Use for hosters (if supported):", "all"), - ("pluginlist", "str", "Hoster list (comma separated)", ""), - ("revertfailed", "bool", "Revert to standard download if download fails", False), - ("interval", "int", "Reload interval in hours (0 to disable)", 24)] + __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), + ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), + ("revertfailed" , "bool" , "Revert to standard download if fails", True ), + ("retry" , "int" , "Number of retries before revert" , 10 ), + ("retryinterval" , "int" , "Retry interval in minutes" , 1 ), + ("reload" , "bool" , "Reload plugin list" , True ), + ("reloadinterval", "int" , "Reload interval in hours" , 12 )] __description__ = """FreeWay.me hook plugin""" __license__ = "GPLv3" diff --git a/module/plugins/hooks/LinkdecrypterCom.py b/module/plugins/hooks/LinkdecrypterCom.py index 8592efd3d..d4924a687 100644 --- a/module/plugins/hooks/LinkdecrypterCom.py +++ b/module/plugins/hooks/LinkdecrypterCom.py @@ -8,11 +8,12 @@ from module.plugins.internal.MultiHook import MultiHook class LinkdecrypterCom(MultiHook): __name__ = "LinkdecrypterCom" __type__ = "hook" - __version__ = "1.00" + __version__ = "1.01" - __config__ = [("mode" , "all;listed;unlisted", "Use for crypters (if supported)" , "all"), - ("pluginlist" , "str" , "Crypter list (comma separated)" , "" ), - ("interval" , "int" , "Reload interval in hours (0 to disable)" , 12 )] + __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), + ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), + ("reload" , "bool" , "Reload plugin list" , True ), + ("reloadinterval", "int" , "Reload interval in hours" , 12 )] __description__ = """Linkdecrypter.com hook plugin""" __license__ = "GPLv3" diff --git a/module/plugins/hooks/LinksnappyCom.py b/module/plugins/hooks/LinksnappyCom.py index a1c4b90f7..5eb0c7f6d 100644 --- a/module/plugins/hooks/LinksnappyCom.py +++ b/module/plugins/hooks/LinksnappyCom.py @@ -7,12 +7,15 @@ from module.plugins.internal.MultiHook import MultiHook class LinksnappyCom(MultiHook): __name__ = "LinksnappyCom" __type__ = "hook" - __version__ = "0.03" - - __config__ = [("mode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), - ("pluginlist", "str", "Hoster list (comma separated)", ""), - ("revertfailed", "bool", "Revert to standard download if download fails", False), - ("interval", "int", "Reload interval in hours (0 to disable)", 24)] + __version__ = "0.04" + + __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), + ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), + ("revertfailed" , "bool" , "Revert to standard download if fails", True ), + ("retry" , "int" , "Number of retries before revert" , 10 ), + ("retryinterval" , "int" , "Retry interval in minutes" , 1 ), + ("reload" , "bool" , "Reload plugin list" , True ), + ("reloadinterval", "int" , "Reload interval in hours" , 12 )] __description__ = """Linksnappy.com hook plugin""" __license__ = "GPLv3" diff --git a/module/plugins/hooks/MegaDebridEu.py b/module/plugins/hooks/MegaDebridEu.py index 5fb7e1ea6..f67fa7ac0 100644 --- a/module/plugins/hooks/MegaDebridEu.py +++ b/module/plugins/hooks/MegaDebridEu.py @@ -7,11 +7,17 @@ from module.plugins.internal.MultiHook import MultiHook class MegaDebridEu(MultiHook): __name__ = "MegaDebridEu" __type__ = "hook" - __version__ = "0.04" + __version__ = "0.05" - __config__ = [("revertfailed", "bool", "Revert to standard download if download fails", False)] + __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), + ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), + ("revertfailed" , "bool" , "Revert to standard download if fails", True ), + ("retry" , "int" , "Number of retries before revert" , 10 ), + ("retryinterval" , "int" , "Retry interval in minutes" , 1 ), + ("reload" , "bool" , "Reload plugin list" , True ), + ("reloadinterval", "int" , "Reload interval in hours" , 12 )] - __description__ = """mega-debrid.eu hook plugin""" + __description__ = """Mega-debrid.eu hook plugin""" __license__ = "GPLv3" __authors__ = [("D.Ducatel", "dducatel@je-geek.fr")] diff --git a/module/plugins/hooks/MultihostersCom.py b/module/plugins/hooks/MultihostersCom.py index 5ada3aa56..bf88cfae7 100644 --- a/module/plugins/hooks/MultihostersCom.py +++ b/module/plugins/hooks/MultihostersCom.py @@ -1,22 +1,18 @@ # -*- coding: utf-8 -*- -from module.network.RequestFactory import getURL -from module.plugins.internal.MultiHoster import MultiHoster +from module.plugins.hooks.ZeveraCom import ZeveraCom -class MultihostersCom(MultiHoster): - __name__ = "MultihostersCom" - __version__ = "0.01" - __type__ = "hook" - __config__ = [("activated", "bool", "Activated", False), - ("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), - ("hosterList", "str", "Hoster list (comma separated)", ""), - ("unloadFailing", "bool", "Revert to standard download if download fails", False), - ("interval", "int", "Reload interval in hours (0 to disable)", 24)] - __description__ = """Multihosters.com hook plugin""" - __author_name__ = "tjeh" - __author_mail__ = "tjeh@gmx.net" +class MultihostersCom(ZeveraCom): + __name__ = "MultihostersCom" + __type__ = "hook" + __version__ = "0.02" + + __config__ = [("mode" , "all;listed;unlisted", "Use for plugins (if supported)" , "all"), + ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), + ("revertfailed", "bool" , "Revert to standard download if download fails", False), + ("interval" , "int" , "Reload interval in hours (0 to disable)" , 12 )] - def getHoster(self): - page = getURL("http://www.multihosters.com/jDownloader.ashx?cmd=gethosters") - return [x.strip() for x in page.split(",")]
\ No newline at end of file + __description__ = """Multihosters.com hook plugin""" + __license__ = "GPLv3" + __authors__ = [("tjeh", "tjeh@gmx.net")] diff --git a/module/plugins/hooks/MultishareCz.py b/module/plugins/hooks/MultishareCz.py index 2dadf5dc1..8349e0de8 100644 --- a/module/plugins/hooks/MultishareCz.py +++ b/module/plugins/hooks/MultishareCz.py @@ -8,10 +8,15 @@ from module.plugins.internal.MultiHook import MultiHook class MultishareCz(MultiHook): __name__ = "MultishareCz" __type__ = "hook" - __version__ = "0.06" - - __config__ = [("mode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), - ("pluginlist", "str", "Hoster list (comma separated)", "uloz.to")] + __version__ = "0.07" + + __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), + ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), + ("revertfailed" , "bool" , "Revert to standard download if fails", True ), + ("retry" , "int" , "Number of retries before revert" , 10 ), + ("retryinterval" , "int" , "Retry interval in minutes" , 1 ), + ("reload" , "bool" , "Reload plugin list" , True ), + ("reloadinterval", "int" , "Reload interval in hours" , 12 )] __description__ = """MultiShare.cz hook plugin""" __license__ = "GPLv3" diff --git a/module/plugins/hooks/MyfastfileCom.py b/module/plugins/hooks/MyfastfileCom.py index 2fda0d3bf..86408cb6d 100644 --- a/module/plugins/hooks/MyfastfileCom.py +++ b/module/plugins/hooks/MyfastfileCom.py @@ -7,12 +7,15 @@ from module.plugins.internal.MultiHook import MultiHook class MyfastfileCom(MultiHook): __name__ = "MyfastfileCom" __type__ = "hook" - __version__ = "0.04" - - __config__ = [("mode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), - ("pluginlist", "str", "Hoster list (comma separated)", ""), - ("revertfailed", "bool", "Revert to standard download if download fails", False), - ("interval", "int", "Reload interval in hours (0 to disable)", 24)] + __version__ = "0.05" + + __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), + ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), + ("revertfailed" , "bool" , "Revert to standard download if fails", True ), + ("retry" , "int" , "Number of retries before revert" , 10 ), + ("retryinterval" , "int" , "Retry interval in minutes" , 1 ), + ("reload" , "bool" , "Reload plugin list" , True ), + ("reloadinterval", "int" , "Reload interval in hours" , 12 )] __description__ = """Myfastfile.com hook plugin""" __license__ = "GPLv3" diff --git a/module/plugins/hooks/NoPremiumPl.py b/module/plugins/hooks/NoPremiumPl.py index 2347fc58a..1727bec70 100644 --- a/module/plugins/hooks/NoPremiumPl.py +++ b/module/plugins/hooks/NoPremiumPl.py @@ -1,28 +1,31 @@ # -*- coding: utf-8 -*- +from module.common.json_layer import json_loads from module.plugins.internal.MultiHook import MultiHook -from module.common.json_layer import json_loads as loads class NoPremiumPl(MultiHook): - __name__ = "NoPremiumPl" - __version__ = "0.02" - __type__ = "hook" + __name__ = "NoPremiumPl" + __type__ = "hook" + __version__ = "0.03" - __config__ = [("activated", "bool", "Activated", False), - ("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported):", "all"), - ("hosterList", "str", "Hoster list (comma separated)", ""), - ("unloadFailing", "bool", "Try standard download if download fails", False), - ("interval", "int", "Reload supported hosts interval in hours (0 to disable)", 24)] + __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), + ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), + ("revertfailed" , "bool" , "Revert to standard download if fails", True ), + ("retry" , "int" , "Number of retries before revert" , 10 ), + ("retryinterval" , "int" , "Retry interval in minutes" , 1 ), + ("reload" , "bool" , "Reload plugin list" , True ), + ("reloadinterval", "int" , "Reload interval in hours" , 12 )] + + __description__ = """NoPremium.pl hook plugin""" + __license__ = "GPLv3" + __authors__ = [("goddie", "dev@nopremium.pl")] - __description__ = "NoPremium.pl hook" - __license__ = "GPLv3" - __authors__ = [("goddie", "dev@nopremium.pl")] def getHosters(self): - hostings = loads(self.getURL("https://www.nopremium.pl/clipboard.php?json=3").strip()) + hostings = json_loads(self.getURL("https://www.nopremium.pl/clipboard.php?json=3").strip()) hostings_domains = [domain for row in hostings for domain in row["domains"] if row["sdownload"] == "0"] - self.logDebug(hostings_domains) - return hostings_domains + self.logDebug(hostings_domains) + return hostings_domains diff --git a/module/plugins/hooks/OverLoadMe.py b/module/plugins/hooks/OverLoadMe.py index eb3da319a..1872f8ccb 100644 --- a/module/plugins/hooks/OverLoadMe.py +++ b/module/plugins/hooks/OverLoadMe.py @@ -6,13 +6,16 @@ from module.plugins.internal.MultiHook import MultiHook class OverLoadMe(MultiHook): __name__ = "OverLoadMe" __type__ = "hook" - __version__ = "0.03" + __version__ = "0.04" - __config__ = [("https", "bool", "Enable HTTPS", True), - ("mode", "all;listed;unlisted", "Use for hosters (if supported):", "all"), - ("pluginlist", "str", "Hoster list (comma separated)", ""), - ("revertfailed", "bool", "Revert to standard download if download fails", False), - ("interval", "int", "Reload interval in hours (0 to disable)", 12)] + __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), + ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), + ("revertfailed" , "bool" , "Revert to standard download if fails", True ), + ("retry" , "int" , "Number of retries before revert" , 10 ), + ("retryinterval" , "int" , "Retry interval in minutes" , 1 ), + ("reload" , "bool" , "Reload plugin list" , True ), + ("reloadinterval", "int" , "Reload interval in hours" , 12 ), + ("ssl" , "bool" , "Use HTTPS" , True )] __description__ = """Over-Load.me hook plugin""" __license__ = "GPLv3" @@ -20,7 +23,7 @@ class OverLoadMe(MultiHook): def getHosters(self): - https = "https" if self.getConfig("https") else "http" + https = "https" if self.getConfig("ssl") else "http" page = self.getURL(https + "://api.over-load.me/hoster.php", get={'auth': "0001-cb1f24dadb3aa487bda5afd3b76298935329be7700cd7-5329be77-00cf-1ca0135f"}).replace("\"", "").strip() self.logDebug("Hosterlist", page) diff --git a/module/plugins/hooks/PremiumTo.py b/module/plugins/hooks/PremiumTo.py index a4203c8bb..844ecc89d 100644 --- a/module/plugins/hooks/PremiumTo.py +++ b/module/plugins/hooks/PremiumTo.py @@ -6,10 +6,15 @@ from module.plugins.internal.MultiHook import MultiHook class PremiumTo(MultiHook): __name__ = "PremiumTo" __type__ = "hook" - __version__ = "0.07" + __version__ = "0.08" - __config__ = [("mode", "all;listed;unlisted", "Use for downloads from supported hosters:", "all"), - ("pluginlist", "str", "Hoster list (comma separated)", "")] + __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), + ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), + ("revertfailed" , "bool" , "Revert to standard download if fails", True ), + ("retry" , "int" , "Number of retries before revert" , 10 ), + ("retryinterval" , "int" , "Retry interval in minutes" , 1 ), + ("reload" , "bool" , "Reload plugin list" , True ), + ("reloadinterval", "int" , "Reload interval in hours" , 12 )] __description__ = """Premium.to hook plugin""" __license__ = "GPLv3" diff --git a/module/plugins/hooks/PremiumizeMe.py b/module/plugins/hooks/PremiumizeMe.py index d334ddd25..293fcf339 100644 --- a/module/plugins/hooks/PremiumizeMe.py +++ b/module/plugins/hooks/PremiumizeMe.py @@ -7,12 +7,15 @@ from module.plugins.internal.MultiHook import MultiHook class PremiumizeMe(MultiHook): __name__ = "PremiumizeMe" __type__ = "hook" - __version__ = "0.16" - - __config__ = [("mode", "all;listed;unlisted", "Use for hosters (if supported):", "all"), - ("pluginlist", "str", "Hoster list (comma separated)", ""), - ("revertfailed", "bool", "Revert to standard download if download fails", False), - ("interval", "int", "Reload interval in hours (0 to disable)", 24)] + __version__ = "0.17" + + __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), + ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), + ("revertfailed" , "bool" , "Revert to standard download if fails", True ), + ("retry" , "int" , "Number of retries before revert" , 10 ), + ("retryinterval" , "int" , "Retry interval in minutes" , 1 ), + ("reload" , "bool" , "Reload plugin list" , True ), + ("reloadinterval", "int" , "Reload interval in hours" , 12 )] __description__ = """Premiumize.me hook plugin""" __license__ = "GPLv3" diff --git a/module/plugins/hooks/PutdriveCom.py b/module/plugins/hooks/PutdriveCom.py new file mode 100644 index 000000000..f665dabee --- /dev/null +++ b/module/plugins/hooks/PutdriveCom.py @@ -0,0 +1,18 @@ +# -*- coding: utf-8 -*- + +from module.plugins.hooks.ZeveraCom import ZeveraCom + + +class PutdriveCom(ZeveraCom): + __name__ = "PutdriveCom" + __type__ = "hook" + __version__ = "0.01" + + __config__ = [("mode" , "all;listed;unlisted", "Use for plugins (if supported)" , "all"), + ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), + ("revertfailed", "bool" , "Revert to standard download if download fails", False), + ("interval" , "int" , "Reload interval in hours (0 to disable)" , 12 )] + + __description__ = """Putdrive.com hook plugin""" + __license__ = "GPLv3" + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] diff --git a/module/plugins/hooks/RPNetBiz.py b/module/plugins/hooks/RPNetBiz.py index 9c88e6c01..0768bd6cd 100644 --- a/module/plugins/hooks/RPNetBiz.py +++ b/module/plugins/hooks/RPNetBiz.py @@ -7,12 +7,15 @@ from module.plugins.internal.MultiHook import MultiHook class RPNetBiz(MultiHook): __name__ = "RPNetBiz" __type__ = "hook" - __version__ = "0.13" - - __config__ = [("mode", "all;listed;unlisted", "Use for hosters (if supported):", "all"), - ("pluginlist", "str", "Hoster list (comma separated)", ""), - ("revertfailed", "bool", "Revert to standard download if download fails", False), - ("interval", "int", "Reload interval in hours (0 to disable)", 24)] + __version__ = "0.14" + + __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), + ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), + ("revertfailed" , "bool" , "Revert to standard download if fails", True ), + ("retry" , "int" , "Number of retries before revert" , 10 ), + ("retryinterval" , "int" , "Retry interval in minutes" , 1 ), + ("reload" , "bool" , "Reload plugin list" , True ), + ("reloadinterval", "int" , "Reload interval in hours" , 12 )] __description__ = """RPNet.biz hook plugin""" __license__ = "GPLv3" diff --git a/module/plugins/hooks/RapideoPl.py b/module/plugins/hooks/RapideoPl.py index 9eb454897..b605eca17 100644 --- a/module/plugins/hooks/RapideoPl.py +++ b/module/plugins/hooks/RapideoPl.py @@ -1,28 +1,31 @@ # -*- coding: utf-8 -*- +from module.common.json_layer import json_loads from module.plugins.internal.MultiHook import MultiHook -from module.common.json_layer import json_loads as loads class RapideoPl(MultiHook): - __name__ = "RapideoPl" - __version__ = "0.02" - __type__ = "hook" + __name__ = "RapideoPl" + __type__ = "hook" + __version__ = "0.03" - __config__ = [("activated", "bool", "Activated", False), - ("hosterListMode", "all;listed;unlisted", "Use for hosters (if supported):", "all"), - ("hosterList", "str", "Hoster list (comma separated)", ""), - ("unloadFailing", "bool", "Try standard download if download fails", False), - ("interval", "int", "Reload supported hosts interval in hours (0 to disable)", 24)] + __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), + ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), + ("revertfailed" , "bool" , "Revert to standard download if fails", True ), + ("retry" , "int" , "Number of retries before revert" , 10 ), + ("retryinterval" , "int" , "Retry interval in minutes" , 1 ), + ("reload" , "bool" , "Reload plugin list" , True ), + ("reloadinterval", "int" , "Reload interval in hours" , 12 )] + + __description__ = """Rapideo.pl hook plugin""" + __license__ = "GPLv3" + __authors__ = [("goddie", "dev@rapideo.pl")] - __description__ = "Rapideo.pl hook" - __license__ = "GPLv3" - __authors__ = [("goddie", "dev@rapideo.pl")] def getHosters(self): - hostings = loads(self.getURL("https://www.rapideo.pl/clipboard.php?json=3").strip()) + hostings = json_loads(self.getURL("https://www.rapideo.pl/clipboard.php?json=3").strip()) hostings_domains = [domain for row in hostings for domain in row["domains"] if row["sdownload"] == "0"] - self.logDebug(hostings_domains) - return hostings_domains + self.logDebug(hostings_domains) + return hostings_domains diff --git a/module/plugins/hooks/RealdebridCom.py b/module/plugins/hooks/RealdebridCom.py index bac18e6c3..cff97c2f9 100644 --- a/module/plugins/hooks/RealdebridCom.py +++ b/module/plugins/hooks/RealdebridCom.py @@ -6,13 +6,16 @@ from module.plugins.internal.MultiHook import MultiHook class RealdebridCom(MultiHook): __name__ = "RealdebridCom" __type__ = "hook" - __version__ = "0.45" + __version__ = "0.46" - __config__ = [("https", "bool", "Enable HTTPS", False), - ("mode", "all;listed;unlisted", "Use for hosters (if supported):", "all"), - ("pluginlist", "str", "Hoster list (comma separated)", ""), - ("revertfailed", "bool", "Revert to standard download if download fails", False), - ("interval", "int", "Reload interval in hours (0 to disable)", 24)] + __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), + ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), + ("revertfailed" , "bool" , "Revert to standard download if fails", True ), + ("retry" , "int" , "Number of retries before revert" , 10 ), + ("retryinterval" , "int" , "Retry interval in minutes" , 1 ), + ("reload" , "bool" , "Reload plugin list" , True ), + ("reloadinterval", "int" , "Reload interval in hours" , 12 ), + ("ssl" , "bool" , "Use HTTPS" , True )] __description__ = """Real-Debrid.com hook plugin""" __license__ = "GPLv3" @@ -20,7 +23,7 @@ class RealdebridCom(MultiHook): def getHosters(self): - https = "https" if self.getConfig("https") else "http" + https = "https" if self.getConfig("ssl") else "http" page = self.getURL(https + "://real-debrid.com/api/hosters.php").replace("\"", "").strip() return [x.strip() for x in page.split(",") if x.strip()] diff --git a/module/plugins/hooks/RehostTo.py b/module/plugins/hooks/RehostTo.py index 527770eb6..0cb736d9c 100644 --- a/module/plugins/hooks/RehostTo.py +++ b/module/plugins/hooks/RehostTo.py @@ -6,12 +6,15 @@ from module.plugins.internal.MultiHook import MultiHook class RehostTo(MultiHook): __name__ = "RehostTo" __type__ = "hook" - __version__ = "0.46" + __version__ = "0.49" - __config__ = [("mode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), - ("pluginlist", "str", "Hoster list (comma separated)", ""), - ("revertfailed", "bool", "Revert to standard download if download fails", False), - ("interval", "int", "Reload interval in hours (0 to disable)", 24)] + __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), + ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), + ("revertfailed" , "bool" , "Revert to standard download if fails", True ), + ("retry" , "int" , "Number of retries before revert" , 10 ), + ("retryinterval" , "int" , "Retry interval in minutes" , 1 ), + ("reload" , "bool" , "Reload plugin list" , True ), + ("reloadinterval", "int" , "Reload interval in hours" , 12 )] __description__ = """Rehost.to hook plugin""" __license__ = "GPLv3" @@ -19,15 +22,8 @@ class RehostTo(MultiHook): def getHosters(self): + user, data = self.account.selectAccount() page = self.getURL("http://rehost.to/api.php", - get={'cmd': "get_supported_och_dl", 'long_ses': self.long_ses}) + get={'cmd' : "get_supported_och_dl", + 'long_ses': self.account.getAccountData(user)['session']}) return [x.strip() for x in page.replace("\"", "").split(",")] - - - def coreReady(self): - super(RehostTo, self).coreReady() - - user, data = self.account.selectAccount() - - self.ses = data['ses'] - self.long_ses = data['long_ses'] diff --git a/module/plugins/hooks/SimplyPremiumCom.py b/module/plugins/hooks/SimplyPremiumCom.py index 5f2d2a42c..843a3aa82 100644 --- a/module/plugins/hooks/SimplyPremiumCom.py +++ b/module/plugins/hooks/SimplyPremiumCom.py @@ -7,13 +7,15 @@ from module.plugins.internal.MultiHook import MultiHook class SimplyPremiumCom(MultiHook): __name__ = "SimplyPremiumCom" __type__ = "hook" - __version__ = "0.04" - - __config__ = [("activated", "bool", "Activated", "False"), - ("mode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), - ("pluginlist", "str", "Hoster list (comma separated)", ""), - ("revertfailed", "bool", "Revert to standard download if download fails", "False"), - ("interval", "int", "Reload interval in hours (0 to disable)", "24")] + __version__ = "0.05" + + __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), + ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), + ("revertfailed" , "bool" , "Revert to standard download if fails", True ), + ("retry" , "int" , "Number of retries before revert" , 10 ), + ("retryinterval" , "int" , "Retry interval in minutes" , 1 ), + ("reload" , "bool" , "Reload plugin list" , True ), + ("reloadinterval", "int" , "Reload interval in hours" , 12 )] __description__ = """Simply-Premium.com hook plugin""" __license__ = "GPLv3" diff --git a/module/plugins/hooks/SimplydebridCom.py b/module/plugins/hooks/SimplydebridCom.py index 13c957294..10c613fb5 100644 --- a/module/plugins/hooks/SimplydebridCom.py +++ b/module/plugins/hooks/SimplydebridCom.py @@ -6,10 +6,15 @@ from module.plugins.internal.MultiHook import MultiHook class SimplydebridCom(MultiHook): __name__ = "SimplydebridCom" __type__ = "hook" - __version__ = "0.03" + __version__ = "0.04" - __config__ = [("mode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), - ("pluginlist", "str", "Hoster list (comma separated)", "")] + __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), + ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), + ("revertfailed" , "bool" , "Revert to standard download if fails", True ), + ("retry" , "int" , "Number of retries before revert" , 10 ), + ("retryinterval" , "int" , "Retry interval in minutes" , 1 ), + ("reload" , "bool" , "Reload plugin list" , True ), + ("reloadinterval", "int" , "Reload interval in hours" , 12 )] __description__ = """Simply-Debrid.com hook plugin""" __license__ = "GPLv3" diff --git a/module/plugins/hooks/SkipRev.py b/module/plugins/hooks/SkipRev.py index cc32c365e..ad6d7dacd 100644 --- a/module/plugins/hooks/SkipRev.py +++ b/module/plugins/hooks/SkipRev.py @@ -18,7 +18,7 @@ def _setup(self): class SkipRev(Hook): __name__ = "SkipRev" __type__ = "hook" - __version__ = "0.21" + __version__ = "0.22" __config__ = [("tokeep", "int", "Number of rev files to keep for package (-1 to auto)", -1)] @@ -33,23 +33,11 @@ class SkipRev(Hook): def _pyname(self, pyfile): - url = pyfile.url - plugin = pyfile.plugin - - if hasattr(plugin, "info") and 'name' in plugin.info and plugin.info['name']: - name = plugin.info['name'] - - elif hasattr(plugin, "parseInfos"): - name = next(plugin.parseInfos([url]))['name'] - - elif hasattr(plugin, "getInfo"): #@NOTE: if parseInfos was not found, getInfo should be missing too - name = plugin.getInfo(url)['name'] - + if hasattr(pyfile.pluginmodule, "getInfo"): + return getattr(pyfile.pluginmodule, "getInfo")([pyfile.url])[0][0] else: self.logWarning("Unable to grab file name") - name = urlparse(unquote(url)).path.split('/')[-1] - - return name + return urlparse(unquote(pyfile.url)).path.split('/')[-1] def _pyfile(self, link): diff --git a/module/plugins/hooks/SmoozedCom.py b/module/plugins/hooks/SmoozedCom.py new file mode 100644 index 000000000..4e706c959 --- /dev/null +++ b/module/plugins/hooks/SmoozedCom.py @@ -0,0 +1,26 @@ +# -*- coding: utf-8 -*- + +from module.plugins.internal.MultiHook import MultiHook + + +class SmoozedCom(MultiHook): + __name__ = "SmoozedCom" + __type__ = "hook" + __version__ = "0.02" + + __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), + ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), + ("revertfailed" , "bool" , "Revert to standard download if fails", True ), + ("retry" , "int" , "Number of retries before revert" , 10 ), + ("retryinterval" , "int" , "Retry interval in minutes" , 1 ), + ("reload" , "bool" , "Reload plugin list" , True ), + ("reloadinterval", "int" , "Reload interval in hours" , 12 )] + + __description__ = """Smoozed.com hook plugin""" + __license__ = "GPLv3" + __authors__ = [("", "")] + + + def getHosters(self): + user, data = self.account.selectAccount() + return self.account.getAccountData(user)["hosters"] diff --git a/module/plugins/hooks/UnrestrictLi.py b/module/plugins/hooks/UnrestrictLi.py index e481e8449..cb5abb26e 100644 --- a/module/plugins/hooks/UnrestrictLi.py +++ b/module/plugins/hooks/UnrestrictLi.py @@ -7,13 +7,16 @@ from module.plugins.internal.MultiHook import MultiHook class UnrestrictLi(MultiHook): __name__ = "UnrestrictLi" __type__ = "hook" - __version__ = "0.04" + __version__ = "0.05" - __config__ = [("mode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), - ("pluginlist", "str", "Hoster list (comma separated)", ""), - ("revertfailed", "bool", "Revert to standard download if download fails", False), - ("interval", "int", "Reload interval in hours (0 to disable)", 24), - ("history", "bool", "Delete History", False)] + __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), + ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), + ("revertfailed" , "bool" , "Revert to standard download if fails", True ), + ("retry" , "int" , "Number of retries before revert" , 10 ), + ("retryinterval" , "int" , "Retry interval in minutes" , 1 ), + ("reload" , "bool" , "Reload plugin list" , True ), + ("reloadinterval", "int" , "Reload interval in hours" , 12 ), + ("history" , "bool" , "Delete History" , False)] __description__ = """Unrestrict.li hook plugin""" __license__ = "GPLv3" @@ -24,6 +27,4 @@ class UnrestrictLi(MultiHook): json_data = self.getURL("http://unrestrict.li/api/jdownloader/hosts.php", get={'format': "json"}) json_data = json_loads(json_data) - host_list = [element['host'] for element in json_data['result']] - - return host_list + return [element['host'] for element in json_data['result']] diff --git a/module/plugins/hooks/XFileSharingPro.py b/module/plugins/hooks/XFileSharingPro.py index 79e373ad3..0745a6c7e 100644 --- a/module/plugins/hooks/XFileSharingPro.py +++ b/module/plugins/hooks/XFileSharingPro.py @@ -8,7 +8,7 @@ from module.plugins.Hook import Hook class XFileSharingPro(Hook): __name__ = "XFileSharingPro" __type__ = "hook" - __version__ = "0.28" + __version__ = "0.30" __config__ = [("activated" , "bool", "Activated" , True ), ("use_hoster_list" , "bool", "Load listed hosters only" , False), @@ -23,14 +23,15 @@ class XFileSharingPro(Hook): # event_list = ["pluginConfigChanged"] - regexp = {'hoster' : (r'https?://(?:www\.)?([\w.^_]+(?:\.[a-zA-Z]{2,})(?:\:\d+)?)/(?:embed-)?\w{12}(?:\W|$)', - r'https?://(?:[^/]+\.)?(%s)/(?:embed-)?\w+'), - 'crypter': (r'https?://(?:www\.)?([\w.^_]+(?:\.[a-zA-Z]{2,})(?:\:\d+)?)/(?:user|folder)s?/\w+', - r'https?://(?:[^/]+\.)?(%s)/(?:user|folder)s?/\w+')} + regexp = {'hoster' : (r'https?://(?:www\.)?(?P<DOMAIN>[\w.^_]+(?:\.[a-zA-Z]{2,})(?:\:\d+)?)/(?:embed-)?\w{12}(?:\W|$)', + r'https?://(?:[^/]+\.)?(?P<DOMAIN>%s)/(?:embed-)?\w+'), + 'crypter': (r'https?://(?:www\.)?(?P<DOMAIN>[\w.^_]+(?:\.[a-zA-Z]{2,})(?:\:\d+)?)/(?:user|folder)s?/\w+', + r'https?://(?:[^/]+\.)?(?P<DOMAIN>%s)/(?:user|folder)s?/\w+')} HOSTER_BUILTIN = [#WORKING HOSTERS: - "eyesfile.ca", "file4safe.com", "fileband.com", "filedwon.com", "filevice.com", "hostingbulk.com", - "ravishare.com", "salefiles.com", "sharesix.com", "thefile.me", "verzend.be", "xvidstage.com", + "180upload.com", "backin.net", "eyesfile.ca", "file4safe.com", "fileband.com", "filedwon.com", + "fileparadox.in", "filevice.com", "hostingbulk.com", "linestorage.com", "ravishare.com", "ryushare.com", + "salefiles.com", "sendmyway.com", "sharesix.com", "thefile.me", "verzend.be", "xvidstage.com", #NOT TESTED: "101shared.com", "4upfiles.com", "filemaze.ws", "filenuke.com", "linkzhost.com", "mightyupload.com", "rockdizfile.com", "sharebeast.com", "sharerepo.com", "shareswift.com", "uploadbaz.com", "uploadc.com", @@ -82,7 +83,7 @@ class XFileSharingPro(Hook): len_match_list = len(plugin_list) self.logInfo(_("Handling %d %s%s: %s") % (len_match_list, type, - "" if len_match_list is 1 else "s", + "" if len_match_list == 1 else "s", match_list.replace('|', ', '))) pattern = self.regexp[type][1] % match_list.replace('.', '\.') @@ -109,7 +110,7 @@ class XFileSharingPro(Hook): def unloadHoster(self, hoster): hdict = self.core.pluginManager.hosterPlugins[hoster] - if "new_name" in hdict and hdict['new_name'] is "XFileSharingPro": + if "new_name" in hdict and hdict['new_name'] == "XFileSharingPro": if "module" in hdict: del hdict['module'] @@ -123,7 +124,7 @@ class XFileSharingPro(Hook): # def downloadFailed(self, pyfile): - # if pyfile.pluginname is "BasePlugin" \ + # if pyfile.pluginname == "BasePlugin" \ # and pyfile.hasStatus("failed") \ # and not self.getConfig("use_hoster_list") \ # and self.unloadHoster("BasePlugin"): diff --git a/module/plugins/hooks/ZeveraCom.py b/module/plugins/hooks/ZeveraCom.py index 51f759b1c..215ec3673 100644 --- a/module/plugins/hooks/ZeveraCom.py +++ b/module/plugins/hooks/ZeveraCom.py @@ -6,16 +6,22 @@ from module.plugins.internal.MultiHook import MultiHook class ZeveraCom(MultiHook): __name__ = "ZeveraCom" __type__ = "hook" - __version__ = "0.04" + __version__ = "0.05" - __config__ = [("mode", "all;listed;unlisted", "Use for hosters (if supported)", "all"), - ("pluginlist", "str", "Hoster list (comma separated)", "")] + __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), + ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), + ("revertfailed" , "bool" , "Revert to standard download if fails", True ), + ("retry" , "int" , "Number of retries before revert" , 10 ), + ("retryinterval" , "int" , "Retry interval in minutes" , 1 ), + ("reload" , "bool" , "Reload plugin list" , True ), + ("reloadinterval", "int" , "Reload interval in hours" , 12 )] - __description__ = """Real-Debrid.com hook plugin""" + __description__ = """Zevera.com hook plugin""" __license__ = "GPLv3" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] + __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), + ("Walter Purcaro", "vuolter@gmail.com")] def getHosters(self): - page = self.getURL("http://www.zevera.com/jDownloader.ashx", get={'cmd': "gethosters"}) - return [x.strip() for x in page.replace("\"", "").split(",")] + html = self.account.api_response(pyreq.getHTTPRequest(timeout=120), cmd="gethosters") + return [x.strip() for x in html.split(",")] diff --git a/module/plugins/hoster/AlldebridCom.py b/module/plugins/hoster/AlldebridCom.py index 751ff415c..1fcb4d784 100644 --- a/module/plugins/hoster/AlldebridCom.py +++ b/module/plugins/hoster/AlldebridCom.py @@ -13,11 +13,11 @@ from module.utils import parseFileSize class AlldebridCom(MultiHoster): __name__ = "AlldebridCom" __type__ = "hoster" - __version__ = "0.42" + __version__ = "0.44" __pattern__ = r'https?://(?:www\.|s\d+\.)?alldebrid\.com/dl/[\w^_]+' - __description__ = """Alldebrid.com hoster plugin""" + __description__ = """Alldebrid.com multi-hoster plugin""" __license__ = "GPLv3" __authors__ = [("Andy Voigt", "spamsales@online.de")] @@ -38,11 +38,11 @@ class AlldebridCom(MultiHoster): self.chunkLimit = 16 - def handlePremium(self): + def handlePremium(self, pyfile): password = self.getPassword() data = json_loads(self.load("http://www.alldebrid.com/service.php", - get={'link': self.pyfile.url, 'json': "true", 'pw': password})) + get={'link': pyfile.url, 'json': "true", 'pw': password})) self.logDebug("Json data", data) @@ -53,29 +53,29 @@ class AlldebridCom(MultiHoster): self.logWarning(data['error']) self.tempOffline() else: - if self.pyfile.name and not self.pyfile.name.endswith('.tmp'): - self.pyfile.name = data['filename'] - self.pyfile.size = parseFileSize(data['filesize']) + if pyfile.name and not pyfile.name.endswith('.tmp'): + pyfile.name = data['filename'] + pyfile.size = parseFileSize(data['filesize']) self.link = data['link'] - if self.getConfig("https"): + if self.getConfig("ssl"): self.link = self.link.replace("http://", "https://") else: self.link = self.link.replace("https://", "http://") - if self.link != self.pyfile.url: + if self.link != pyfile.url: self.logDebug("New URL: %s" % self.link) - if self.pyfile.name.startswith("http") or self.pyfile.name.startswith("Unknown"): + if pyfile.name.startswith("http") or pyfile.name.startswith("Unknown"): #only use when name wasnt already set - self.pyfile.name = self.getFilename(self.link) + pyfile.name = self.getFilename(self.link) def checkFile(self): - super(AlldebridCom, self).checkFile() - - if self.checkDownload({'error': "<title>An error occured while processing your request</title>"}) is "error": + if self.checkDownload({'error': "<title>An error occured while processing your request</title>"}) == "error": self.retry(wait_time=60, reason=_("An error occured while generating link")) + return super(AlldebridCom, self).checkFile() + getInfo = create_getInfo(AlldebridCom) diff --git a/module/plugins/hoster/BasePlugin.py b/module/plugins/hoster/BasePlugin.py index d0d8e7cc8..6d3132e65 100644 --- a/module/plugins/hoster/BasePlugin.py +++ b/module/plugins/hoster/BasePlugin.py @@ -13,7 +13,7 @@ from module.plugins.Hoster import Hoster class BasePlugin(Hoster): __name__ = "BasePlugin" __type__ = "hoster" - __version__ = "0.26" + __version__ = "0.30" __pattern__ = r'^unmatchable$' @@ -25,7 +25,13 @@ class BasePlugin(Hoster): @classmethod def getInfo(cls, url="", html=""): #@TODO: Move to hoster class in 0.4.10 - return {'name': urlparse(unquote(url)).path.split('/')[-1] or _("Unknown"), 'size': 0, 'status': 3 if url else 1, 'url': unquote(url) or ""} + url = unquote(url) + return {'name' : (urlparse(url).path.split('/')[-1] + or urlparse(url).query.split('=', 1)[::-1][0].split('&', 1)[0] + or _("Unknown")), + 'size' : 0, + 'status': 3 if url else 8, + 'url' : url} def setup(self): @@ -58,7 +64,7 @@ class BasePlugin(Hoster): if server in servers: self.logDebug("Logging on to %s" % server) - self.req.addAuth(account.accounts[server]['password']) + self.req.addAuth(account.getAccountData(server)['password']) else: pwd = self.getPassword() if ':' in pwd: @@ -72,8 +78,11 @@ class BasePlugin(Hoster): else: self.fail(_("No file downloaded")) #@TODO: Move to hoster class in 0.4.10 - if self.checkDownload({'empty': re.compile(r"^$")}) is "empty": #@TODO: Move to hoster in 0.4.10 - self.fail(_("Empty file")) + check = self.checkDownload({'empty file': re.compile(r'\A\Z'), + 'html file' : re.compile(r'\A\s*<!DOCTYPE html'), + 'html error': re.compile(r'\A\s*(<.+>)?\d{3}(\Z|\s+)')}) + if check: + self.fail(check.capitalize()) def downloadFile(self, pyfile): diff --git a/module/plugins/hoster/BezvadataCz.py b/module/plugins/hoster/BezvadataCz.py index 9ca4b4b1a..8d56f1ff6 100644 --- a/module/plugins/hoster/BezvadataCz.py +++ b/module/plugins/hoster/BezvadataCz.py @@ -8,7 +8,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class BezvadataCz(SimpleHoster): __name__ = "BezvadataCz" __type__ = "hoster" - __version__ = "0.25" + __version__ = "0.26" __pattern__ = r'http://(?:www\.)?bezvadata\.cz/stahnout/.+' @@ -27,7 +27,7 @@ class BezvadataCz(SimpleHoster): self.multiDL = True - def handleFree(self): + def handleFree(self, pyfile): #download button m = re.search(r'<a class="stahnoutSoubor".*?href="(.*?)"', self.html) if m is None: diff --git a/module/plugins/hoster/BitshareCom.py b/module/plugins/hoster/BitshareCom.py index 1c5c53f55..f7b4d2709 100644 --- a/module/plugins/hoster/BitshareCom.py +++ b/module/plugins/hoster/BitshareCom.py @@ -11,7 +11,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class BitshareCom(SimpleHoster): __name__ = "BitshareCom" __type__ = "hoster" - __version__ = "0.51" + __version__ = "0.52" __pattern__ = r'http://(?:www\.)?bitshare\.com/(files/)?(?(1)|\?f=)(?P<ID>\w+)(?(1)/(?P<NAME>.+?)\.html)' @@ -73,12 +73,7 @@ class BitshareCom(SimpleHoster): # This may either download our file or forward us to an error page self.download(self.getDownloadUrl()) - check = self.checkDownload({"404": ">404 Not Found<", "Error": ">Error occured<"}) - - if check == "404": - self.retry(3, 60, 'Error 404') - - elif check == "error": + if self.checkDownload({"error": ">Error occured<"}): self.retry(5, 5 * 60, "Bitshare host : Error occured") diff --git a/module/plugins/hoster/CatShareNet.py b/module/plugins/hoster/CatShareNet.py index 949a021dd..f2ddd64a0 100644 --- a/module/plugins/hoster/CatShareNet.py +++ b/module/plugins/hoster/CatShareNet.py @@ -9,7 +9,7 @@ from module.plugins.internal.CaptchaService import ReCaptcha class CatShareNet(SimpleHoster): __name__ = "CatShareNet" __type__ = "hoster" - __version__ = "0.08" + __version__ = "0.09" __pattern__ = r'http://(?:www\.)?catshare\.net/\w{16}' @@ -27,7 +27,7 @@ class CatShareNet(SimpleHoster): IP_BLOCKED_PATTERN = ur'>Nasz serwis wykrył że Twój adres IP nie pochodzi z Polski.<' SECONDS_PATTERN = 'var\scount\s=\s(\d+);' - LINK_PATTERN = r'<form action="(.+?)" method="GET">' + LINK_FREE_PATTERN = r'<form action="(.+?)" method="GET">' def setup(self): @@ -42,7 +42,7 @@ class CatShareNet(SimpleHoster): return super(CatShareNet, self).getFileInfo() - def handleFree(self): + def handleFree(self, pyfile): m = re.search(self.SECONDS_PATTERN, self.html) if m: wait_time = int(m.group(1)) @@ -51,11 +51,11 @@ class CatShareNet(SimpleHoster): recaptcha = ReCaptcha(self) challenge, response = recaptcha.challenge() - self.html = self.load(self.pyfile.url, + self.html = self.load(pyfile.url, post={'recaptcha_challenge_field': challenge, 'recaptcha_response_field' : response}) - m = re.search(self.LINK_PATTERN, self.html) + m = re.search(self.LINK_FREE_PATTERN, self.html) if m is None: self.invalidCaptcha() self.retry(reason=_("Wrong captcha entered")) diff --git a/module/plugins/hoster/CloudzillaTo.py b/module/plugins/hoster/CloudzillaTo.py index d8b5e8b5d..58b1ac0dd 100644 --- a/module/plugins/hoster/CloudzillaTo.py +++ b/module/plugins/hoster/CloudzillaTo.py @@ -8,7 +8,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class CloudzillaTo(SimpleHoster): __name__ = "CloudzillaTo" __type__ = "hoster" - __version__ = "0.05" + __version__ = "0.06" __pattern__ = r'http://(?:www\.)?cloudzilla\.to/share/file/(?P<ID>[\w^_]+)' @@ -32,7 +32,7 @@ class CloudzillaTo(SimpleHoster): self.retry(reason="Wrong password") - def handleFree(self): + def handleFree(self, pyfile): self.html = self.load("http://www.cloudzilla.to/generateticket/", post={'file_id': self.info['pattern']['ID'], 'key': self.getPassword()}) @@ -54,8 +54,8 @@ class CloudzillaTo(SimpleHoster): 'ticket_id': ticket['ticket_id']} - def handlePremium(self): - return self.handleFree() + def handlePremium(self, pyfile): + return self.handleFree(pyfile) getInfo = create_getInfo(CloudzillaTo) diff --git a/module/plugins/hoster/CrockoCom.py b/module/plugins/hoster/CrockoCom.py index e5f94800b..31d0eec95 100644 --- a/module/plugins/hoster/CrockoCom.py +++ b/module/plugins/hoster/CrockoCom.py @@ -9,7 +9,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class CrockoCom(SimpleHoster): __name__ = "CrockoCom" __type__ = "hoster" - __version__ = "0.17" + __version__ = "0.18" __pattern__ = r'http://(?:www\.)?(crocko|easy-share)\.com/\w+' @@ -30,7 +30,7 @@ class CrockoCom(SimpleHoster): NAME_REPLACEMENTS = [(r'<[^>]*>', '')] - def handleFree(self): + def handleFree(self, pyfile): if "You need Premium membership to download this file." in self.html: self.fail(_("You need Premium membership to download this file")) @@ -55,11 +55,7 @@ class CrockoCom(SimpleHoster): inputs['recaptcha_challenge_field'], inputs['recaptcha_response_field'] = recaptcha.challenge() self.download(action, post=inputs) - check = self.checkDownload({ - "captcha_err": recaptcha.KEY_AJAX_PATTERN - }) - - if check == "captcha_err": + if self.checkDownload({"captcha": recaptcha.KEY_AJAX_PATTERN}): self.invalidCaptcha() else: break diff --git a/module/plugins/hoster/CzshareCom.py b/module/plugins/hoster/CzshareCom.py index aa381d712..fb9e7f457 100644 --- a/module/plugins/hoster/CzshareCom.py +++ b/module/plugins/hoster/CzshareCom.py @@ -12,7 +12,7 @@ from module.utils import parseFileSize class CzshareCom(SimpleHoster): __name__ = "CzshareCom" __type__ = "hoster" - __version__ = "0.96" + __version__ = "0.97" __pattern__ = r'http://(?:www\.)?(czshare|sdilej)\.(com|cz)/(\d+/|download\.php\?).+' @@ -63,7 +63,7 @@ class CzshareCom(SimpleHoster): return True - def handlePremium(self): + def handlePremium(self, pyfile): # parse download link try: form = re.search(self.PREMIUM_FORM_PATTERN, self.html, re.S).group(1) @@ -77,12 +77,14 @@ class CzshareCom(SimpleHoster): self.checkDownloadedFile() - def handleFree(self): + def handleFree(self, pyfile): # get free url m = re.search(self.FREE_URL_PATTERN, self.html) if m is None: self.error(_("FREE_URL_PATTERN not found")) + parsed_url = "http://sdilej.cz" + m.group(1) + self.logDebug("PARSED_URL:" + parsed_url) # get download ticket and parse html @@ -93,7 +95,8 @@ class CzshareCom(SimpleHoster): try: form = re.search(self.FREE_FORM_PATTERN, self.html, re.S).group(1) inputs = dict(re.findall(self.FORM_INPUT_PATTERN, form)) - self.pyfile.size = int(inputs['size']) + pyfile.size = int(inputs['size']) + except Exception, e: self.logError(e) self.error(_("Form")) @@ -103,10 +106,13 @@ class CzshareCom(SimpleHoster): for _i in xrange(5): inputs['captchastring2'] = self.decryptCaptcha(captcha_url) self.html = self.load(parsed_url, cookies=True, post=inputs, decode=True) + if u"<li>Zadaný ověřovací kód nesouhlasí!</li>" in self.html: self.invalidCaptcha() + elif re.search(self.MULTIDL_PATTERN, self.html): self.longWait(5 * 60, 12) + else: self.correctCaptcha() break @@ -118,6 +124,7 @@ class CzshareCom(SimpleHoster): # download the file, destination is determined by pyLoad self.logDebug("WAIT URL", self.req.lastEffectiveURL) + m = re.search("free_wait.php\?server=(.*?)&(.*)", self.req.lastEffectiveURL) if m is None: self.error(_("Download URL not found")) @@ -132,19 +139,22 @@ class CzshareCom(SimpleHoster): def checkDownloadedFile(self): # check download check = self.checkDownload({ - "temp_offline": re.compile(r"^Soubor je do.*asn.* nedostupn.*$"), - "credit": re.compile(r"^Nem.*te dostate.*n.* kredit.$"), - "multi_dl": re.compile(self.MULTIDL_PATTERN), - "captcha_err": "<li>Zadaný ověřovací kód nesouhlasí!</li>" + "temp offline" : re.compile(r"^Soubor je do.*asn.* nedostupn.*$"), + "credit" : re.compile(r"^Nem.*te dostate.*n.* kredit.$"), + "multi-dl" : re.compile(self.MULTIDL_PATTERN), + "captcha" : "<li>Zadaný ověřovací kód nesouhlasí!</li>" }) - if check == "temp_offline": + if check == "temp offline": self.fail(_("File not available - try later")) - if check == "credit": + + elif check == "credit": self.resetAccount() - elif check == "multi_dl": + + elif check == "multi-dl": self.longWait(5 * 60, 12) - elif check == "captcha_err": + + elif check == "captcha": self.invalidCaptcha() self.retry() diff --git a/module/plugins/hoster/DataHu.py b/module/plugins/hoster/DataHu.py index 437fea7cd..f4b0692a8 100644 --- a/module/plugins/hoster/DataHu.py +++ b/module/plugins/hoster/DataHu.py @@ -11,7 +11,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class DataHu(SimpleHoster): __name__ = "DataHu" __type__ = "hoster" - __version__ = "0.02" + __version__ = "0.03" __pattern__ = r'http://(?:www\.)?data\.hu/get/\w+' @@ -23,7 +23,7 @@ class DataHu(SimpleHoster): INFO_PATTERN = ur'<title>(?P<N>.*) \((?P<S>[^)]+)\) let\xf6lt\xe9se</title>' OFFLINE_PATTERN = ur'Az adott f\xe1jl nem l\xe9tezik' - LINK_PATTERN = r'<div class="download_box_button"><a href="([^"]+)">' + LINK_FREE_PATTERN = r'<div class="download_box_button"><a href="([^"]+)">' def setup(self): @@ -31,12 +31,4 @@ class DataHu(SimpleHoster): self.multiDL = self.premium - def handleFree(self): - m = re.search(self.LINK_PATTERN, self.html) - if m is None: - self.error(_("LINK_PATTERN not found")) - - self.download(m.group(1), disposition=True) - - getInfo = create_getInfo(DataHu) diff --git a/module/plugins/hoster/DataportCz.py b/module/plugins/hoster/DataportCz.py index 8e74f5553..266199616 100644 --- a/module/plugins/hoster/DataportCz.py +++ b/module/plugins/hoster/DataportCz.py @@ -6,7 +6,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class DataportCz(SimpleHoster): __name__ = "DataportCz" __type__ = "hoster" - __version__ = "0.40" + __version__ = "0.41" __pattern__ = r'http://(?:www\.)?dataport\.cz/file/(.+)' @@ -23,7 +23,7 @@ class DataportCz(SimpleHoster): FREE_SLOTS_PATTERN = ur'Počet volných slotů: <span class="darkblue">(\d+)</span><br />' - def handleFree(self): + def handleFree(self, pyfile): captchas = {"1": "jkeG", "2": "hMJQ", "3": "vmEK", "4": "ePQM", "5": "blBd"} for _i in xrange(60): @@ -40,14 +40,16 @@ class DataportCz(SimpleHoster): self.html = self.download("http://www.dataport.cz%s" % action, post=inputs) check = self.checkDownload({"captcha": 'alert("\u0160patn\u011b opsan\u00fd k\u00f3d z obr\u00e1zu");', - "slot": 'alert("Je n\u00e1m l\u00edto, ale moment\u00e1ln\u011b nejsou'}) + "slot" : 'alert("Je n\u00e1m l\u00edto, ale moment\u00e1ln\u011b nejsou'}) if check == "captcha": self.error(_("invalid captcha")) + elif check == "slot": self.logDebug("No free slots - wait 60s and retry") self.wait(60, False) - self.html = self.load(self.pyfile.url, decode=True) + self.html = self.load(pyfile.url, decode=True) continue + else: break diff --git a/module/plugins/hoster/DateiTo.py b/module/plugins/hoster/DateiTo.py index e4bff8458..99b86e000 100644 --- a/module/plugins/hoster/DateiTo.py +++ b/module/plugins/hoster/DateiTo.py @@ -9,7 +9,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class DateiTo(SimpleHoster): __name__ = "DateiTo" __type__ = "hoster" - __version__ = "0.05" + __version__ = "0.06" __pattern__ = r'http://(?:www\.)?datei\.to/datei/(?P<ID>\w+)\.html' @@ -28,7 +28,7 @@ class DateiTo(SimpleHoster): DATA_PATTERN = r'url: "(.*?)", data: "(.*?)",' - def handleFree(self): + def handleFree(self, pyfile): url = 'http://datei.to/ajax/download.php' data = {'P': 'I', 'ID': self.info['pattern']['ID']} recaptcha = ReCaptcha(self) diff --git a/module/plugins/hoster/DebridItaliaCom.py b/module/plugins/hoster/DebridItaliaCom.py index 11b6da918..8cda56c0c 100644 --- a/module/plugins/hoster/DebridItaliaCom.py +++ b/module/plugins/hoster/DebridItaliaCom.py @@ -8,11 +8,11 @@ from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo class DebridItaliaCom(MultiHoster): __name__ = "DebridItaliaCom" __type__ = "hoster" - __version__ = "0.16" + __version__ = "0.17" __pattern__ = r'https?://(?:www\.|s\d+\.)?debriditalia\.com/dl/\d+' - __description__ = """Debriditalia.com hoster plugin""" + __description__ = """Debriditalia.com multi-hoster plugin""" __license__ = "GPLv3" __authors__ = [("stickell", "l.stickell@yahoo.it"), ("Walter Purcaro", "vuolter@gmail.com")] @@ -21,9 +21,9 @@ class DebridItaliaCom(MultiHoster): URL_REPLACEMENTS = [("https://", "http://")] - def handlePremium(self): + def handlePremium(self, pyfile): self.html = self.load("http://www.debriditalia.com/api.php", - get={'generate': "on", 'link': self.pyfile.url, 'p': self.getPassword()}) + get={'generate': "on", 'link': pyfile.url, 'p': self.getPassword()}) if "ERROR:" not in self.html: self.link = self.html.strip() @@ -32,7 +32,7 @@ class DebridItaliaCom(MultiHoster): self.html = self.load("http://debriditalia.com/linkgen2.php", post={'xjxfun' : "convertiLink", - 'xjxargs[]': "S<![CDATA[%s]]>" % self.pyfile.url, + 'xjxargs[]': "S<![CDATA[%s]]>" % pyfile.url, 'xjxargs[]': "S%s" % self.getPassword()}) try: self.link = re.search(r'<a href="(.+?)"', self.html).group(1) diff --git a/module/plugins/hoster/DepositfilesCom.py b/module/plugins/hoster/DepositfilesCom.py index 6588a3b37..9d060e75d 100644 --- a/module/plugins/hoster/DepositfilesCom.py +++ b/module/plugins/hoster/DepositfilesCom.py @@ -11,7 +11,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class DepositfilesCom(SimpleHoster): __name__ = "DepositfilesCom" __type__ = "hoster" - __version__ = "0.51" + __version__ = "0.52" __pattern__ = r'https?://(?:www\.)?(depositfiles\.com|dfiles\.(eu|ru))(/\w{1,3})?/files/(?P<ID>\w+)' @@ -32,14 +32,12 @@ class DepositfilesCom(SimpleHoster): COOKIES = [("dfiles.eu", "lang_current", "en")] - FREE_LINK_PATTERN = r'<form id="downloader_file_form" action="(http://.+?\.(dfiles\.eu|depositfiles\.com)/.+?)" method="post"' - PREMIUM_LINK_PATTERN = r'class="repeat"><a href="(.+?)"' - PREMIUM_MIRROR_PATTERN = r'class="repeat_mirror"><a href="(.+?)"' + LINK_FREE_PATTERN = r'<form id="downloader_file_form" action="(http://.+?\.(dfiles\.eu|depositfiles\.com)/.+?)" method="post"' + LINK_PREMIUM_PATTERN = r'class="repeat"><a href="(.+?)"' + LINK_MIRROR_PATTERN = r'class="repeat_mirror"><a href="(.+?)"' - def handleFree(self): - self.html = self.load(self.pyfile.url, post={"gateway_result": "1"}, cookies=True) - + def handleFree(self, pyfile): if re.search(r'File is checked, please try again in a minute.', self.html) is not None: self.logInfo(_("The file is being checked. Waiting 1 minute")) self.retry(wait_time=60) @@ -83,7 +81,7 @@ class DepositfilesCom(SimpleHoster): self.logDebug(params) continue - m = re.search(self.FREE_LINK_PATTERN, self.html) + m = re.search(self.LINK_FREE_PATTERN, self.html) if m: if 'response' in params: self.correctCaptcha() @@ -101,7 +99,7 @@ class DepositfilesCom(SimpleHoster): self.retry(wait_time=60) - def handlePremium(self): + def handlePremium(self, pyfile): if '<span class="html_download_api-gold_traffic_limit">' in self.html: self.logWarning(_("Download limit reached")) self.retry(25, 60 * 60, "Download limit reached") @@ -109,8 +107,8 @@ class DepositfilesCom(SimpleHoster): self.account.relogin(self.user) self.retry() else: - link = re.search(self.PREMIUM_LINK_PATTERN, self.html) - mirror = re.search(self.PREMIUM_MIRROR_PATTERN, self.html) + link = re.search(self.LINK_PREMIUM_PATTERN, self.html) + mirror = re.search(self.LINK_MIRROR_PATTERN, self.html) if link: dlink = link.group(1) elif mirror: diff --git a/module/plugins/hoster/DevhostSt.py b/module/plugins/hoster/DevhostSt.py index 85e36edb3..2a8734655 100644 --- a/module/plugins/hoster/DevhostSt.py +++ b/module/plugins/hoster/DevhostSt.py @@ -11,7 +11,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class DevhostSt(SimpleHoster): __name__ = "DevhostSt" __type__ = "hoster" - __version__ = "0.03" + __version__ = "0.04" __pattern__ = r'http://(?:www\.)?d-h\.st/(?!users/)\w{3}' @@ -24,7 +24,7 @@ class DevhostSt(SimpleHoster): SIZE_PATTERN = r'>Size:</span> (?P<S>[\d.,]+) (?P<U>[\w^_]+)' OFFLINE_PATTERN = r'>File Not Found<' - LINK_PATTERN = r'id="downloadfile" href="(.+?)"' + LINK_FREE_PATTERN = r'id="downloadfile" href="(.+?)"' def setup(self): @@ -32,17 +32,4 @@ class DevhostSt(SimpleHoster): self.chunkLimit = 1 - def handleFree(self): - m = re.search(self.LINK_PATTERN, self.html) - if m is None: - self.error(_("Download link not found")) - - dl_url = m.group(1) - self.download(dl_url, disposition=True) - - check = self.checkDownload({'html': re.compile("html")}) - if check == "html": - self.error(_("Downloaded file is an html page")) - - getInfo = create_getInfo(DevhostSt) diff --git a/module/plugins/hoster/DlFreeFr.py b/module/plugins/hoster/DlFreeFr.py index 793c81b1c..ec40b64ce 100644 --- a/module/plugins/hoster/DlFreeFr.py +++ b/module/plugins/hoster/DlFreeFr.py @@ -36,7 +36,7 @@ class CustomBrowser(Browser): class DlFreeFr(SimpleHoster): __name__ = "DlFreeFr" __type__ = "hoster" - __version__ = "0.26" + __version__ = "0.27" __pattern__ = r'http://(?:www\.)?dl\.free\.fr/(\w+|getfile\.pl\?file=/\w+)' @@ -78,7 +78,7 @@ class DlFreeFr(SimpleHoster): if content_type and content_type.startswith("text/html"): # Undirect acces to requested file, with a web page providing it (captcha) self.html = self.load(valid_url) - self.handleFree() + self.handleFree(pyfile) else: # Direct access to requested file for users using free.fr as Internet Service Provider. self.download(valid_url, disposition=True) @@ -88,7 +88,7 @@ class DlFreeFr(SimpleHoster): self.fail(_("Invalid return code: ") + str(headers.get('code'))) - def handleFree(self): + def handleFree(self, pyfile): action, inputs = self.parseHtmlForm('action="getfile.pl"') adyoulike = AdYouLike(self) diff --git a/module/plugins/hoster/DropboxCom.py b/module/plugins/hoster/DropboxCom.py index 658974d13..a8ef5b4bc 100644 --- a/module/plugins/hoster/DropboxCom.py +++ b/module/plugins/hoster/DropboxCom.py @@ -8,7 +8,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class DropboxCom(SimpleHoster): __name__ = "DropboxCom" __type__ = "hoster" - __version__ = "0.03" + __version__ = "0.04" __pattern__ = r'https?://(?:www\.)?dropbox\.com/.+' @@ -31,12 +31,8 @@ class DropboxCom(SimpleHoster): self.resumeDownload = True - def handleFree(self): - self.download(self.pyfile.url, get={'dl': "1"}) - - check = self.checkDownload({'html': re.compile("html")}) - if check == "html": - self.error(_("Downloaded file is an html page")) + def handleFree(self, pyfile): + self.download(pyfile.url, get={'dl': "1"}) getInfo = create_getInfo(DropboxCom) diff --git a/module/plugins/hoster/EdiskCz.py b/module/plugins/hoster/EdiskCz.py index eb9338871..f8ccc972e 100644 --- a/module/plugins/hoster/EdiskCz.py +++ b/module/plugins/hoster/EdiskCz.py @@ -8,7 +8,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class EdiskCz(SimpleHoster): __name__ = "EdiskCz" __type__ = "hoster" - __version__ = "0.22" + __version__ = "0.23" __pattern__ = r'http://(?:www\.)?edisk\.(cz|sk|eu)/(stahni|sk/stahni|en/download)/.+' @@ -21,7 +21,7 @@ class EdiskCz(SimpleHoster): OFFLINE_PATTERN = r'<h3>This file does not exist due to one of the following:</h3><ul><li>' ACTION_PATTERN = r'/en/download/(\d+/.*\.html)' - LINK_PATTERN = r'http://.*edisk\.cz.*\.html' + LINK_FREE_PATTERN = r'http://.*edisk\.cz.*\.html' def setup(self): @@ -47,7 +47,7 @@ class EdiskCz(SimpleHoster): "action": action }) - if not re.match(self.LINK_PATTERN, url): + if not re.match(self.LINK_FREE_PATTERN, url): self.fail(_("Unexpected server response")) self.download(url) diff --git a/module/plugins/hoster/EuroshareEu.py b/module/plugins/hoster/EuroshareEu.py index 2ebdfb3ff..08d8a2e3e 100644 --- a/module/plugins/hoster/EuroshareEu.py +++ b/module/plugins/hoster/EuroshareEu.py @@ -8,7 +8,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class EuroshareEu(SimpleHoster): __name__ = "EuroshareEu" __type__ = "hoster" - __version__ = "0.26" + __version__ = "0.27" __pattern__ = r'http://(?:www\.)?euroshare\.(eu|sk|cz|hu|pl)/file/.+' @@ -17,46 +17,52 @@ class EuroshareEu(SimpleHoster): __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - INFO_PATTERN = r'<span style="float: left;"><strong>(?P<N>.+?)</strong> \((?P<S>.+?)\)</span>' + INFO_PATTERN = r'<span style="float: left;"><strong>(?P<N>.+?)</strong> \((?P<S>.+?)\)</span>' OFFLINE_PATTERN = ur'<h2>S.bor sa nena.iel</h2>|Požadovaná stránka neexistuje!' - FREE_URL_PATTERN = r'<a href="(/file/\d+/[^/]*/download/)"><div class="downloadButton"' - ERR_PARDL_PATTERN = r'<h2>Prebieha s.ahovanie</h2>|<p>Naraz je z jednej IP adresy mo.n. s.ahova. iba jeden s.bor' + LINK_FREE_PATTERN = r'<a href="(/file/\d+/[^/]*/download/)"><div class="downloadButton"' + + ERR_PARDL_PATTERN = r'<h2>Prebieha s.ahovanie</h2>|<p>Naraz je z jednej IP adresy mo.n. s.ahova. iba jeden s.bor' ERR_NOT_LOGGED_IN_PATTERN = r'href="/customer-zone/login/"' URL_REPLACEMENTS = [(r"(http://[^/]*\.)(sk|cz|hu|pl)/", r"\1eu/")] - def handlePremium(self): + def handlePremium(self, pyfile): if self.ERR_NOT_LOGGED_IN_PATTERN in self.html: self.account.relogin(self.user) self.retry(reason=_("User not logged in")) - self.download(self.pyfile.url.rstrip('/') + "/download/") + self.download(pyfile.url.rstrip('/') + "/download/") check = self.checkDownload({"login": re.compile(self.ERR_NOT_LOGGED_IN_PATTERN), - "json": re.compile(r'\{"status":"error".*?"message":"(.*?)"')}) + "json" : re.compile(r'\{"status":"error".*?"message":"(.*?)"')}) + if check == "login" or (check == "json" and self.lastCheck.group(1) == "Access token expired"): self.account.relogin(self.user) self.retry(reason=_("Access token expired")) + elif check == "json": self.fail(self.lastCheck.group(1)) - def handleFree(self): + def handleFree(self, pyfile): if re.search(self.ERR_PARDL_PATTERN, self.html) is not None: self.longWait(5 * 60, 12) - m = re.search(self.FREE_URL_PATTERN, self.html) + m = re.search(self.LINK_FREE_PATTERN, self.html) if m is None: - self.error(_("FREE_URL_PATTERN not found")) + self.error(_("LINK_FREE_PATTERN not found")) parsed_url = "http://euroshare.eu%s" % m.group(1) self.logDebug("URL", parsed_url) self.download(parsed_url, disposition=True) - check = self.checkDownload({"multi_dl": re.compile(self.ERR_PARDL_PATTERN)}) - if check == "multi_dl": + + def checkFile(): + if self.checkDownload({"multi-dl": re.compile(self.ERR_PARDL_PATTERN)}) self.longWait(5 * 60, 12) + return super(EuroshareEu, self).checkFile() + getInfo = create_getInfo(EuroshareEu) diff --git a/module/plugins/hoster/ExtabitCom.py b/module/plugins/hoster/ExtabitCom.py index 7609954d3..5c2976a29 100644 --- a/module/plugins/hoster/ExtabitCom.py +++ b/module/plugins/hoster/ExtabitCom.py @@ -11,7 +11,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, s class ExtabitCom(SimpleHoster): __name__ = "ExtabitCom" __type__ = "hoster" - __version__ = "0.63" + __version__ = "0.64" __pattern__ = r'http://(?:www\.)?extabit\.com/(file|go|fid)/(?P<ID>\w+)' @@ -25,10 +25,10 @@ class ExtabitCom(SimpleHoster): OFFLINE_PATTERN = r'>File not found<' TEMP_OFFLINE_PATTERN = r'>(File is temporary unavailable|No download mirror)<' - LINK_PATTERN = r'[\'"](http://guest\d+\.extabit\.com/\w+/.*?)[\'"]' + LINK_FREE_PATTERN = r'[\'"](http://guest\d+\.extabit\.com/\w+/.*?)[\'"]' - def handleFree(self): + def handleFree(self, pyfile): if r">Only premium users can download this file" in self.html: self.fail(_("Only premium users can download this file")) @@ -41,7 +41,7 @@ class ExtabitCom(SimpleHoster): self.logDebug("URL: " + self.req.http.lastEffectiveURL) m = re.match(self.__pattern__, self.req.http.lastEffectiveURL) - fileID = m.group('ID') if m else self.info('ID') + fileID = m.group('ID') if m else self.info['pattern']['ID'] m = re.search(r'recaptcha/api/challenge\?k=(\w+)', self.html) if m: @@ -67,9 +67,9 @@ class ExtabitCom(SimpleHoster): self.html = self.load("http://extabit.com/file/%s%s" % (fileID, res['href'])) - m = re.search(self.LINK_PATTERN, self.html) + m = re.search(self.LINK_FREE_PATTERN, self.html) if m is None: - self.error(_("LINK_PATTERN not found")) + self.error(_("LINK_FREE_PATTERN not found")) url = m.group(1) self.download(url) diff --git a/module/plugins/hoster/FastixRu.py b/module/plugins/hoster/FastixRu.py index b68c79ebc..9a38f5a72 100644 --- a/module/plugins/hoster/FastixRu.py +++ b/module/plugins/hoster/FastixRu.py @@ -12,11 +12,11 @@ from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo class FastixRu(MultiHoster): __name__ = "FastixRu" __type__ = "hoster" - __version__ = "0.08" + __version__ = "0.09" __pattern__ = r'http://(?:www\.)?fastix\.(ru|it)/file/\w{24}' - __description__ = """Fastix hoster plugin""" + __description__ = """Fastix multi-hoster plugin""" __license__ = "GPLv3" __authors__ = [("Massimo Rosamilia", "max@spiritix.eu")] @@ -35,12 +35,12 @@ class FastixRu(MultiHoster): self.chunkLimit = 3 - def handlePremium(self): + def handlePremium(self, pyfile): api_key = self.account.getAccountData(self.user) api_key = api_key['api'] page = self.load("http://fastix.ru/api_v2/", - get={'apikey': api_key, 'sub': "getdirectlink", 'link': self.pyfile.url}) + get={'apikey': api_key, 'sub': "getdirectlink", 'link': pyfile.url}) data = json_loads(page) self.logDebug("Json data", data) @@ -50,19 +50,19 @@ class FastixRu(MultiHoster): else: self.link = data['downloadlink'] - if self.link != self.pyfile.url: + if self.link != pyfile.url: self.logDebug("New URL: %s" % self.link) - if self.pyfile.name.startswith("http") or self.pyfile.name.startswith("Unknown"): + if pyfile.name.startswith("http") or pyfile.name.startswith("Unknown"): #only use when name wasnt already set - self.pyfile.name = self.getFilename(self.link) + pyfile.name = self.getFilename(self.link) def checkFile(self): - super(FastixRu, self).checkFile() - - if self.checkDownload({"error": "<title>An error occurred while processing your request</title>"}) is "error": + if self.checkDownload({"error": "<title>An error occurred while processing your request</title>"}): self.retry(wait_time=60, reason=_("An error occurred while generating link")) + return super(FastixRu, self).checkFile() + getInfo = create_getInfo(FastixRu) diff --git a/module/plugins/hoster/FastshareCz.py b/module/plugins/hoster/FastshareCz.py index 31437c6e7..6fe871ad4 100644 --- a/module/plugins/hoster/FastshareCz.py +++ b/module/plugins/hoster/FastshareCz.py @@ -10,7 +10,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class FastshareCz(SimpleHoster): __name__ = "FastshareCz" __type__ = "hoster" - __version__ = "0.26" + __version__ = "0.27" __pattern__ = r'http://(?:www\.)?fastshare\.cz/\d+/.+' @@ -45,7 +45,7 @@ class FastshareCz(SimpleHoster): self.info.pop('error', None) - def handleFree(self): + def handleFree(self, pyfile): m = re.search(self.FREE_URL_PATTERN, self.html) if m: action, captcha_src = m.groups() @@ -58,22 +58,22 @@ class FastshareCz(SimpleHoster): def checkFile(self): - super(FastshareCz, self).checkFile() - check = self.checkDownload({ - 'paralell_dl' : re.compile(r"<title>FastShare.cz</title>|<script>alert\('Pres FREE muzete stahovat jen jeden soubor najednou.'\)"), - 'wrong_captcha': re.compile(r'Download for FREE'), + 'paralell-dl' : re.compile(r"<title>FastShare.cz</title>|<script>alert\('Pres FREE muzete stahovat jen jeden soubor najednou.'\)"), + 'wrong captcha': re.compile(r'Download for FREE'), 'credit' : re.compile(self.CREDIT_ERROR) }) - if check == "paralell_dl": + if check == "paralell-dl": self.retry(6, 10 * 60, _("Paralell download")) - elif check == "wrong_captcha": + elif check == "wrong captcha": self.retry(max_tries=5, reason=_("Wrong captcha")) elif check == "credit": self.resetAccount() + return super(FastshareCz, self).checkFile() + getInfo = create_getInfo(FastshareCz) diff --git a/module/plugins/hoster/FileParadoxIn.py b/module/plugins/hoster/FileParadoxIn.py deleted file mode 100644 index 0b5b57e22..000000000 --- a/module/plugins/hoster/FileParadoxIn.py +++ /dev/null @@ -1,23 +0,0 @@ -# -*- coding: utf-8 -*- - -import re - -from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo - - -class FileParadoxIn(XFSHoster): - __name__ = "FileParadoxIn" - __type__ = "hoster" - __version__ = "0.04" - - __pattern__ = r'https?://(?:www\.)?fileparadox\.in/\w{12}' - - __description__ = """FileParadox.in hoster plugin""" - __license__ = "GPLv3" - __authors__ = [("RazorWing", "muppetuk1@hotmail.com")] - - - HOSTER_DOMAIN = "fileparadox.in" - - -getInfo = create_getInfo(FileParadoxIn) diff --git a/module/plugins/hoster/FileSharkPl.py b/module/plugins/hoster/FileSharkPl.py index 5250a92fe..d686be480 100644 --- a/module/plugins/hoster/FileSharkPl.py +++ b/module/plugins/hoster/FileSharkPl.py @@ -10,7 +10,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class FileSharkPl(SimpleHoster): __name__ = "FileSharkPl" __type__ = "hoster" - __version__ = "0.05" + __version__ = "0.06" __pattern__ = r'http://(?:www\.)?fileshark\.pl/pobierz/\d{6}/\w{5}' @@ -73,13 +73,13 @@ class FileSharkPl(SimpleHoster): #@NOTE: handlePremium method was never been tested - def handlePremium(self): - super(FilerNet, self).handlePremium() + def handlePremium(self, pyfile): + super(FilerNet, self).handlePremium(pyfile) if self.link: self.link = urljoin("http://fileshark.pl/", self.link) - def handleFree(self): + def handleFree(self, pyfile): m = re.search(self.LINK_FREE_PATTERN, self.html) if m is None: self.error(_("Download url not found")) @@ -116,8 +116,6 @@ class FileSharkPl(SimpleHoster): def checkFile(self): - super(FileSharkPl, self).checkFile() - check = self.checkDownload({'wrong_captcha': re.compile(r'<label for="form_captcha" generated="true" class="error">(.*?)</label>'), 'wait_pattern' : re.compile(self.SECONDS_PATTERN), 'DL-found' : re.compile('<a href="(.*)">')}) @@ -132,6 +130,8 @@ class FileSharkPl(SimpleHoster): elif check == "wait_pattern": self.retry() + return super(FileSharkPl, self).checkFile() + def _decode64(self, data, *args, **kwargs): return data.decode("base64") diff --git a/module/plugins/hoster/FileStoreTo.py b/module/plugins/hoster/FileStoreTo.py index e1bd8da71..7b93c03f1 100644 --- a/module/plugins/hoster/FileStoreTo.py +++ b/module/plugins/hoster/FileStoreTo.py @@ -8,7 +8,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class FileStoreTo(SimpleHoster): __name__ = "FileStoreTo" __type__ = "hoster" - __version__ = "0.01" + __version__ = "0.02" __pattern__ = r'http://(?:www\.)?filestore\.to/\?d=(?P<ID>\w+)' @@ -27,9 +27,9 @@ class FileStoreTo(SimpleHoster): self.multiDL = True - def handleFree(self): + def handleFree(self, pyfile): self.wait(10) - ldc = re.search(r'wert="(\w+)"', self.html).group(1) + ldc = re.search(r'wert="(\w+)"', self.html).group(1) link = self.load("http://filestore.to/ajax/download.php", get={"LDC": ldc}) self.download(link) diff --git a/module/plugins/hoster/FilecloudIo.py b/module/plugins/hoster/FilecloudIo.py index 8b6804a68..bc328ddbd 100644 --- a/module/plugins/hoster/FilecloudIo.py +++ b/module/plugins/hoster/FilecloudIo.py @@ -10,7 +10,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class FilecloudIo(SimpleHoster): __name__ = "FilecloudIo" __type__ = "hoster" - __version__ = "0.05" + __version__ = "0.06" __pattern__ = r'http://(?:www\.)?(?:filecloud\.io|ifile\.it|mihd\.net)/(?P<ID>\w+)' @@ -20,17 +20,21 @@ class FilecloudIo(SimpleHoster): ("stickell", "l.stickell@yahoo.it")] - SIZE_PATTERN = r'{var __ab1 = (?P<S>\d+);}' - NAME_PATTERN = r'id="aliasSpan">(?P<N>.*?) <' - OFFLINE_PATTERN = r'l10n\.(FILES__DOESNT_EXIST|REMOVED)' + LOGIN_ACCOUNT = True + + NAME_PATTERN = r'id="aliasSpan">(?P<N>.*?) <' + SIZE_PATTERN = r'{var __ab1 = (?P<S>\d+);}' + OFFLINE_PATTERN = r'l10n\.(FILES__DOESNT_EXIST|REMOVED)' TEMP_OFFLINE_PATTERN = r'l10n\.FILES__WARNING' UKEY_PATTERN = r'\'ukey\'\s*:\'(\w+)' - AB1_PATTERN = r'if\( __ab1 == \'(\w+)\' \)' + AB1_PATTERN = r'if\( __ab1 == \'(\w+)\' \)' + ERROR_MSG_PATTERN = r'var __error_msg\s*=\s*l10n\.(.*?);' + RECAPTCHA_PATTERN = r'var __recaptcha_public\s*=\s*\'(.+?)\';' - LINK_PATTERN = r'"(http://s\d+\.filecloud\.io/%s/\d+/.*?)"' + LINK_FREE_PATTERN = r'"(http://s\d+\.filecloud\.io/%s/\d+/.*?)"' def setup(self): @@ -39,7 +43,7 @@ class FilecloudIo(SimpleHoster): self.chunkLimit = 1 - def handleFree(self): + def handleFree(self, pyfile): data = {"ukey": self.info['pattern']['ID']} m = re.search(self.AB1_PATTERN, self.html) @@ -55,14 +59,11 @@ class FilecloudIo(SimpleHoster): if captcha_key is None: self.error(_("ReCaptcha key not found")) - if not self.account: - self.fail(_("User not logged in")) - elif not self.account.logged_in: - challenge, response = recaptcha.challenge(captcha_key) - self.account.form_data = {"recaptcha_challenge_field": challenge, - "recaptcha_response_field" : response} - self.account.relogin(self.user) - self.retry(2) + challenge, response = recaptcha.challenge(captcha_key) + self.account.form_data = {"recaptcha_challenge_field": challenge, + "recaptcha_response_field" : response} + self.account.relogin(self.user) + self.retry(2) json_url = "http://filecloud.io/download-request.json" res = self.load(json_url, post=data) @@ -95,9 +96,9 @@ class FilecloudIo(SimpleHoster): if res['dl']: self.html = self.load('http://filecloud.io/download.html') - m = re.search(self.LINK_PATTERN % self.info['pattern']['ID'], self.html) + m = re.search(self.LINK_FREE_PATTERN % self.info['pattern']['ID'], self.html) if m is None: - self.error(_("LINK_PATTERN not found")) + self.error(_("LINK_FREE_PATTERN not found")) if "size" in self.info and self.info['size']: self.check_data = {"size": int(self.info['size'])} @@ -108,7 +109,7 @@ class FilecloudIo(SimpleHoster): self.fail(_("Unexpected server response")) - def handlePremium(self): + def handlePremium(self, pyfile): akey = self.account.getAccountData(self.user)['akey'] ukey = self.info['pattern']['ID'] self.logDebug("Akey: %s | Ukey: %s" % (akey, ukey)) diff --git a/module/plugins/hoster/FilefactoryCom.py b/module/plugins/hoster/FilefactoryCom.py index ada498a51..2c8ec58f4 100644 --- a/module/plugins/hoster/FilefactoryCom.py +++ b/module/plugins/hoster/FilefactoryCom.py @@ -21,7 +21,7 @@ def getInfo(urls): class FilefactoryCom(SimpleHoster): __name__ = "FilefactoryCom" __type__ = "hoster" - __version__ = "0.52" + __version__ = "0.53" __pattern__ = r'https?://(?:www\.)?filefactory\.com/(file|trafficshare/\w+)/\w+' @@ -34,7 +34,7 @@ class FilefactoryCom(SimpleHoster): INFO_PATTERN = r'<div id="file_name"[^>]*>\s*<h2>(?P<N>[^<]+)</h2>\s*<div id="file_info">\s*(?P<S>[\d.,]+) (?P<U>[\w^_]+) uploaded' OFFLINE_PATTERN = r'<h2>File Removed</h2>|This file is no longer available' - LINK_PATTERN = r'"([^"]+filefactory\.com/get.+?)"' + LINK_FREE_PATTERN = LINK_PREMIUM_PATTERN = r'"([^"]+filefactory\.com/get.+?)"' WAIT_PATTERN = r'<div id="countdown_clock" data-delay="(\d+)">' PREMIUM_ONLY_PATTERN = r'>Premium Account Required' @@ -42,13 +42,13 @@ class FilefactoryCom(SimpleHoster): COOKIES = [("filefactory.com", "locale", "en_US.utf8")] - def handleFree(self): + def handleFree(self, pyfile): if "Currently only Premium Members can download files larger than" in self.html: self.fail(_("File too large for free download")) elif "All free download slots on this server are currently in use" in self.html: self.retry(50, 15 * 60, _("All free slots are busy")) - m = re.search(self.LINK_PATTERN, self.html) + m = re.search(self.LINK_FREE_PATTERN, self.html) if m is None: self.error(_("Free download link not found")) @@ -61,30 +61,23 @@ class FilefactoryCom(SimpleHoster): self.download(dl_link, disposition=True) check = self.checkDownload({'multiple': "You are currently downloading too many files at once.", - 'error': '<div id="errorMessage">'}) + 'error' : '<div id="errorMessage">'}) if check == "multiple": self.logDebug("Parallel downloads detected; waiting 15 minutes") self.retry(wait_time=15 * 60, reason=_("Parallel downloads")) + elif check == "error": self.error(_("Unknown error")) - def handlePremium(self): - header = self.load(self.pyfile.url, just_header=True) + def handlePremium(self, pyfile): + self.link = self.directLink(self.load(pyfile.url, just_header=True)) - if 'location' in header: - url = header['location'].strip() - if not url.startswith("http://"): - url = urljoin("http://www.filefactory.com", url) - elif 'content-disposition' in header: - url = self.pyfile.url - else: - html = self.load(self.pyfile.url) - m = re.search(self.LINK_PATTERN, html) + if not self.link: + html = self.load(pyfile.url) + m = re.search(self.LINK_PREMIUM_PATTERN, html) if m: - url = m.group(1) + self.link = m.group(1) else: self.error(_("Premium download link not found")) - - self.download(url, disposition=True) diff --git a/module/plugins/hoster/FilepostCom.py b/module/plugins/hoster/FilepostCom.py index 66c040770..4dd36c6e4 100644 --- a/module/plugins/hoster/FilepostCom.py +++ b/module/plugins/hoster/FilepostCom.py @@ -12,7 +12,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class FilepostCom(SimpleHoster): __name__ = "FilepostCom" __type__ = "hoster" - __version__ = "0.31" + __version__ = "0.32" __pattern__ = r'https?://(?:www\.)?(?:filepost\.com/files|fp\.io)/(?P<ID>[^/]+)' @@ -29,7 +29,7 @@ class FilepostCom(SimpleHoster): FLP_TOKEN_PATTERN = r'set_store_options\({token: \'(.+?)\'' - def handleFree(self): + def handleFree(self, pyfile): m = re.search(self.FLP_TOKEN_PATTERN, self.html) if m is None: self.error(_("Token")) diff --git a/module/plugins/hoster/FilepupNet.py b/module/plugins/hoster/FilepupNet.py index cc3e86bc9..a53773f81 100644 --- a/module/plugins/hoster/FilepupNet.py +++ b/module/plugins/hoster/FilepupNet.py @@ -12,7 +12,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class FilepupNet(SimpleHoster): __name__ = "FilepupNet" __type__ = "hoster" - __version__ = "0.02" + __version__ = "0.03" __pattern__ = r'http://(?:www\.)?filepup\.net/files/\w+' @@ -27,7 +27,7 @@ class FilepupNet(SimpleHoster): OFFLINE_PATTERN = r'>This file has been deleted' - LINK_PATTERN = r'(http://www\.filepup\.net/get/.+?)\'' + LINK_FREE_PATTERN = r'(http://www\.filepup\.net/get/.+?)\'' def setup(self): @@ -35,17 +35,13 @@ class FilepupNet(SimpleHoster): self.chunkLimit = 1 - def handleFree(self): - m = re.search(self.LINK_PATTERN, self.html) + def handleFree(self, pyfile): + m = re.search(self.LINK_FREE_PATTERN, self.html) if m is None: self.error(_("Download link not found")) dl_link = m.group(1) self.download(dl_link, post={'task': "download"}) - check = self.checkDownload({'html': re.compile("html")}) - if check == "html": - self.error(_("Downloaded file is an html page")) - getInfo = create_getInfo(FilepupNet) diff --git a/module/plugins/hoster/FilerNet.py b/module/plugins/hoster/FilerNet.py index 2a38ac470..159aab964 100644 --- a/module/plugins/hoster/FilerNet.py +++ b/module/plugins/hoster/FilerNet.py @@ -16,7 +16,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class FilerNet(SimpleHoster): __name__ = "FilerNet" __type__ = "hoster" - __version__ = "0.12" + __version__ = "0.13" __pattern__ = r'https?://(?:www\.)?filer\.net/get/\w+' @@ -42,12 +42,12 @@ class FilerNet(SimpleHoster): self.info.pop('error', None) - def handleFree(self): + def handleFree(self, pyfile): inputs = self.parseHtmlForm(input_names={'token': re.compile(r'.+')})[1] if 'token' not in inputs: self.error(_("Unable to detect token")) - self.html = self.load(self.pyfile.url, post={'token': inputs['token']}, decode=True) + self.html = self.load(pyfile.url, post={'token': inputs['token']}, decode=True) inputs = self.parseHtmlForm(input_names={'hash': re.compile(r'.+')})[1] if 'hash' not in inputs: @@ -61,7 +61,7 @@ class FilerNet(SimpleHoster): #@NOTE: Work-around for v0.4.9 just_header issue #@TODO: Check for v0.4.10 self.req.http.c.setopt(pycurl.FOLLOWLOCATION, 0) - self.load(self.pyfile.url, post={'recaptcha_challenge_field': challenge, + self.load(pyfile.url, post={'recaptcha_challenge_field': challenge, 'recaptcha_response_field' : response, 'hash' : inputs['hash']}) self.req.http.c.setopt(pycurl.FOLLOWLOCATION, 1) diff --git a/module/plugins/hoster/FilesMailRu.py b/module/plugins/hoster/FilesMailRu.py index 9b39d818f..18fca7176 100644 --- a/module/plugins/hoster/FilesMailRu.py +++ b/module/plugins/hoster/FilesMailRu.py @@ -32,7 +32,7 @@ def getInfo(urls): class FilesMailRu(Hoster): __name__ = "FilesMailRu" __type__ = "hoster" - __version__ = "0.31" + __version__ = "0.32" __pattern__ = r'http://(?:www\.)?files\.mail\.ru/.+' @@ -42,8 +42,7 @@ class FilesMailRu(Hoster): def setup(self): - if not self.account: - self.multiDL = False + self.multiDL = bool(self.account) def process(self, pyfile): diff --git a/module/plugins/hoster/FileserveCom.py b/module/plugins/hoster/FileserveCom.py index 52a071b52..515ec9029 100644 --- a/module/plugins/hoster/FileserveCom.py +++ b/module/plugins/hoster/FileserveCom.py @@ -118,14 +118,16 @@ class FileserveCom(Hoster): self.logDebug(self.req.http.lastEffectiveURL) check = self.checkDownload({"expired": self.LINK_EXPIRED_PATTERN, - "wait": re.compile(self.LONG_WAIT_PATTERN), - "limit": self.DAILY_LIMIT_PATTERN}) + "wait" : re.compile(self.LONG_WAIT_PATTERN), + "limit" : self.DAILY_LIMIT_PATTERN}) if check == "expired": self.logDebug("Download link was expired") self.retry() + elif check == "wait": self.doLongWait(self.lastCheck) + elif check == "limit": self.logWarning(_("Download limited reached for today")) self.setWait(secondsToMidnight(gmt=2), True) @@ -204,12 +206,9 @@ class FileserveCom(Hoster): self.download(premium_url or self.pyfile.url) - if not premium_url: - check = self.checkDownload({"login": re.compile(self.NOT_LOGGED_IN_PATTERN)}) - - if check == "login": - self.account.relogin(self.user) - self.retry(reason=_("Not logged in")) + if not premium_url and self.checkDownload({"login": re.compile(self.NOT_LOGGED_IN_PATTERN)}): + self.account.relogin(self.user) + self.retry(reason=_("Not logged in")) def getInfo(urls): diff --git a/module/plugins/hoster/FourSharedCom.py b/module/plugins/hoster/FourSharedCom.py index 0406df0c4..78aeece44 100644 --- a/module/plugins/hoster/FourSharedCom.py +++ b/module/plugins/hoster/FourSharedCom.py @@ -8,7 +8,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class FourSharedCom(SimpleHoster): __name__ = "FourSharedCom" __type__ = "hoster" - __version__ = "0.30" + __version__ = "0.31" __pattern__ = r'https?://(?:www\.)?4shared(\-china)?\.com/(account/)?(download|get|file|document|photo|video|audio|mp3|office|rar|zip|archive|music)/.+' @@ -25,37 +25,38 @@ class FourSharedCom(SimpleHoster): NAME_REPLACEMENTS = [(r"&#(\d+).", lambda m: unichr(int(m.group(1))))] SIZE_REPLACEMENTS = [(",", "")] - DOWNLOAD_URL_PATTERN = r'name="d3link" value="(.*?)"' - DOWNLOAD_BUTTON_PATTERN = r'id="btnLink" href="(.*?)"' - FID_PATTERN = r'name="d3fid" value="(.*?)"' + DIRECT_LINK = False + LOGIN_ACCOUNT = True + LINK_FREE_PATTERN = r'name="d3link" value="(.*?)"' + LINK_BTN_PATTERN = r'id="btnLink" href="(.*?)"' - def handleFree(self): - if not self.account: - self.fail(_("User not logged in")) + ID_PATTERN = r'name="d3fid" value="(.*?)"' - m = re.search(self.DOWNLOAD_BUTTON_PATTERN, self.html) + + def handleFree(self, pyfile): + m = re.search(self.LINK_BTN_PATTERN, self.html) if m: link = m.group(1) else: - link = re.sub(r'/(download|get|file|document|photo|video|audio)/', r'/get/', self.pyfile.url) + link = re.sub(r'/(download|get|file|document|photo|video|audio)/', r'/get/', pyfile.url) self.html = self.load(link) - m = re.search(self.DOWNLOAD_URL_PATTERN, self.html) + m = re.search(self.LINK_FREE_PATTERN, self.html) if m is None: self.error(_("Download link")) - link = m.group(1) + + self.link = m.group(1) try: - m = re.search(self.FID_PATTERN, self.html) + m = re.search(self.ID_PATTERN, self.html) res = self.load('http://www.4shared.com/web/d2/getFreeDownloadLimitInfo?fileId=%s' % m.group(1)) self.logDebug(res) except: pass self.wait(20) - self.download(link) getInfo = create_getInfo(FourSharedCom) diff --git a/module/plugins/hoster/FreakshareCom.py b/module/plugins/hoster/FreakshareCom.py index 2238f07ef..9a11f933d 100644 --- a/module/plugins/hoster/FreakshareCom.py +++ b/module/plugins/hoster/FreakshareCom.py @@ -43,23 +43,27 @@ class FreakshareCom(Hoster): self.download(pyfile.url, post=self.req_opts) - check = self.checkDownload({"bad": "bad try", - "paralell": "> Sorry, you cant download more then 1 files at time. <", - "empty": "Warning: Unknown: Filename cannot be empty", - "wrong_captcha": "Wrong Captcha!", + check = self.checkDownload({"bad" : "bad try", + "paralell" : "> Sorry, you cant download more then 1 files at time. <", + "empty" : "Warning: Unknown: Filename cannot be empty", + "wrong_captcha" : "Wrong Captcha!", "downloadserver": "No Downloadserver. Please try again later!"}) if check == "bad": self.fail(_("Bad Try")) + elif check == "paralell": self.setWait(300, True) self.wait() self.retry() + elif check == "empty": self.fail(_("File not downloadable")) + elif check == "wrong_captcha": self.invalidCaptcha() self.retry() + elif check == "downloadserver": self.retry(5, 15 * 60, _("No Download server")) diff --git a/module/plugins/hoster/FreeWayMe.py b/module/plugins/hoster/FreeWayMe.py index 50131e28e..ffc8115d3 100644 --- a/module/plugins/hoster/FreeWayMe.py +++ b/module/plugins/hoster/FreeWayMe.py @@ -6,11 +6,11 @@ from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo class FreeWayMe(MultiHoster): __name__ = "FreeWayMe" __type__ = "hoster" - __version__ = "0.14" + __version__ = "0.15" __pattern__ = r'https://(?:www\.)?free-way\.me/.+' - __description__ = """FreeWayMe hoster plugin""" + __description__ = """FreeWayMe multi-hoster plugin""" __license__ = "GPLv3" __authors__ = [("Nicolas Giese", "james@free-way.me")] @@ -21,14 +21,14 @@ class FreeWayMe(MultiHoster): self.chunkLimit = 1 - def handlePremium(self): + def handlePremium(self, pyfile): user, data = self.account.selectAccount() self.download("https://www.free-way.me/load.php", get={'multiget': 7, - 'url' : self.pyfile.url, + 'url' : pyfile.url, 'user' : user, - 'pw' : self.account.getpw(user), + 'pw' : self.account.getAccountData(user)['password'], 'json' : ""}, disposition=True) diff --git a/module/plugins/hoster/FshareVn.py b/module/plugins/hoster/FshareVn.py index a3f9703df..872511afc 100644 --- a/module/plugins/hoster/FshareVn.py +++ b/module/plugins/hoster/FshareVn.py @@ -3,6 +3,7 @@ import re from time import strptime, mktime, gmtime +from urlparse import urljoin from module.network.RequestFactory import getURL from module.plugins.internal.SimpleHoster import SimpleHoster, parseFileInfo @@ -24,7 +25,7 @@ def doubleDecode(m): class FshareVn(SimpleHoster): __name__ = "FshareVn" __type__ = "hoster" - __version__ = "0.18" + __version__ = "0.19" __pattern__ = r'http://(?:www\.)?fshare\.vn/file/.+' @@ -38,31 +39,26 @@ class FshareVn(SimpleHoster): NAME_REPLACEMENTS = [("(.*)", doubleDecode)] - LINK_PATTERN = r'action="(http://download.*?)[#"]' + LINK_FREE_PATTERN = r'action="(http://download.*?)[#"]' WAIT_PATTERN = ur'Lượt tải xuống kế tiếp là:\s*(.*?)\s*<' - def process(self, pyfile): - self.html = self.load('http://www.fshare.vn/check_link.php', post={ - "action": "check_link", - "arrlinks": pyfile.url - }, decode=True) - self.getFileInfo() + def preload(self): + self.html = self.load("http://www.fshare.vn/check_link.php", + post={'action': "check_link", 'arrlinks': pyfile.url}, + decode=True) - if self.premium: - self.handlePremium() - else: - self.handleFree() - self.checkDownloadedFile() + if isinstance(self.TEXT_ENCODING, basestring): + self.html = unicode(self.html, self.TEXT_ENCODING) - def handleFree(self): - self.html = self.load(self.pyfile.url, decode=True) + def handleFree(self, pyfile): + self.html = self.load(pyfile.url, decode=True) self.checkErrors() action, inputs = self.parseHtmlForm('frm_download') - self.url = self.pyfile.url + action + self.url = urljoin(pyfile.url, action) if not inputs: self.error(_("No FORM")) @@ -88,9 +84,9 @@ class FshareVn(SimpleHoster): m = re.search(r'var count = (\d+)', self.html) self.setWait(int(m.group(1)) if m else 30) - m = re.search(self.LINK_PATTERN, self.html) + m = re.search(self.LINK_FREE_PATTERN, self.html) if m is None: - self.error(_("LINK_PATTERN not found")) + self.error(_("LINK_FREE_PATTERN not found")) self.url = m.group(1) self.logDebug("FREE DL URL: %s" % self.url) @@ -98,10 +94,6 @@ class FshareVn(SimpleHoster): self.download(self.url) - def handlePremium(self): - self.download(self.pyfile.url) - - def checkErrors(self): if '/error.php?' in self.req.lastEffectiveURL or u"Liên kết bạn chọn không tồn" in self.html: self.offline() @@ -118,13 +110,3 @@ class FshareVn(SimpleHoster): self.retry(30, 2 * 60, msg) self.info.pop('error', None) - - - def checkDownloadedFile(self): - # check download - check = self.checkDownload({ - "not_found": "<head><title>404 Not Found</title></head>" - }) - - if check == "not_found": - self.fail(_("File not m on server")) diff --git a/module/plugins/hoster/Ftp.py b/module/plugins/hoster/Ftp.py index c6ad68e49..3daf50bc5 100644 --- a/module/plugins/hoster/Ftp.py +++ b/module/plugins/hoster/Ftp.py @@ -12,7 +12,7 @@ from module.plugins.Hoster import Hoster class Ftp(Hoster): __name__ = "Ftp" __type__ = "hoster" - __version__ = "0.44" + __version__ = "0.45" __pattern__ = r'(?:ftps?|sftp)://([\w.-]+(:[\w.-]+)?@)?[\w.-]+(:\d+)?/.+' @@ -43,7 +43,7 @@ class Ftp(Hoster): if netloc in servers: self.logDebug("Logging on to %s" % netloc) - self.req.addAuth(self.account.accounts[netloc]['password']) + self.req.addAuth(self.account.getAccountData(netloc)['password']) else: pwd = self.getPassword() if ':' in pwd: diff --git a/module/plugins/hoster/GigapetaCom.py b/module/plugins/hoster/GigapetaCom.py index 37af7f216..9d3ace3b2 100644 --- a/module/plugins/hoster/GigapetaCom.py +++ b/module/plugins/hoster/GigapetaCom.py @@ -11,7 +11,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class GigapetaCom(SimpleHoster): __name__ = "GigapetaCom" __type__ = "hoster" - __version__ = "0.02" + __version__ = "0.03" __pattern__ = r'http://(?:www\.)?gigapeta\.com/dl/\w+' @@ -27,7 +27,7 @@ class GigapetaCom(SimpleHoster): COOKIES = [("gigapeta.com", "lang", "us")] - def handleFree(self): + def handleFree(self, pyfile): captcha_key = str(randint(1, 100000000)) captcha_url = "http://gigapeta.com/img/captcha.gif?x=%s" % captcha_key @@ -37,7 +37,7 @@ class GigapetaCom(SimpleHoster): self.checkErrors() captcha = self.decryptCaptcha(captcha_url) - self.html = self.load(self.pyfile.url, post={ + self.html = self.load(pyfile.url, post={ "captcha_key": captcha_key, "captcha": captcha, "download": "Download"}) diff --git a/module/plugins/hoster/GooIm.py b/module/plugins/hoster/GooIm.py index 436d825a9..2cb012e50 100644 --- a/module/plugins/hoster/GooIm.py +++ b/module/plugins/hoster/GooIm.py @@ -11,7 +11,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class GooIm(SimpleHoster): __name__ = "GooIm" __type__ = "hoster" - __version__ = "0.03" + __version__ = "0.04" __pattern__ = r'https?://(?:www\.)?goo\.im/.+' @@ -29,11 +29,9 @@ class GooIm(SimpleHoster): self.multiDL = True - def handleFree(self): - url = self.pyfile.url - self.html = self.load(url, cookies=True) + def handleFree(self, pyfile): self.wait(10) - self.download(url, cookies=True) + self.download(pyfile.url, cookies=True) getInfo = create_getInfo(GooIm) diff --git a/module/plugins/hoster/HellshareCz.py b/module/plugins/hoster/HellshareCz.py index 4b44cc335..47b981dd7 100644 --- a/module/plugins/hoster/HellshareCz.py +++ b/module/plugins/hoster/HellshareCz.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -import re +from urlparse import urljoin from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo @@ -8,41 +8,34 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class HellshareCz(SimpleHoster): __name__ = "HellshareCz" __type__ = "hoster" - __version__ = "0.83" + __version__ = "0.84" - __pattern__ = r'(http://(?:www\.)?hellshare\.(?:cz|com|sk|hu|pl)/[^?]*/\d+)' + __pattern__ = r'http://(?:www\.)?hellshare\.(?:cz|com|sk|hu|pl)/[^?]*/\d+' __description__ = """Hellshare.cz hoster plugin""" __license__ = "GPLv3" __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - NAME_PATTERN = r'<h1 id="filename"[^>]*>(?P<N>[^<]+)</h1>' - SIZE_PATTERN = r'<strong id="FileSize_master">(?P<S>[\d.,]+) (?P<U>[\w^_]+)</strong>' + CHECK_TRAFFIC = True + LOGIN_ACCOUNT = True + + NAME_PATTERN = r'<h1 id="filename"[^>]*>(?P<N>[^<]+)</h1>' + SIZE_PATTERN = r'<strong id="FileSize_master">(?P<S>[\d.,]+) (?P<U>[\w^_]+)</strong>' OFFLINE_PATTERN = r'<h1>File not found.</h1>' - SHOW_WINDOW_PATTERN = r'<a href="([^?]+/(\d+)/\?do=(fileDownloadButton|relatedFileDownloadButton-\2)-showDownloadWindow)"' + + LINK_FREE_PATTERN = LINK_PREMIUM_PATTERN = r'<a href="([^?]+/(\d+)/\?do=(fileDownloadButton|relatedFileDownloadButton-\2)-showDownloadWindow)"' def setup(self): - self.resumeDownload = self.multiDL = True if self.account else False + self.resumeDownload = self.multiDL = bool(self.account) self.chunkLimit = 1 - def process(self, pyfile): - if not self.account: - self.fail(_("User not logged in")) - pyfile.url = re.match(self.__pattern__, pyfile.url).group(1) - self.html = self.load(pyfile.url, decode=True) - self.getFileInfo() - if not self.checkTrafficLeft(): - self.fail(_("Not enough traffic left for user ") + self.user) - - m = re.search(self.SHOW_WINDOW_PATTERN, self.html) - if m is None: - self.error(_("SHOW_WINDOW_PATTERN not found")) - - self.url = "http://www.hellshare.com" + m.group(1) - self.download(self.url) + def downloadLink(self, link): + if link and isinstance(link, basestring): + self.correctCaptcha() + self.download(urljoin("http://www.hellshare.com/", link), disposition=True) getInfo = create_getInfo(HellshareCz) diff --git a/module/plugins/hoster/HundredEightyUploadCom.py b/module/plugins/hoster/HundredEightyUploadCom.py index 317a49caf..4fc96a2b1 100644 --- a/module/plugins/hoster/HundredEightyUploadCom.py +++ b/module/plugins/hoster/HundredEightyUploadCom.py @@ -1,7 +1,4 @@ # -*- coding: utf-8 -*- -# -# Test links: -# http://180upload.com/js9qdm6kjnrs from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo diff --git a/module/plugins/hoster/IfileIt.py b/module/plugins/hoster/IfileIt.py index 2dae4cd80..056b05a65 100644 --- a/module/plugins/hoster/IfileIt.py +++ b/module/plugins/hoster/IfileIt.py @@ -1,16 +1,12 @@ # -*- coding: utf-8 -*- -import re +from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo -from module.common.json_layer import json_loads -from module.plugins.internal.CaptchaService import ReCaptcha -from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo - -class IfileIt(SimpleHoster): +class IfileIt(DeadHoster): __name__ = "IfileIt" __type__ = "hoster" - __version__ = "0.28" + __version__ = "0.29" __pattern__ = r'^unmatchable$' @@ -19,49 +15,4 @@ class IfileIt(SimpleHoster): __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - LINK_PATTERN = r'</span> If it doesn\'t, <a target="_blank" href="([^"]+)">' - RECAPTCHA_PATTERN = r'var __recaptcha_public\s*=\s*\'(.+?)\'' - INFO_PATTERN = r'<span style="cursor: default;[^>]*>\s*(?P<N>.*?)\s* \s*<strong>\s*(?P<S>[\d.,]+)\s*(?P<U>[\w^_]+)\s*</strong>\s*</span>' - OFFLINE_PATTERN = r'<span style="cursor: default;[^>]*>\s* \s*<strong>\s*</strong>\s*</span>' - TEMP_OFFLINE_PATTERN = r'<span class="msg_red">Downloading of this file is temporarily disabled</span>' - - - def handleFree(self): - ukey = re.match(self.__pattern__, self.pyfile.url).group(1) - json_url = 'http://ifile.it/new_download-request.json' - post_data = {"ukey": ukey, "ab": "0"} - res = json_loads(self.load(json_url, post=post_data)) - - self.logDebug(res) - - if res['status'] == 3: - self.offline() - - if res['captcha']: - captcha_key = re.search(self.RECAPTCHA_PATTERN, self.html).group(1) - - recaptcha = ReCaptcha(self) - post_data['ctype'] = "recaptcha" - - for _i in xrange(5): - challenge, response = recaptcha.challenge(captcha_key) - post_data.update({'recaptcha_challenge': challenge, - 'recaptcha_response' : response}) - res = json_loads(self.load(json_url, post=post_data)) - self.logDebug(res) - - if res['retry']: - self.invalidCaptcha() - else: - self.correctCaptcha() - break - else: - self.fail(_("Incorrect captcha")) - - if not "ticket_url" in res: - self.error(_("No download URL")) - - self.download(res['ticket_url']) - - getInfo = create_getInfo(IfileIt) diff --git a/module/plugins/hoster/IfolderRu.py b/module/plugins/hoster/IfolderRu.py index 255f10f45..249c2feb1 100644 --- a/module/plugins/hoster/IfolderRu.py +++ b/module/plugins/hoster/IfolderRu.py @@ -8,7 +8,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class IfolderRu(SimpleHoster): __name__ = "IfolderRu" __type__ = "hoster" - __version__ = "0.38" + __version__ = "0.39" __pattern__ = r'http://(?:www\.)?(?:ifolder\.ru|rusfolder\.(?:com|net|ru))/(?:files/)?(?P<ID>\d+)' @@ -18,25 +18,27 @@ class IfolderRu(SimpleHoster): SIZE_REPLACEMENTS = [(u'Кб', 'KB'), (u'Мб', 'MB'), (u'Гб', 'GB')] - NAME_PATTERN = ur'(?:<div><span>)?Название:(?:</span>)? <b>(?P<N>[^<]+)</b><(?:/div|br)>' - SIZE_PATTERN = ur'(?:<div><span>)?Размер:(?:</span>)? <b>(?P<S>[^<]+)</b><(?:/div|br)>' + + NAME_PATTERN = ur'(?:<div><span>)?Название:(?:</span>)? <b>(?P<N>[^<]+)</b><(?:/div|br)>' + SIZE_PATTERN = ur'(?:<div><span>)?Размер:(?:</span>)? <b>(?P<S>[^<]+)</b><(?:/div|br)>' OFFLINE_PATTERN = ur'<p>Файл номер <b>[^<]*</b> (не найден|удален) !!!</p>' SESSION_ID_PATTERN = r'<a href=(http://ints\.(?:rusfolder\.com|ifolder\.ru)/ints/sponsor/\?bi=\d*&session=([^&]+)&u=[^>]+)>' INTS_SESSION_PATTERN = r'\(\'ints_session\'\);\s*if\(tag\)\{tag\.value = "([^"]+)";\}' HIDDEN_INPUT_PATTERN = r'var v = .*?name=\'(.+?)\' value=\'1\'' - LINK_PATTERN = r'<a id="download_file_href" href="([^"]+)"' + + LINK_FREE_PATTERN = r'<a id="download_file_href" href="([^"]+)"' + WRONG_CAPTCHA_PATTERN = ur'<font color=Red>неверный код,<br>введите еще раз</font><br>' def setup(self): - self.resumeDownload = self.multiDL = True if self.account else False - self.chunkLimit = 1 + self.resumeDownload = self.multiDL = bool(self.account) + self.chunkLimit = 1 - def process(self, pyfile): - file_id = re.match(self.__pattern__, pyfile.url).group('ID') - self.html = self.load("http://rusfolder.com/%s" % file_id, cookies=True, decode=True) + def handleFree(self, pyfile): + self.html = self.load("http://rusfolder.com/%s" % self.info['pattern']['ID'], cookies=True, decode=True) self.getFileInfo() url = re.search(r"location\.href = '(http://ints\..*?=)'", self.html).group(1) @@ -68,9 +70,7 @@ class IfolderRu(SimpleHoster): else: self.fail(_("Invalid captcha")) - download_url = re.search(self.LINK_PATTERN, self.html).group(1) - self.correctCaptcha() - self.download(download_url) + self.link = re.search(self.LINK_PATTERN, self.html).group(1) getInfo = create_getInfo(IfolderRu) diff --git a/module/plugins/hoster/JumbofilesCom.py b/module/plugins/hoster/JumbofilesCom.py index cabc0f098..7adc1a029 100644 --- a/module/plugins/hoster/JumbofilesCom.py +++ b/module/plugins/hoster/JumbofilesCom.py @@ -8,9 +8,9 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class JumbofilesCom(SimpleHoster): __name__ = "JumbofilesCom" __type__ = "hoster" - __version__ = "0.02" + __version__ = "0.03" - __pattern__ = r'http://(?:www\.)?jumbofiles\.com/(\w{12})' + __pattern__ = r'http://(?:www\.)?jumbofiles\.com/(?P<ID>\w{12})' __description__ = """JumboFiles.com hoster plugin""" __license__ = "GPLv3" @@ -19,7 +19,7 @@ class JumbofilesCom(SimpleHoster): INFO_PATTERN = r'<TR><TD>(?P<N>[^<]+?)\s*<small>\((?P<S>[\d.,]+)\s*(?P<U>[\w^_]+)' OFFLINE_PATTERN = r'Not Found or Deleted / Disabled due to inactivity or DMCA' - LINK_PATTERN = r'<meta http-equiv="refresh" content="10;url=(.+)">' + LINK_FREE_PATTERN = r'<meta http-equiv="refresh" content="10;url=(.+)">' def setup(self): @@ -27,12 +27,10 @@ class JumbofilesCom(SimpleHoster): self.multiDL = True - def handleFree(self): - ukey = re.match(self.__pattern__, self.pyfile.url).group(1) - post_data = {"id": ukey, "op": "download3", "rand": ""} + def handleFree(self, pyfile): + post_data = {"id": self.info['pattern']['ID'], "op": "download3", "rand": ""} html = self.load(self.pyfile.url, post=post_data, decode=True) - url = re.search(self.LINK_PATTERN, html).group(1) - self.download(url) + self.link = re.search(self.LINK_FREE_PATTERN, html).group(1) getInfo = create_getInfo(JumbofilesCom) diff --git a/module/plugins/hoster/Keep2shareCc.py b/module/plugins/hoster/Keep2shareCc.py index 86c28e93b..16bda27e0 100644 --- a/module/plugins/hoster/Keep2shareCc.py +++ b/module/plugins/hoster/Keep2shareCc.py @@ -8,14 +8,14 @@ from module.plugins.internal.CaptchaService import ReCaptcha from module.plugins.internal.SimpleHoster import _isDirectLink, SimpleHoster, create_getInfo -class Keep2shareCc(SimpleHoster): - __name__ = "Keep2shareCc" +class Keep2ShareCc(SimpleHoster): + __name__ = "Keep2ShareCc" __type__ = "hoster" __version__ = "0.18" __pattern__ = r'https?://(?:www\.)?(keep2share|k2s|keep2s)\.cc/file/(?P<ID>\w+)' - __description__ = """Keep2share.cc hoster plugin""" + __description__ = """Keep2Share.cc hoster plugin""" __license__ = "GPLv3" __authors__ = [("stickell", "l.stickell@yahoo.it"), ("Walter Purcaro", "vuolter@gmail.com")] @@ -127,4 +127,4 @@ class Keep2shareCc(SimpleHoster): self.download(urljoin("http://k2s.cc/", link), disposition=True) -getInfo = create_getInfo(Keep2shareCc) +getInfo = create_getInfo(Keep2ShareCc) diff --git a/module/plugins/hoster/KingfilesNet.py b/module/plugins/hoster/KingfilesNet.py index 13cbf4781..a75ef5f3e 100644 --- a/module/plugins/hoster/KingfilesNet.py +++ b/module/plugins/hoster/KingfilesNet.py @@ -9,7 +9,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class KingfilesNet(SimpleHoster): __name__ = "KingfilesNet" __type__ = "hoster" - __version__ = "0.05" + __version__ = "0.06" __pattern__ = r'http://(?:www\.)?kingfiles\.net/(?P<ID>\w{12})' @@ -26,7 +26,7 @@ class KingfilesNet(SimpleHoster): RAND_ID_PATTERN = r'type=\"hidden\" name=\"rand\" value=\"(.+)\">' - LINK_PATTERN = r'var download_url = \'(.+)\';' + LINK_FREE_PATTERN = r'var download_url = \'(.+)\';' def setup(self): @@ -34,16 +34,16 @@ class KingfilesNet(SimpleHoster): self.multiDL = True - def handleFree(self): + def handleFree(self, pyfile): # Click the free user button post_data = {'op' : "download1", 'usr_login' : "", 'id' : self.info['pattern']['ID'], - 'fname' : self.pyfile.name, + 'fname' : pyfile.name, 'referer' : "", 'method_free': "+"} - self.html = self.load(self.pyfile.url, post=post_data, cookies=True, decode=True) + self.html = self.load(pyfile.url, post=post_data, cookies=True, decode=True) solvemedia = SolveMedia(self) challenge, response = solvemedia.challenge() @@ -59,24 +59,20 @@ class KingfilesNet(SimpleHoster): post_data = {'op' : "download2", 'id' : self.info['pattern']['ID'], 'rand' : rand, - 'referer' : self.pyfile.url, + 'referer' : pyfile.url, 'method_free' : "+", 'method_premium' : "", 'adcopy_response' : response, 'adcopy_challenge': challenge, 'down_direct' : "1"} - self.html = self.load(self.pyfile.url, post=post_data, cookies=True, decode=True) + self.html = self.load(pyfile.url, post=post_data, cookies=True, decode=True) - m = re.search(self.LINK_PATTERN, self.html) + m = re.search(self.LINK_FREE_PATTERN, self.html) if m is None: self.error(_("Download url not found")) self.download(m.group(1), cookies=True, disposition=True) - check = self.checkDownload({'html': re.compile("<html>")}) - if check == "html": - self.error(_("Downloaded file is an html page")) - getInfo = create_getInfo(KingfilesNet) diff --git a/module/plugins/hoster/LetitbitNet.py b/module/plugins/hoster/LetitbitNet.py index f3921fdb7..6d5641778 100644 --- a/module/plugins/hoster/LetitbitNet.py +++ b/module/plugins/hoster/LetitbitNet.py @@ -16,7 +16,7 @@ from module.plugins.internal.CaptchaService import ReCaptcha from module.plugins.internal.SimpleHoster import SimpleHoster, secondsToMidnight -def api_download_info(url): +def api_response(url): json_data = ["yw7XQy2v9", ["download/info", {"link": url}]] api_rep = getURL("http://api.letitbit.net/json", post={'r': json_dumps(json_data)}) @@ -25,7 +25,7 @@ def api_download_info(url): def getInfo(urls): for url in urls: - api_rep = api_download_info(url) + api_rep = api_response(url) if api_rep['status'] == 'OK': info = api_rep['data'][0] yield (info['name'], info['size'], 2, url) @@ -36,7 +36,7 @@ def getInfo(urls): class LetitbitNet(SimpleHoster): __name__ = "LetitbitNet" __type__ = "hoster" - __version__ = "0.28" + __version__ = "0.29" __pattern__ = r'https?://(?:www\.)?(letitbit|shareflare)\.net/download/.+' @@ -57,7 +57,7 @@ class LetitbitNet(SimpleHoster): def getFileInfo(self): - api_rep = api_download_info(self.pyfile.url) + api_rep = api_response(self.pyfile.url) if api_rep['status'] == 'OK': self.api_data = api_rep['data'][0] self.pyfile.name = self.api_data['name'] @@ -66,12 +66,12 @@ class LetitbitNet(SimpleHoster): self.offline() - def handleFree(self): + def handleFree(self, pyfile): action, inputs = self.parseHtmlForm('id="ifree_form"') if not action: self.error(_("ifree_form")) - self.pyfile.size = float(inputs['sssize']) + pyfile.size = float(inputs['sssize']) self.logDebug(action, inputs) inputs['desc'] = "" @@ -79,15 +79,20 @@ class LetitbitNet(SimpleHoster): m = re.search(self.SECONDS_PATTERN, self.html) seconds = int(m.group(1)) if m else 60 + self.logDebug("Seconds found", seconds) + m = re.search(self.CAPTCHA_CONTROL_FIELD, self.html) recaptcha_control_field = m.group(1) + self.logDebug("ReCaptcha control field found", recaptcha_control_field) + self.wait(seconds) res = self.load("http://letitbit.net/ajax/download3.php", post=" ", cookies=True) if res != '1': self.error(_("Unknown response - ajax_check_url")) + self.logDebug(res) recaptcha = ReCaptcha(self) @@ -96,21 +101,30 @@ class LetitbitNet(SimpleHoster): post_data = {"recaptcha_challenge_field": challenge, "recaptcha_response_field": response, "recaptcha_control_field": recaptcha_control_field} + self.logDebug("Post data to send", post_data) + res = self.load("http://letitbit.net/ajax/check_recaptcha.php", post=post_data, cookies=True) + self.logDebug(res) + if not res: self.invalidCaptcha() + if res == "error_free_download_blocked": self.logWarning(_("Daily limit reached")) self.wait(secondsToMidnight(gmt=2), True) + if res == "error_wrong_captcha": self.invalidCaptcha() self.retry() + elif res.startswith('['): urls = json_loads(res) + elif res.startswith('http://'): urls = [res] + else: self.error(_("Unknown response - captcha check")) @@ -126,11 +140,11 @@ class LetitbitNet(SimpleHoster): self.fail(_("Download did not finish correctly")) - def handlePremium(self): + def handlePremium(self, pyfile): api_key = self.user premium_key = self.account.getAccountData(self.user)['password'] - json_data = [api_key, ["download/direct_links", {"pass": premium_key, "link": self.pyfile.url}]] + json_data = [api_key, ["download/direct_links", {"pass": premium_key, "link": pyfile.url}]] api_rep = self.load('http://api.letitbit.net/json', post={'r': json_dumps(json_data)}) self.logDebug("API Data: " + api_rep) api_rep = json_loads(api_rep) diff --git a/module/plugins/hoster/LinestorageCom.py b/module/plugins/hoster/LinestorageCom.py deleted file mode 100644 index a3caacc0c..000000000 --- a/module/plugins/hoster/LinestorageCom.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- - -from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo - - -class LinestorageCom(XFSHoster): - __name__ = "LinestorageCom" - __type__ = "hoster" - __version__ = "0.01" - - __pattern__ = r'http://(?:www\.)?linestorage\.com/\w{12}' - - __description__ = """Linestorage.com hoster plugin""" - __license__ = "GPLv3" - __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - - - HOSTER_DOMAIN = "linestorage.com" - - -getInfo = create_getInfo(LinestorageCom) diff --git a/module/plugins/hoster/LinksnappyCom.py b/module/plugins/hoster/LinksnappyCom.py index b7127c066..aa3466036 100644 --- a/module/plugins/hoster/LinksnappyCom.py +++ b/module/plugins/hoster/LinksnappyCom.py @@ -11,11 +11,11 @@ from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo class LinksnappyCom(MultiHoster): __name__ = "LinksnappyCom" __type__ = "hoster" - __version__ = "0.06" + __version__ = "0.07" __pattern__ = r'https?://(?:[^/]*\.)?linksnappy\.com' - __description__ = """Linksnappy.com hoster plugin""" + __description__ = """Linksnappy.com multi-hoster plugin""" __license__ = "GPLv3" __authors__ = [("stickell", "l.stickell@yahoo.it")] @@ -23,9 +23,9 @@ class LinksnappyCom(MultiHoster): SINGLE_CHUNK_HOSTERS = ('easybytez.com') - def handlePremium(self): - host = self._get_host(self.pyfile.url) - json_params = json_dumps({'link': self.pyfile.url, + def handlePremium(self, pyfile): + host = self._get_host(pyfile.url) + json_params = json_dumps({'link': pyfile.url, 'type': host, 'username': self.user, 'password': self.account.getAccountData(self.user)['password']}) @@ -40,7 +40,7 @@ class LinksnappyCom(MultiHoster): self.logError(msg, j['error']) self.fail(msg) - self.pyfile.name = j['filename'] + pyfile.name = j['filename'] self.link = j['generated'] if host in self.SINGLE_CHUNK_HOSTERS: @@ -48,19 +48,10 @@ class LinksnappyCom(MultiHoster): else: self.setup() - if self.link != self.pyfile.url: + if self.link != pyfile.url: self.logDebug("New URL: " + self.link) - def checkFile(self): - super(LinksnappyCom, self).checkFile() - - check = self.checkDownload({"html302": "<title>302 Found</title>"}) - - if check == "html302": - self.retry(wait_time=5, reason=_("Linksnappy returns only HTML data")) - - @staticmethod def _get_host(url): host = urlsplit(url).netloc diff --git a/module/plugins/hoster/LoadTo.py b/module/plugins/hoster/LoadTo.py index 0a5b26410..b21a69b5f 100644 --- a/module/plugins/hoster/LoadTo.py +++ b/module/plugins/hoster/LoadTo.py @@ -13,7 +13,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class LoadTo(SimpleHoster): __name__ = "LoadTo" __type__ = "hoster" - __version__ = "0.18" + __version__ = "0.19" __pattern__ = r'http://(?:www\.)?load\.to/\w+' @@ -27,7 +27,7 @@ class LoadTo(SimpleHoster): SIZE_PATTERN = r'Size: (?P<S>[\d.,]+) (?P<U>[\w^_]+)' OFFLINE_PATTERN = r'>Can\'t find file' - LINK_PATTERN = r'<form method="post" action="(.+?)"' + LINK_FREE_PATTERN = r'<form method="post" action="(.+?)"' WAIT_PATTERN = r'type="submit" value="Download \((\d+)\)"' URL_REPLACEMENTS = [(r'(\w)$', r'\1/')] @@ -38,11 +38,11 @@ class LoadTo(SimpleHoster): self.chunkLimit = 1 - def handleFree(self): + def handleFree(self, pyfile): # Search for Download URL - m = re.search(self.LINK_PATTERN, self.html) + m = re.search(self.LINK_FREE_PATTERN, self.html) if m is None: - self.error(_("LINK_PATTERN not found")) + self.error(_("LINK_FREE_PATTERN not found")) download_url = m.group(1) @@ -59,17 +59,7 @@ class LoadTo(SimpleHoster): self.download(download_url) else: challenge, response = solvemedia.challenge(captcha_key) - self.download(download_url, post={"adcopy_challenge": challenge, "adcopy_response": response}) - check = self.checkDownload({'404': re.compile("\A<h1>404 Not Found</h1>"), 'html': re.compile("html")}) - - if check == "404": - self.invalidCaptcha() - self.retry() - elif check == "html": - self.logWarning(_("Downloaded file is an html page, will retry")) - self.retry() - getInfo = create_getInfo(LoadTo) diff --git a/module/plugins/hoster/LuckyShareNet.py b/module/plugins/hoster/LuckyShareNet.py index 2c33b57e7..09300a41a 100644 --- a/module/plugins/hoster/LuckyShareNet.py +++ b/module/plugins/hoster/LuckyShareNet.py @@ -11,7 +11,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class LuckyShareNet(SimpleHoster): __name__ = "LuckyShareNet" __type__ = "hoster" - __version__ = "0.04" + __version__ = "0.05" __pattern__ = r'https?://(?:www\.)?luckyshare\.net/(?P<ID>\d{10,})' @@ -41,11 +41,12 @@ class LuckyShareNet(SimpleHoster): # TODO: There should be a filesize limit for free downloads # TODO: Some files could not be downloaded in free mode - def handleFree(self): + def handleFree(self, pyfile): rep = self.load(r"http://luckyshare.net/download/request/type/time/file/" + self.info['pattern']['ID'], decode=True) + self.logDebug("JSON: " + rep) - json = self.parseJson(rep) + json = self.parseJson(rep) self.wait(int(json['time'])) recaptcha = ReCaptcha(self) diff --git a/module/plugins/hoster/MediafireCom.py b/module/plugins/hoster/MediafireCom.py index 782d78ce1..81bd36f73 100644 --- a/module/plugins/hoster/MediafireCom.py +++ b/module/plugins/hoster/MediafireCom.py @@ -54,7 +54,7 @@ def getInfo(urls): class MediafireCom(SimpleHoster): __name__ = "MediafireCom" __type__ = "hoster" - __version__ = "0.82" + __version__ = "0.83" __pattern__ = r'http://(?:www\.)?mediafire\.com/(file/|(view/?|download\.php)?\?)(\w{11}|\w{15})($|/)' @@ -88,9 +88,9 @@ class MediafireCom(SimpleHoster): self.check_data = self.getFileInfo() if self.account: - self.handlePremium() + self.handlePremium(pyfile) else: - self.handleFree() + self.handleFree(pyfile) elif result == 1: self.offline() else: @@ -98,7 +98,7 @@ class MediafireCom(SimpleHoster): self.download(self.link, disposition=True) - def handleFree(self): + def handleFree(self, pyfile): if self.PASSWORD_PATTERN in self.html: password = self.getPassword() diff --git a/module/plugins/hoster/MegaCoNz.py b/module/plugins/hoster/MegaCoNz.py index ed334601a..fbd34c563 100644 --- a/module/plugins/hoster/MegaCoNz.py +++ b/module/plugins/hoster/MegaCoNz.py @@ -1,6 +1,5 @@ # -*- coding: utf-8 -*- -import math import os import random import re @@ -49,9 +48,9 @@ from module.utils import decode, fs_decode, fs_encode class MegaCoNz(Hoster): __name__ = "MegaCoNz" __type__ = "hoster" - __version__ = "0.24" + __version__ = "0.26" - __pattern__ = r'https?://(?:www\.)?mega\.co\.nz/#(?P<TYPE>N|)!(?P<ID>[\w^_]+)!(?P<KEY>[\w,\\-]+)' + __pattern__ = r'(?:https?://(?:www\.)?mega\.co\.nz/|mega:|chrome:.+?)#(?P<TYPE>N|)!(?P<ID>[\w^_]+)!(?P<KEY>[\w,\\-]+)' __description__ = """Mega.co.nz hoster plugin""" __license__ = "GPLv3" @@ -130,7 +129,7 @@ class MegaCoNz(Hoster): chunk_size = 2 ** 15 # buffer size, 32k # file_mac = [0, 0, 0, 0] # calculate CBC-MAC for checksum - chunks = int(math.ceil(os.path.getsize(file_crypted) / chunk_size)) + chunks = os.path.getsize(file_crypted) / chunk_size + 1 for i in xrange(chunks): buf = f.read(chunk_size) if not buf: diff --git a/module/plugins/hoster/MegaDebridEu.py b/module/plugins/hoster/MegaDebridEu.py index 6e24cc7ba..8bbc733e0 100644 --- a/module/plugins/hoster/MegaDebridEu.py +++ b/module/plugins/hoster/MegaDebridEu.py @@ -11,11 +11,11 @@ from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo class MegaDebridEu(MultiHoster): __name__ = "MegaDebridEu" __type__ = "hoster" - __version__ = "0.45" + __version__ = "0.46" __pattern__ = r'http://((?:www\d+\.|s\d+\.)?mega-debrid\.eu|\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})/download/file/[\w^_]+' - __description__ = """mega-debrid.eu hoster plugin""" + __description__ = """mega-debrid.eu multi-hoster plugin""" __license__ = "GPLv3" __authors__ = [("D.Ducatel", "dducatel@je-geek.fr")] @@ -30,19 +30,19 @@ class MegaDebridEu(MultiHoster): return "" - def handlePremium(self): - if not self.connectToApi(): + def handlePremium(self, pyfile): + if not self.api_load(): self.exitOnFail("Unable to connect to Mega-debrid.eu") - self.link = self.debridLink(self.pyfile.url) + self.link = self.debridLink(pyfile.url) self.logDebug("New URL: " + self.link) filename = self.getFilename(self.link) if filename != "": - self.pyfile.name = filename + pyfile.name = filename - def connectToApi(self): + def api_load(self): """ Connexion to the mega-debrid API Return True if succeed diff --git a/module/plugins/hoster/MegaRapidCz.py b/module/plugins/hoster/MegaRapidCz.py index 37732ade6..048561ac5 100644 --- a/module/plugins/hoster/MegaRapidCz.py +++ b/module/plugins/hoster/MegaRapidCz.py @@ -4,6 +4,7 @@ import re from pycurl import HTTPHEADER +from module.network.HTTPRequest import BadHeader from module.network.RequestFactory import getRequest from module.plugins.internal.SimpleHoster import SimpleHoster, parseFileInfo @@ -22,7 +23,7 @@ def getInfo(urls): class MegaRapidCz(SimpleHoster): __name__ = "MegaRapidCz" __type__ = "hoster" - __version__ = "0.55" + __version__ = "0.56" __pattern__ = r'http://(?:www\.)?(share|mega)rapid\.cz/soubor/\d+/.+' @@ -40,8 +41,9 @@ class MegaRapidCz(SimpleHoster): CHECK_TRAFFIC = True - LINK_PATTERN = r'<a href="([^"]+)" title="Stahnout">([^<]+)</a>' - ERR_LOGIN_PATTERN = ur'<div class="error_div"><strong>Stahování je přístupné pouze přihlášeným uživatelům' + LINK_PREMIUM_PATTERN = r'<a href="([^"]+)" title="Stahnout">([^<]+)</a>' + + ERR_LOGIN_PATTERN = ur'<div class="error_div"><strong>Stahování je přístupné pouze přihlášeným uživatelům' ERR_CREDIT_PATTERN = ur'<div class="error_div"><strong>Stahování zdarma je možné jen přes náš' @@ -49,14 +51,8 @@ class MegaRapidCz(SimpleHoster): self.chunkLimit = 1 - def handlePremium(self): - try: - self.html = self.load(self.pyfile.url, decode=True) - except BadHeader, e: - self.account.relogin(self.user) - self.retry(wait_time=60, reason=str(e)) - - m = re.search(self.LINK_PATTERN, self.html) + def handlePremium(self, pyfile): + m = re.search(self.LINK_PREMIUM_PATTERN, self.html) if m: link = m.group(1) self.logDebug("Premium link: %s" % link) diff --git a/module/plugins/hoster/MegacrypterCom.py b/module/plugins/hoster/MegacrypterCom.py index 4034f7d32..10a2eb025 100644 --- a/module/plugins/hoster/MegacrypterCom.py +++ b/module/plugins/hoster/MegacrypterCom.py @@ -10,9 +10,9 @@ from module.plugins.hoster.MegaCoNz import MegaCoNz class MegacrypterCom(MegaCoNz): __name__ = "MegacrypterCom" __type__ = "hoster" - __version__ = "0.21" + __version__ = "0.22" - __pattern__ = r'(https?://\w{0,10}\.?megacrypter\.com/[\w!-]+)' + __pattern__ = r'https?://\w{0,10}\.?megacrypter\.com/[\w!-]+' __description__ = """Megacrypter.com decrypter plugin""" __license__ = "GPLv3" @@ -23,7 +23,7 @@ class MegacrypterCom(MegaCoNz): FILE_SUFFIX = ".crypted" - def callApi(self, **kwargs): + def api_response(self, **kwargs): """ Dispatch a call to the api, see megacrypter.com/api_doc """ self.logDebug("JSON request: " + json_dumps(kwargs)) res = self.load(self.API_URL, post=json_dumps(kwargs)) @@ -33,13 +33,13 @@ class MegacrypterCom(MegaCoNz): def process(self, pyfile): # match is guaranteed because plugin was chosen to handle url - node = re.match(self.__pattern__, pyfile.url).group(1) + node = re.match(self.__pattern__, pyfile.url).group(0) # get Mega.co.nz link info - info = self.callApi(link=node, m="info") + info = self.api_response(link=node, m="info") # get crypted file URL - dl = self.callApi(link=node, m="dl") + dl = self.api_response(link=node, m="dl") # TODO: map error codes, implement password protection # if info['pass'] is True: @@ -50,6 +50,7 @@ class MegacrypterCom(MegaCoNz): pyfile.name = info['name'] + self.FILE_SUFFIX self.download(dl['url']) + self.decryptFile(key) # Everything is finished and final name can be set diff --git a/module/plugins/hoster/MegasharesCom.py b/module/plugins/hoster/MegasharesCom.py index 9d8441c6f..bdb428143 100644 --- a/module/plugins/hoster/MegasharesCom.py +++ b/module/plugins/hoster/MegasharesCom.py @@ -10,7 +10,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class MegasharesCom(SimpleHoster): __name__ = "MegasharesCom" __type__ = "hoster" - __version__ = "0.27" + __version__ = "0.28" __pattern__ = r'http://(?:www\.)?(d\d{2}\.)?megashares\.com/((index\.php)?\?d\d{2}=|dl/)\w+' @@ -39,11 +39,11 @@ class MegasharesCom(SimpleHoster): self.multiDL = self.premium - def handlePremium(self): + def handlePremium(self, pyfile): self.handleDownload(True) - def handleFree(self): + def handleFree(self, pyfile): if self.NO_SLOTS_PATTERN in self.html: self.retry(wait_time=5 * 60) diff --git a/module/plugins/hoster/MultihostersCom.py b/module/plugins/hoster/MultihostersCom.py index 04192cd8e..c5a48310e 100644 --- a/module/plugins/hoster/MultihostersCom.py +++ b/module/plugins/hoster/MultihostersCom.py @@ -1,41 +1,15 @@ # -*- coding: utf-8 -*- -import re -from module.plugins.Hoster import Hoster +from module.plugins.hosters.ZeveraCom import ZeveraCom -class MultihostersCom(Hoster): - __name__ = "MultihostersCom" - __version__ = "0.01" - __type__ = "hoster" - __pattern__ = r'http://(?:www\.)?multihosters.com/.*' - __description__ = """Multihosters.com hoster plugin""" - __author_name__ = "tjeh" - __author_mail__ = "tjeh@gmx.net" - def setup(self): - self.resumeDownload = self.multiDL = True - self.chunkLimit = 1 +class MultihostersCom(ZeveraCom): + __name__ = "MultihostersCom" + __type__ = "hoster" + __version__ = "0.02" - def process(self, pyfile): - if re.match(self.__pattern__, pyfile.url): - new_url = pyfile.url - elif not self.account: - self.logError(("Please enter your %s account or deactivate this plugin") % "multihosters.com") - self.fail("No multihosters.com account provided") - else: - self.logDebug("Old URL: %s" % pyfile.url) - new_url = "http://multihosters.com/getFiles.aspx?ourl=" + pyfile.url - pyfile.url = new_url - self.logDebug("New URL: %s" % new_url) + __pattern__ = r'https?://(?:www\.)multihosters\.com/(getFiles\.ashx|Members/download\.ashx)\?.*ourl=.+' - if self.account.getAPIData(self.req, cmd="checklink", olink=pyfile.url) != "Alive": - self.fail("Offline or not downloadable - contact Multihosters support") - - header = self.account.getAPIData(self.req, just_header=True, cmd="generatedownloaddirect", olink=pyfile.url) - if not "location" in header: - self.fail("Unable to initialize download - contact Multihosters support") - self.download(header['location'], disposition=True) - - check = self.checkDownload({"error": 'action="ErrorDownload.aspx'}) - if check == "error": - self.fail("Error response received - contact Multihosters support") + __description__ = """Multihosters.com multi-hoster plugin""" + __license__ = "GPLv3" + __authors__ = [("tjeh", "tjeh@gmx.net")] diff --git a/module/plugins/hoster/MultishareCz.py b/module/plugins/hoster/MultishareCz.py index 421ad111b..7a6e73252 100644 --- a/module/plugins/hoster/MultishareCz.py +++ b/module/plugins/hoster/MultishareCz.py @@ -10,7 +10,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class MultishareCz(SimpleHoster): __name__ = "MultishareCz" __type__ = "hoster" - __version__ = "0.39" + __version__ = "0.40" __pattern__ = r'http://(?:www\.)?multishare\.cz/stahnout/(?P<ID>\d+)' @@ -28,12 +28,12 @@ class MultishareCz(SimpleHoster): OFFLINE_PATTERN = ur'<h1>Stáhnout soubor</h1><p><strong>Požadovaný soubor neexistuje.</strong></p>' - def handleFree(self): - self.download("http://www.multishare.cz/html/download_free.php?ID=%s" % self.info['pattern']['ID']) + def handleFree(self, pyfile): + self.download("http://www.multishare.cz/html/download_free.php", get={'ID': self.info['pattern']['ID']}) - def handlePremium(self): - self.download("http://www.multishare.cz/html/download_premium.php?ID=%s" % self.info['pattern']['ID']) + def handlePremium(self, pyfile): + self.download("http://www.multishare.cz/html/download_premium.php", get={'ID': self.info['pattern']['ID']}) def handleMulti(self, pyfile): diff --git a/module/plugins/hoster/MyfastfileCom.py b/module/plugins/hoster/MyfastfileCom.py index 13ba2af21..5ea2639f1 100644 --- a/module/plugins/hoster/MyfastfileCom.py +++ b/module/plugins/hoster/MyfastfileCom.py @@ -9,11 +9,11 @@ from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo class MyfastfileCom(MultiHoster): __name__ = "MyfastfileCom" __type__ = "hoster" - __version__ = "0.07" + __version__ = "0.08" __pattern__ = r'http://\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/dl/' - __description__ = """Myfastfile.com hoster plugin""" + __description__ = """Myfastfile.com multi-hoster plugin""" __license__ = "GPLv3" __authors__ = [("stickell", "l.stickell@yahoo.it")] @@ -22,19 +22,19 @@ class MyfastfileCom(MultiHoster): self.chunkLimit = -1 - def handlePremium(self): - self.logDebug("Original URL: %s" % self.pyfile.url) + def handlePremium(self, pyfile): + self.logDebug("Original URL: %s" % pyfile.url) page = self.load('http://myfastfile.com/api.php', get={'user': self.user, 'pass': self.account.getAccountData(self.user)['password'], - 'link': self.pyfile.url}) + 'link': pyfile.url}) self.logDebug("JSON data: " + page) page = json_loads(page) if page['status'] != 'ok': self.fail(_("Unable to unrestrict link")) self.link = page['link'] - if self.link != self.pyfile.url: + if self.link != pyfile.url: self.logDebug("Unrestricted URL: " + self.link) diff --git a/module/plugins/hoster/NarodRu.py b/module/plugins/hoster/NarodRu.py index 21d4e3e3d..8b56c0908 100644 --- a/module/plugins/hoster/NarodRu.py +++ b/module/plugins/hoster/NarodRu.py @@ -10,7 +10,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class NarodRu(SimpleHoster): __name__ = "NarodRu" __type__ = "hoster" - __version__ = "0.11" + __version__ = "0.12" __pattern__ = r'http://(?:www\.)?narod(\.yandex)?\.ru/(disk|start/\d+\.\w+-narod\.yandex\.ru)/(?P<ID>\d+)/.+' @@ -28,29 +28,35 @@ class NarodRu(SimpleHoster): (r"/start/\d+\.\w+-narod\.yandex\.ru/(\d{6,15})/\w+/(\w+)", r"/disk/\1/\2")] CAPTCHA_PATTERN = r'<number url="(.*?)">(\w+)</number>' - LINK_PATTERN = r'<a class="h-link" rel="yandex_bar" href="(.+?)">' + LINK_FREE_PATTERN = r'<a class="h-link" rel="yandex_bar" href="(.+?)">' - def handleFree(self): + def handleFree(self, pyfile): for _i in xrange(5): self.html = self.load('http://narod.ru/disk/getcapchaxml/?rnd=%d' % int(random() * 777)) + m = re.search(self.CAPTCHA_PATTERN, self.html) if m is None: self.error(_("Captcha")) + post_data = {"action": "sendcapcha"} captcha_url, post_data['key'] = m.groups() post_data['rep'] = self.decryptCaptcha(captcha_url) - self.html = self.load(self.pyfile.url, post=post_data, decode=True) - m = re.search(self.LINK_PATTERN, self.html) + self.html = self.load(pyfile.url, post=post_data, decode=True) + + m = re.search(self.LINK_FREE_PATTERN, self.html) if m: url = 'http://narod.ru' + m.group(1) self.correctCaptcha() break + elif u'<b class="error-msg"><strong>Ошиблись?</strong>' in self.html: self.invalidCaptcha() + else: self.error(_("Download link")) + else: self.fail(_("No valid captcha code entered")) diff --git a/module/plugins/hoster/NetloadIn.py b/module/plugins/hoster/NetloadIn.py index f5c5ee802..35c814656 100644 --- a/module/plugins/hoster/NetloadIn.py +++ b/module/plugins/hoster/NetloadIn.py @@ -3,7 +3,7 @@ import re from urlparse import urljoin -from time import sleep, time +from time import time from module.network.RequestFactory import getURL from module.plugins.Hoster import Hoster @@ -88,7 +88,7 @@ class NetloadIn(Hoster): def prepare(self): - self.download_api_data() + self.api_load() if self.api_data and self.api_data['filename']: self.pyfile.name = self.api_data['filename'] @@ -111,7 +111,7 @@ class NetloadIn(Hoster): return False - def download_api_data(self, n=0): + def api_load(self, n=0): url = self.url id_regex = re.compile(self.__pattern__) match = id_regex.search(url) @@ -129,8 +129,9 @@ class NetloadIn(Hoster): get={"file_id": match.group(1), "auth": "Zf9SnQh9WiReEsb18akjvQGqT0I830e8", "bz": "1", "md5": "1"}, decode=True).strip() if not html and n <= 3: - sleep(0.2) - self.download_api_data(n + 1) + self.setWait(2) + self.wait() + self.api_load(n + 1) return self.logDebug("APIDATA: " + html) diff --git a/module/plugins/hoster/NitroflareCom.py b/module/plugins/hoster/NitroflareCom.py index 5b535591a..30cc62eaf 100644 --- a/module/plugins/hoster/NitroflareCom.py +++ b/module/plugins/hoster/NitroflareCom.py @@ -1,22 +1,29 @@ # -*- coding: utf-8 -*- +# +# Note: +# Right now premium support is not added +# Thus, any file that require premium support +# cannot be downloaded. Only the file that is free to +# download can be downloaded. import re -import json -from time import sleep -from module.plugins.Hoster import Hoster +from module.common.json_layer import json_loads from module.plugins.internal.CaptchaService import ReCaptcha +from module.plugins.SimpleHoster import SimpleHoster -class NitroflareCom(Hoster): - __name__ = "NitroflareCom" - __type__ = "hoster" - __version__ = "0.13" +class NitroflareCom(SimpleHoster): + __name__ = "NitroflareCom" + __type__ = "hoster" + __version__ = "0.25" + + __pattern__ = r'https?://(?:www\.)?nitroflare\.com/view/(?P<ID>[\w^_]+)' - __pattern__ = r'https?://(?:www\.)?(nitroflare\.com/view)/(?P<ID>[A-Z0-9]+)' __description__ = """Nitroflare.com hoster plugin""" - __license__ = "GPLv3" - __authors__ = [("sahil", None)] + __license__ = "GPLv3" + __authors__ = [("sahil", "sahilshekhawat01@gmail.com"), + ("Walter Purcaro", "vuolter@gmail.com")] BASE_URL = "https://nitroflare.com" API_URL = "https://nitroflare.com/api/" @@ -24,17 +31,14 @@ class NitroflareCom(Hoster): IS_FREE = True PREMIUM_URL = BASE_URL + "/payment" - def process(self, pyfile): - - if "https://" not in pyfile.url: - pyfile.url = self.correct_download_link(pyfile.url) + LINK_FREE_PATTERN = r'(https?://[\w\\-]+\\.nitroflare\\.com/[^<>\"]*?)"' - url_match = re.match(self.__pattern__, pyfile.url) - file_uid = url_match.group('ID') + def handleFree(self, pyfile): if self.checkLink(file_uid): - file_info = self.load(self.API_URL + "getDownloadLink?file=" + file_uid) + file_info = self.load("https://nitroflare.com/api/getDownloadLink", + get={'file': self.info['pattern']['ID']}) self.logWarning(file_info[3:]) - file_info = json.loads(file_info[3:]) # removing non ascii characters + file_info = json_loads(file_info[3:]) # removing non ascii characters if file_info['type'] == "success": result = file_info['result'] # already a dict if result['linkType'] == "free": @@ -42,6 +46,7 @@ class NitroflareCom(Hoster): captch_key = result['recaptchaPublic'] filename = result['name'] recaptcha = ReCaptcha(self) + # used here to load the cookies which will be required later main_page = self.load(pyfile.url) go_to_free_page = self.load(pyfile.url, post={"goToFreePage": ""}) @@ -84,10 +89,7 @@ class NitroflareCom(Hoster): if download_link is None: self.fail("Could not find a download link. Please check the download link again") else: - try: - self.download(download_link) - except: - self.fail("Downloading failed") + self.download(download_link) else: self.fail("Link is not valid. Please check the link again") @@ -101,4 +103,4 @@ class NitroflareCom(Hoster): handle_downloadAPI(download_url, account) def enable_premium(self, url): - self.IS_FREE = False # To try premium + self.IS_FREE = False # To try premium
\ No newline at end of file diff --git a/module/plugins/hoster/NoPremiumPl.py b/module/plugins/hoster/NoPremiumPl.py index feedd7651..361d48c2d 100644 --- a/module/plugins/hoster/NoPremiumPl.py +++ b/module/plugins/hoster/NoPremiumPl.py @@ -1,75 +1,74 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.SimpleHoster import SimpleHoster -from module.common.json_layer import json_loads as loads - - -class NoPremiumPl(SimpleHoster): - __name__ = "NoPremiumPl" - __version__ = "0.01" - __type__ = "hoster" - - __pattern__ = r"https?://direct\.nopremium\.pl.*" - __description__ = "NoPremium.pl hoster plugin" - __license__ = "GPLv3" - __authors__ = [("goddie", "dev@nopremium.pl")] - - _api_url = "http://crypt.nopremium.pl" - - _api_query = {"site": "nopremium", - "output": "json", - "username": "", - "password": "", - "url": ""} - - _error_codes = { - 0: "[%s] Incorrect login credentials", - 1: "[%s] Not enough transfer to download - top-up your account", - 2: "[%s] Incorrect / dead link", - 3: "[%s] Error connecting to hosting, try again later", - 9: "[%s] Premium account has expired", - 15: "[%s] Hosting no longer supported", - 80: "[%s] Too many incorrect login attempts, account blocked for 24h" - } - - _usr = False - _pwd = False - - def setup(self): - self.resumeDownload = True - self.multiDL = True - - def get_username_password(self): - if not self.account: - self.fail(_("Please enter your %s account or deactivate this plugin") % "NoPremium.pl") - else: - data = self.account.getAccountData(self.user) - self._usr = data['usr'] - self._pwd = data['pwd'] +from module.common.json_layer import json_loads +from module.plugins.internal.MultiHoster import MultiHoster + + +class NoPremiumPl(MultiHoster): + __name__ = "NoPremiumPl" + __type__ = "hoster" + __version__ = "0.02" + + __pattern__ = r'https?://direct\.nopremium\.pl.+' + + __description__ = """NoPremium.pl multi-hoster plugin""" + __license__ = "GPLv3" + __authors__ = [("goddie", "dev@nopremium.pl")] + + + API_URL = "http://crypt.nopremium.pl" + + API_QUERY = {'site' : "nopremium", + 'output' : "json", + 'username': "", + 'password': "", + 'url' : ""} + + ERROR_CODES = {0 : "[%s] Incorrect login credentials", + 1 : "[%s] Not enough transfer to download - top-up your account", + 2 : "[%s] Incorrect / dead link", + 3 : "[%s] Error connecting to hosting, try again later", + 9 : "[%s] Premium account has expired", + 15: "[%s] Hosting no longer supported", + 80: "[%s] Too many incorrect login attempts, account blocked for 24h"} + + + def prepare(self): + super(NoPremiumPl, self).prepare() + + data = self.account.getAccountData(self.user) + + self.usr = data['usr'] + self.pwd = data['pwd'] + def runFileQuery(self, url, mode=None): - query = self._api_query.copy() - query["username"] = self._usr - query["password"] = self._pwd - query["url"] = url + query = self.API_QUERY.copy() + + query["username"] = self.usr + query["password"] = self.pwd + query["url"] = url if mode == "fileinfo": query['check'] = 2 - query['loc'] = 1 + query['loc'] = 1 + self.logDebug(query) - return self.load(self._api_url, post=query) + return self.load(self.API_URL, post=query) - def process(self, pyfile): - self.get_username_password() + + def handleFree(self, pyfile): try: data = self.runFileQuery(pyfile.url, 'fileinfo') + except Exception: self.logDebug("runFileQuery error") self.tempOffline() try: - parsed = loads(data) + parsed = json_loads(data) + except Exception: self.logDebug("loads error") self.tempOffline() @@ -77,9 +76,9 @@ class NoPremiumPl(SimpleHoster): self.logDebug(parsed) if "errno" in parsed.keys(): - if parsed["errno"] in self._error_codes: + if parsed["errno"] in self.ERROR_CODES: # error code in known - self.fail(self._error_codes[parsed["errno"]] % self.__name__) + self.fail(self.ERROR_CODES[parsed["errno"]] % self.__name__) else: # error code isn't yet added to plugin self.fail( @@ -97,9 +96,8 @@ class NoPremiumPl(SimpleHoster): pyfile.size = parsed["filesize"] try: - result_dl = self.runFileQuery(pyfile.url, 'filedownload') + self.link = self.runFileQuery(pyfile.url, 'filedownload') + except Exception: self.logDebug("runFileQuery error #2") self.tempOffline() - - self.download(result_dl, disposition=True) diff --git a/module/plugins/hoster/NowDownloadSx.py b/module/plugins/hoster/NowDownloadSx.py index 0480b20bf..b69242a86 100644 --- a/module/plugins/hoster/NowDownloadSx.py +++ b/module/plugins/hoster/NowDownloadSx.py @@ -9,7 +9,7 @@ from module.utils import fixup class NowDownloadSx(SimpleHoster): __name__ = "NowDownloadSx" __type__ = "hoster" - __version__ = "0.06" + __version__ = "0.07" __pattern__ = r'http://(?:www\.)?(nowdownload\.(at|ch|co|eu|sx)/(dl/|download\.php\?id=)|likeupload\.org/)\w+' @@ -25,7 +25,7 @@ class NowDownloadSx(SimpleHoster): TOKEN_PATTERN = r'"(/api/token\.php\?token=\w+)"' CONTINUE_PATTERN = r'"(/dl2/\w+/\w+)"' WAIT_PATTERN = r'\.countdown\(\{until: \+(\d+),' - LINK_PATTERN = r'(http://s\d+\.coolcdn\.info/nowdownload/.+?)["\']' + LINK_FREE_PATTERN = r'(http://s\d+\.coolcdn\.info/nowdownload/.+?)["\']' NAME_REPLACEMENTS = [("&#?\w+;", fixup), (r'<[^>]*>', '')] @@ -36,7 +36,7 @@ class NowDownloadSx(SimpleHoster): self.chunkLimit = -1 - def handleFree(self): + def handleFree(self, pyfile): tokenlink = re.search(self.TOKEN_PATTERN, self.html) continuelink = re.search(self.CONTINUE_PATTERN, self.html) if tokenlink is None or continuelink is None: @@ -54,7 +54,7 @@ class NowDownloadSx(SimpleHoster): self.html = self.load(baseurl + str(continuelink.group(1))) - url = re.search(self.LINK_PATTERN, self.html) + url = re.search(self.LINK_FREE_PATTERN, self.html) if url is None: self.error(_("Download link not found")) diff --git a/module/plugins/hoster/NowVideoSx.py b/module/plugins/hoster/NowVideoSx.py index 0dedfbd42..3f75a33f7 100644 --- a/module/plugins/hoster/NowVideoSx.py +++ b/module/plugins/hoster/NowVideoSx.py @@ -8,7 +8,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class NowVideoSx(SimpleHoster): __name__ = "NowVideoSx" __type__ = "hoster" - __version__ = "0.09" + __version__ = "0.10" __pattern__ = r'http://(?:www\.)?nowvideo\.(at|ch|co|eu|li|sx)/(video|mobile/#/videos)/(?P<ID>\w+)' @@ -31,7 +31,7 @@ class NowVideoSx(SimpleHoster): self.multiDL = True - def handleFree(self): + def handleFree(self, pyfile): self.html = self.load("http://www.nowvideo.sx/mobile/video.php", get={'id': self.info['pattern']['ID']}) m = re.search(self.LINK_FREE_PATTERN, self.html) diff --git a/module/plugins/hoster/OneFichierCom.py b/module/plugins/hoster/OneFichierCom.py index f0e16a101..f9c0dbe85 100644 --- a/module/plugins/hoster/OneFichierCom.py +++ b/module/plugins/hoster/OneFichierCom.py @@ -8,7 +8,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class OneFichierCom(SimpleHoster): __name__ = "OneFichierCom" __type__ = "hoster" - __version__ = "0.75" + __version__ = "0.76" __pattern__ = r'https?://(?:www\.)?(?:(?P<ID1>\w+)\.)?(?P<HOST>1fichier\.com|alterupload\.com|cjoint\.net|d(es)?fichiers\.com|dl4free\.com|megadl\.fr|mesfichiers\.org|piecejointe\.net|pjointe\.com|tenvoi\.com)(?:/\?(?P<ID2>\w+))?' @@ -38,7 +38,7 @@ class OneFichierCom(SimpleHoster): self.resumeDownload = True - def handleFree(self): + def handleFree(self, pyfile): id = self.info['pattern']['ID1'] or self.info['pattern']['ID2'] url, inputs = self.parseHtmlForm('action="https://1fichier.com/\?%s' % id) @@ -53,8 +53,8 @@ class OneFichierCom(SimpleHoster): self.download(url, post=inputs) - def handlePremium(self): - return self.handleFree() + def handlePremium(self, pyfile): + return self.handleFree(pyfile) getInfo = create_getInfo(OneFichierCom) diff --git a/module/plugins/hoster/OverLoadMe.py b/module/plugins/hoster/OverLoadMe.py index cb6bb98ac..d4f4c0135 100644 --- a/module/plugins/hoster/OverLoadMe.py +++ b/module/plugins/hoster/OverLoadMe.py @@ -13,11 +13,11 @@ from module.utils import parseFileSize class OverLoadMe(MultiHoster): __name__ = "OverLoadMe" __type__ = "hoster" - __version__ = "0.07" + __version__ = "0.09" __pattern__ = r'https?://.*overload\.me/.+' - __description__ = """Over-Load.me hoster plugin""" + __description__ = """Over-Load.me multi-hoster plugin""" __license__ = "GPLv3" __authors__ = [("marley", "marley@over-load.me")] @@ -38,12 +38,12 @@ class OverLoadMe(MultiHoster): self.chunkLimit = 5 - def handlePremium(self): - https = "https" if self.getConfig("https") else "http" + def handlePremium(self, pyfile): + https = "https" if self.getConfig("ssl") else "http" data = self.account.getAccountData(self.user) page = self.load(https + "://api.over-load.me/getdownload.php", get={'auth': data['password'], - 'link': self.pyfile.url}) + 'link': pyfile.url}) data = json_loads(page) self.logDebug(data) @@ -52,30 +52,27 @@ class OverLoadMe(MultiHoster): self.logWarning(data['msg']) self.tempOffline() else: - if self.pyfile.name is not None and self.pyfile.name.endswith('.tmp') and data['filename']: - self.pyfile.name = data['filename'] - self.pyfile.size = parseFileSize(data['filesize']) + if pyfile.name is not None and pyfile.name.endswith('.tmp') and data['filename']: + pyfile.name = data['filename'] + pyfile.size = parseFileSize(data['filesize']) http_repl = ["http://", "https://"] - self.link = data['downloadlink'].replace(*http_repl if self.getConfig("https") else *http_repl[::-1]) + self.link = data['downloadlink'].replace(*http_repl if self.getConfig("ssl") else *http_repl[::-1]) - if self.link != self.pyfile.url: + if self.link != pyfile.url: self.logDebug("New URL: %s" % self.link) - if self.pyfile.name.startswith("http") or self.pyfile.name.startswith("Unknown") or self.pyfile.name.endswith('..'): + if pyfile.name.startswith("http") or pyfile.name.startswith("Unknown") or pyfile.name.endswith('..'): # only use when name wasn't already set - self.pyfile.name = self.getFilename(self.link) + pyfile.name = self.getFilename(self.link) def checkFile(self): - super(OverLoadMe, self).checkFile() - - check = self.checkDownload( - {"error": "<title>An error occured while processing your request</title>"}) - - if check == "error": + if self.checkDownload({"error": "<title>An error occured while processing your request</title>"}) # usual this download can safely be retried self.retry(wait_time=60, reason=_("An error occured while generating link.")) + return super(OverLoadMe, self).checkFile() + getInfo = create_getInfo(OverLoadMe) diff --git a/module/plugins/hoster/PremiumTo.py b/module/plugins/hoster/PremiumTo.py index 11d4e9541..665005ec3 100644 --- a/module/plugins/hoster/PremiumTo.py +++ b/module/plugins/hoster/PremiumTo.py @@ -11,35 +11,28 @@ from module.utils import fs_encode class PremiumTo(MultiHoster): __name__ = "PremiumTo" __type__ = "hoster" - __version__ = "0.19" + __version__ = "0.20" __pattern__ = r'^unmatchable$' - __description__ = """Premium.to hoster plugin""" + __description__ = """Premium.to multi-hoster plugin""" __license__ = "GPLv3" __authors__ = [("RaNaN", "RaNaN@pyload.org"), ("zoidberg", "zoidberg@mujmail.cz"), ("stickell", "l.stickell@yahoo.it")] - CHECK_TRAFFIC = True - - - def handlePremium(self): + def handlePremium(self, pyfile): #raise timeout to 2min self.download("http://premium.to/api/getfile.php", get={'username': self.account.username, 'password': self.account.password, - 'link' : self.pyfile.url}, + 'link' : pyfile.url}, disposition=True) def checkFile(self): - super(PremiumTo, self).checkFile() - - check = self.checkDownload({'nopremium': "No premium account available"}) - - if check == "nopremium": + if self.checkDownload({'nopremium': "No premium account available"}): self.retry(60, 5 * 60, "No premium account available") err = '' @@ -53,5 +46,7 @@ class PremiumTo(MultiHoster): if err: self.fail(err) + return super(PremiumTo, self).checkFile() + getInfo = create_getInfo(PremiumTo) diff --git a/module/plugins/hoster/PremiumizeMe.py b/module/plugins/hoster/PremiumizeMe.py index 07536062f..3d19c88ac 100644 --- a/module/plugins/hoster/PremiumizeMe.py +++ b/module/plugins/hoster/PremiumizeMe.py @@ -7,25 +7,25 @@ from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo class PremiumizeMe(MultiHoster): __name__ = "PremiumizeMe" __type__ = "hoster" - __version__ = "0.15" + __version__ = "0.16" __pattern__ = r'^unmatchable$' #: Since we want to allow the user to specify the list of hoster to use we let MultiHoster.coreReady - __description__ = """Premiumize.me hoster plugin""" + __description__ = """Premiumize.me multi-hoster plugin""" __license__ = "GPLv3" __authors__ = [("Florian Franzen", "FlorianFranzen@gmail.com")] - def handlePremium(self): + def handlePremium(self, pyfile): # In some cases hostsers do not supply us with a filename at download, so we # are going to set a fall back filename (e.g. for freakshare or xfileshare) - self.pyfile.name = self.pyfile.name.split('/').pop() # Remove everthing before last slash + pyfile.name = pyfile.name.split('/').pop() # Remove everthing before last slash # Correction for automatic assigned filename: Removing html at end if needed suffix_to_remove = ["html", "htm", "php", "php3", "asp", "shtm", "shtml", "cfml", "cfm"] - temp = self.pyfile.name.split('.') + temp = pyfile.name.split('.') if temp.pop() in suffix_to_remove: - self.pyfile.name = ".".join(temp) + pyfile.name = ".".join(temp) # Get account data user, data = self.account.selectAccount() @@ -35,7 +35,7 @@ class PremiumizeMe(MultiHoster): get={'method' : "directdownloadlink", 'params[login]': user, 'params[pass]' : data['password'], - 'params[link]' : self.pyfile.url})) + 'params[link]' : pyfile.url})) # Check status and decide what to do status = data['status'] diff --git a/module/plugins/hoster/PromptfileCom.py b/module/plugins/hoster/PromptfileCom.py index af38c4e15..ce0a384e3 100644 --- a/module/plugins/hoster/PromptfileCom.py +++ b/module/plugins/hoster/PromptfileCom.py @@ -8,7 +8,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class PromptfileCom(SimpleHoster): __name__ = "PromptfileCom" __type__ = "hoster" - __version__ = "0.12" + __version__ = "0.13" __pattern__ = r'https?://(?:www\.)?promptfile\.com/' @@ -21,10 +21,10 @@ class PromptfileCom(SimpleHoster): OFFLINE_PATTERN = r'<span style="[^"]*" title="File Not Found">File Not Found</span>' CHASH_PATTERN = r'<input type="hidden" name="chash" value="([^"]*)" />' - LINK_PATTERN = r'<a href=\"(.+)\" target=\"_blank\" class=\"view_dl_link\">Download File</a>' + LINK_FREE_PATTERN = r'<a href=\"(.+)\" target=\"_blank\" class=\"view_dl_link\">Download File</a>' - def handleFree(self): + def handleFree(self, pyfile): # STAGE 1: get link to continue m = re.search(self.CHASH_PATTERN, self.html) if m is None: @@ -32,12 +32,12 @@ class PromptfileCom(SimpleHoster): chash = m.group(1) self.logDebug("Read chash %s" % chash) # continue to stage2 - self.html = self.load(self.pyfile.url, decode=True, post={'chash': chash}) + self.html = self.load(pyfile.url, decode=True, post={'chash': chash}) # STAGE 2: get the direct link - m = re.search(self.LINK_PATTERN, self.html) + m = re.search(self.LINK_FREE_PATTERN, self.html) if m is None: - self.error(_("LINK_PATTERN not found")) + self.error(_("LINK_FREE_PATTERN not found")) self.download(m.group(1), disposition=True) diff --git a/module/plugins/hoster/PutdriveCom.py b/module/plugins/hoster/PutdriveCom.py new file mode 100644 index 000000000..67732a4cd --- /dev/null +++ b/module/plugins/hoster/PutdriveCom.py @@ -0,0 +1,15 @@ +# -*- coding: utf-8 -*- + +from module.plugins.hosters.ZeveraCom import ZeveraCom + + +class PutdriveCom(ZeveraCom): + __name__ = "PutdriveCom" + __type__ = "hoster" + __version__ = "0.01" + + __pattern__ = r'https?://(?:www\.)putdrive\.com/(getFiles\.ashx|Members/download\.ashx)\?.*ourl=.+' + + __description__ = """Multihosters.com multi-hoster plugin""" + __license__ = "GPLv3" + __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] diff --git a/module/plugins/hoster/QuickshareCz.py b/module/plugins/hoster/QuickshareCz.py index 85c25f6f0..210bf4cb2 100644 --- a/module/plugins/hoster/QuickshareCz.py +++ b/module/plugins/hoster/QuickshareCz.py @@ -10,7 +10,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class QuickshareCz(SimpleHoster): __name__ = "QuickshareCz" __type__ = "hoster" - __version__ = "0.55" + __version__ = "0.56" __pattern__ = r'http://(?:[^/]*\.)?quickshare\.cz/stahnout-soubor/.+' @@ -45,16 +45,15 @@ class QuickshareCz(SimpleHoster): self.premium = False if self.premium: - self.handlePremium() + self.handlePremium(pyfile) else: - self.handleFree() + self.handleFree(pyfile) - check = self.checkDownload({"err": re.compile(r"\AChyba!")}, max_size=100) - if check == "err": + if self.checkDownload({"error": re.compile(r"\AChyba!")}, max_size=100): self.fail(_("File not m or plugin defect")) - def handleFree(self): + def handleFree(self, pyfile): # get download url download_url = '%s/download.php' % self.jsvars['server'] data = dict((x, self.jsvars[x]) for x in self.jsvars if x in ("ID1", "ID2", "ID3", "ID4")) @@ -85,7 +84,7 @@ class QuickshareCz(SimpleHoster): self.download(download_url) - def handlePremium(self): + def handlePremium(self, pyfile): download_url = '%s/download_premium.php' % self.jsvars['server'] data = dict((x, self.jsvars[x]) for x in self.jsvars if x in ("ID1", "ID2", "ID4", "ID5")) self.download(download_url, get=data) diff --git a/module/plugins/hoster/RPNetBiz.py b/module/plugins/hoster/RPNetBiz.py index efd5d54ee..13c2f8776 100644 --- a/module/plugins/hoster/RPNetBiz.py +++ b/module/plugins/hoster/RPNetBiz.py @@ -9,9 +9,9 @@ from module.common.json_layer import json_loads class RPNetBiz(MultiHoster): __name__ = "RPNetBiz" __type__ = "hoster" - __version__ = "0.13" + __version__ = "0.14" - __description__ = """RPNet.biz hoster plugin""" + __description__ = """RPNet.biz multi-hoster plugin""" __license__ = "GPLv3" __pattern__ = r'https?://.+rpnet\.biz' @@ -22,16 +22,16 @@ class RPNetBiz(MultiHoster): self.chunkLimit = -1 - def handlePremium(self): + def handlePremium(self, pyfile): user, data = self.account.selectAccount() - self.logDebug("Original URL: %s" % self.pyfile.url) + self.logDebug("Original URL: %s" % pyfile.url) # Get the download link res = self.load("https://premium.rpnet.biz/client_api.php", get={"username": user, "password": data['password'], - "action": "generate", - "links": self.pyfile.url}) + "action" : "generate", + "links" : pyfile.url}) self.logDebug("JSON data: %s" % res) link_status = json_loads(res)['links'][0] # get the first link... since we only queried one diff --git a/module/plugins/hoster/RapideoPl.py b/module/plugins/hoster/RapideoPl.py index 7260ebbe3..2f7365e3b 100644 --- a/module/plugins/hoster/RapideoPl.py +++ b/module/plugins/hoster/RapideoPl.py @@ -1,73 +1,74 @@ # -*- coding: utf-8 -*- -from module.common.json_layer import json_loads as loads -from module.plugins.internal.SimpleHoster import SimpleHoster - - -class RapideoPl(SimpleHoster): - __name__ = "RapideoPl" - __version__ = "0.01" - __type__ = "hoster" - __description__ = "Rapideo.pl hoster plugin" - __license__ = "GPLv3" - __authors__ = [("goddie", "dev@rapideo.pl")] - - _api_url = "http://enc.rapideo.pl" - - _api_query = {"site": "newrd", - "output": "json", - "username": "", - "password": "", - "url": ""} - - _error_codes = { - 0: "[%s] Incorrect login credentials", - 1: "[%s] Not enough transfer to download - top-up your account", - 2: "[%s] Incorrect / dead link", - 3: "[%s] Error connecting to hosting, try again later", - 9: "[%s] Premium account has expired", - 15: "[%s] Hosting no longer supported", - 80: "[%s] Too many incorrect login attempts, account blocked for 24h" - } - - _usr = False - _pwd = False - - def setup(self): - self.resumeDownload = True - self.multiDL = True - - def get_username_password(self): - if not self.account: - self.fail(_("Please enter your %s account or deactivate this plugin") % "Rapideo.pl") - else: - data = self.account.getAccountData(self.user) - self._usr = data['usr'] - self._pwd = data['pwd'] +from module.common.json_layer import json_loads +from module.plugins.internal.MultiHoster import MultiHoster + + +class RapideoPl(MultiHoster): + __name__ = "RapideoPl" + __type__ = "hoster" + __version__ = "0.02" + + __pattern__ = r'^unmatchable$' + + __description__ = """Rapideo.pl multi-hoster plugin""" + __license__ = "GPLv3" + __authors__ = [("goddie", "dev@rapideo.pl")] + + + API_URL = "http://enc.rapideo.pl" + + API_QUERY = {'site' : "newrd", + 'output' : "json", + 'username': "", + 'password': "", + 'url' : ""} + + ERROR_CODES = {0 : "[%s] Incorrect login credentials", + 1 : "[%s] Not enough transfer to download - top-up your account", + 2 : "[%s] Incorrect / dead link", + 3 : "[%s] Error connecting to hosting, try again later", + 9 : "[%s] Premium account has expired", + 15: "[%s] Hosting no longer supported", + 80: "[%s] Too many incorrect login attempts, account blocked for 24h"} + + + def prepare(self): + super(RapideoPl, self).prepare() + + data = self.account.getAccountData(self.user) + + self.usr = data['usr'] + self.pwd = data['pwd'] + def runFileQuery(self, url, mode=None): - query = self._api_query.copy() - query["username"] = self._usr - query["password"] = self._pwd - query["url"] = url + query = self.API_QUERY.copy() + + query["username"] = self.usr + query["password"] = self.pwd + query["url"] = url if mode == "fileinfo": query['check'] = 2 - query['loc'] = 1 + query['loc'] = 1 self.logDebug(query) - return self.load(self._api_url, post=query) - def process(self, pyfile): - self.get_username_password() + return self.load(self.API_URL, post=query) + + + def handleFree(self, pyfile): try: data = self.runFileQuery(pyfile.url, 'fileinfo') + except Exception: self.logDebug("RunFileQuery error") self.tempOffline() try: - parsed = loads(data) + parsed = json_loads(data) + except Exception: self.logDebug("Loads error") self.tempOffline() @@ -75,9 +76,9 @@ class RapideoPl(SimpleHoster): self.logDebug(parsed) if "errno" in parsed.keys(): - if parsed["errno"] in self._error_codes: + if parsed["errno"] in self.ERROR_CODES: # error code in known - self.fail(self._error_codes[parsed["errno"]] % self.__name__) + self.fail(self.ERROR_CODES[parsed["errno"]] % self.__name__) else: # error code isn't yet added to plugin self.fail( @@ -95,9 +96,8 @@ class RapideoPl(SimpleHoster): pyfile.size = parsed["filesize"] try: - result_dl = self.runFileQuery(pyfile.url, 'filedownload') + self.link = self.runFileQuery(pyfile.url, 'filedownload') + except Exception: self.logDebug("runFileQuery error #2") self.tempOffline() - - self.download(result_dl, disposition=True) diff --git a/module/plugins/hoster/RapidfileshareNet.py b/module/plugins/hoster/RapidfileshareNet.py index 14d62ee74..3473b1c7c 100644 --- a/module/plugins/hoster/RapidfileshareNet.py +++ b/module/plugins/hoster/RapidfileshareNet.py @@ -6,7 +6,7 @@ from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo class RapidfileshareNet(XFSHoster): __name__ = "RapidfileshareNet" __type__ = "hoster" - __version__ = "0.02" + __version__ = "0.03" __pattern__ = r'http://(?:www\.)?rapidfileshare\.net/\w{12}' @@ -24,8 +24,4 @@ class RapidfileshareNet(XFSHoster): TEMP_OFFLINE_PATTERN = r'The page may have been renamed, removed or be temporarily unavailable.<' - def handlePremium(self): - self.fail(_("Premium download not implemented")) - - getInfo = create_getInfo(RapidfileshareNet) diff --git a/module/plugins/hoster/RapidgatorNet.py b/module/plugins/hoster/RapidgatorNet.py index ba6cfcd5c..4d192d602 100644 --- a/module/plugins/hoster/RapidgatorNet.py +++ b/module/plugins/hoster/RapidgatorNet.py @@ -13,7 +13,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, s class RapidgatorNet(SimpleHoster): __name__ = "RapidgatorNet" __type__ = "hoster" - __version__ = "0.27" + __version__ = "0.28" __pattern__ = r'http://(?:www\.)?(rapidgator\.net|rg\.to)/file/\w+' @@ -37,7 +37,7 @@ class RapidgatorNet(SimpleHoster): PREMIUM_ONLY_ERROR_PATTERN = r'You can download files up to|This file can be downloaded by premium only<' DOWNLOAD_LIMIT_ERROR_PATTERN = r'You have reached your (daily|hourly) downloads limit' WAIT_PATTERN = r'(?:Delay between downloads must be not less than|Try again in)\s*(\d+)\s*(hour|min)' - LINK_PATTERN = r'return \'(http://\w+.rapidgator.net/.*)\';' + LINK_FREE_PATTERN = r'return \'(http://\w+.rapidgator.net/.*)\';' RECAPTCHA_PATTERN = r'"http://api\.recaptcha\.net/challenge\?k=(.*?)"' ADSCAPTCHA_PATTERN = r'(http://api\.adscaptcha\.com/Get\.aspx[^"\']*)' @@ -84,23 +84,24 @@ class RapidgatorNet(SimpleHoster): self.retry(wait_time=60) - def handlePremium(self): + def handlePremium(self, pyfile): #self.logDebug("ACCOUNT_DATA", self.account.getAccountData(self.user)) self.api_data = self.api_response('info') self.api_data['md5'] = self.api_data['hash'] - self.pyfile.name = self.api_data['filename'] - self.pyfile.size = self.api_data['size'] - url = self.api_response('download')['url'] - self.download(url) + pyfile.name = self.api_data['filename'] + pyfile.size = self.api_data['size'] - def handleFree(self): + self.link = self.api_response('download')['url'] + + + def handleFree(self, pyfile): self.checkFree() jsvars = dict(re.findall(self.JSVARS_PATTERN, self.html)) self.logDebug(jsvars) - self.req.http.lastURL = self.pyfile.url + self.req.http.lastURL = pyfile.url self.req.http.c.setopt(HTTPHEADER, ["X-Requested-With: XMLHttpRequest"]) url = "http://rapidgator.net%s?fid=%s" % ( @@ -113,14 +114,14 @@ class RapidgatorNet(SimpleHoster): jsvars.get('getDownloadUrl', '/download/AjaxGetDownload'), jsvars['sid']) jsvars.update(self.getJsonResponse(url)) - self.req.http.lastURL = self.pyfile.url + self.req.http.lastURL = pyfile.url self.req.http.c.setopt(HTTPHEADER, ["X-Requested-With:"]) url = "http://rapidgator.net%s" % jsvars.get('captchaUrl', '/download/captcha') self.html = self.load(url) for _i in xrange(5): - m = re.search(self.LINK_PATTERN, self.html) + m = re.search(self.LINK_FREE_PATTERN, self.html) if m: link = m.group(1) self.logDebug(link) diff --git a/module/plugins/hoster/RapiduNet.py b/module/plugins/hoster/RapiduNet.py index 163edfe34..34e71b5f2 100644 --- a/module/plugins/hoster/RapiduNet.py +++ b/module/plugins/hoster/RapiduNet.py @@ -13,7 +13,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class RapiduNet(SimpleHoster): __name__ = "RapiduNet" __type__ = "hoster" - __version__ = "0.03" + __version__ = "0.04" __pattern__ = r'https?://(?:www\.)?rapidu\.net/(?P<ID>\d{10})' @@ -37,8 +37,8 @@ class RapiduNet(SimpleHoster): self.multiDL = self.premium - def handleFree(self): - self.req.http.lastURL = self.pyfile.url + def handleFree(self, pyfile): + self.req.http.lastURL = pyfile.url self.req.http.c.setopt(HTTPHEADER, ["X-Requested-With: XMLHttpRequest"]) jsvars = self.getJsonResponse("https://rapidu.net/ajax.php", @@ -78,7 +78,7 @@ class RapiduNet(SimpleHoster): if not res.startswith('{'): self.retry() - self.logDebug(url, res) + self.logDebug(res) return json_loads(res) diff --git a/module/plugins/hoster/RealdebridCom.py b/module/plugins/hoster/RealdebridCom.py index 5a31cc388..bf9fda293 100644 --- a/module/plugins/hoster/RealdebridCom.py +++ b/module/plugins/hoster/RealdebridCom.py @@ -14,11 +14,11 @@ from module.utils import parseFileSize class RealdebridCom(MultiHoster): __name__ = "RealdebridCom" __type__ = "hoster" - __version__ = "0.62" + __version__ = "0.64" __pattern__ = r'https?://((?:www\.|s\d+\.)?real-debrid\.com/dl/|[\w^_]\.rdb\.so/d/)[\w^_]+' - __description__ = """Real-Debrid.com hoster plugin""" + __description__ = """Real-Debrid.com multi-hoster plugin""" __license__ = "GPLv3" __authors__ = [("Devirex Hazzard", "naibaf_11@yahoo.de")] @@ -37,10 +37,10 @@ class RealdebridCom(MultiHoster): self.chunkLimit = 3 - def handlePremium(self): + def handlePremium(self, pyfile): data = json_loads(self.load("https://real-debrid.com/ajax/unrestrict.php", get={'lang' : "en", - 'link' : self.pyfile.url, + 'link' : pyfile.url, 'password': self.getPassword(), 'time' : int(time() * 1000)})) @@ -53,33 +53,30 @@ class RealdebridCom(MultiHoster): self.logWarning(data['message']) self.tempOffline() else: - if self.pyfile.name is not None and self.pyfile.name.endswith('.tmp') and data['file_name']: - self.pyfile.name = data['file_name'] - self.pyfile.size = parseFileSize(data['file_size']) + if pyfile.name is not None and pyfile.name.endswith('.tmp') and data['file_name']: + pyfile.name = data['file_name'] + pyfile.size = parseFileSize(data['file_size']) self.link = data['generated_links'][0][-1] - if self.getConfig("https"): + if self.getConfig("ssl"): self.link = self.link.replace("http://", "https://") else: self.link = self.link.replace("https://", "http://") - if self.link != self.pyfile.url: + if self.link != pyfile.url: self.logDebug("New URL: %s" % self.link) - if self.pyfile.name.startswith("http") or self.pyfile.name.startswith("Unknown") or self.pyfile.name.endswith('..'): + if pyfile.name.startswith("http") or pyfile.name.startswith("Unknown") or pyfile.name.endswith('..'): #only use when name wasnt already set - self.pyfile.name = self.getFilename(self.link) + pyfile.name = self.getFilename(self.link) def checkFile(self): - super(RealdebridCom, self).checkFile() - - check = self.checkDownload( - {"error": "<title>An error occured while processing your request</title>"}) - - if check == "error": + if self.checkDownload({"error": "<title>An error occured while processing your request</title>"}): #usual this download can safely be retried self.retry(wait_time=60, reason=_("An error occured while generating link")) + return super(RealdebridCom, self).checkFile() + getInfo = create_getInfo(RealdebridCom) diff --git a/module/plugins/hoster/RehostTo.py b/module/plugins/hoster/RehostTo.py index 96443d5f5..e706fa6c6 100644 --- a/module/plugins/hoster/RehostTo.py +++ b/module/plugins/hoster/RehostTo.py @@ -8,26 +8,20 @@ from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo class RehostTo(MultiHoster): __name__ = "RehostTo" __type__ = "hoster" - __version__ = "0.18" + __version__ = "0.20" __pattern__ = r'https?://.*rehost\.to\..+' - __description__ = """Rehost.com hoster plugin""" + __description__ = """Rehost.com multi-hoster plugin""" __license__ = "GPLv3" __authors__ = [("RaNaN", "RaNaN@pyload.org")] - def getFilename(self, url): - return unquote(url.rsplit("/", 1)[1]) - - - def handlePremium(self): - data = self.account.getAccountData(self.user) - + def handlePremium(self, pyfile): self.download("http://rehost.to/process_download.php", get={'user': "cookie", - 'pass': data['long_ses'], - 'dl' : self.pyfile.url}, + 'pass': self.account.getAccountData(self.user)['session'], + 'dl' : pyfile.url}, disposition=True) diff --git a/module/plugins/hoster/RemixshareCom.py b/module/plugins/hoster/RemixshareCom.py index ed171895e..11c9f3b0f 100644 --- a/module/plugins/hoster/RemixshareCom.py +++ b/module/plugins/hoster/RemixshareCom.py @@ -16,7 +16,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class RemixshareCom(SimpleHoster): __name__ = "RemixshareCom" __type__ = "hoster" - __version__ = "0.02" + __version__ = "0.03" __pattern__ = r'https?://remixshare\.com/(download|dl)/\w+' @@ -29,7 +29,7 @@ class RemixshareCom(SimpleHoster): INFO_PATTERN = r'title=\'.+?\'>(?P<N>.+?)</span><span class=\'light2\'> \((?P<S>\d+) (?P<U>[\w^_]+)\)<' OFFLINE_PATTERN = r'<h1>Ooops!<' - LINK_PATTERN = r'(http://remixshare\.com/downloadfinal/.+?)"' + LINK_FREE_PATTERN = r'(http://remixshare\.com/downloadfinal/.+?)"' TOKEN_PATTERN = r'var acc = (\d+)' WAIT_PATTERN = r'var XYZ = r"(\d+)"' @@ -39,13 +39,15 @@ class RemixshareCom(SimpleHoster): self.chunkLimit = 1 - def handleFree(self): - b = re.search(self.LINK_PATTERN, self.html) + def handleFree(self, pyfile): + b = re.search(self.LINK_FREE_PATTERN, self.html) if not b: self.error(_("Cannot parse download url")) + c = re.search(self.TOKEN_PATTERN, self.html) if not c: self.error(_("Cannot parse file token")) + dl_url = b.group(1) + c.group(1) #Check if we have to wait diff --git a/module/plugins/hoster/RyushareCom.py b/module/plugins/hoster/RyushareCom.py deleted file mode 100644 index 0964c51fc..000000000 --- a/module/plugins/hoster/RyushareCom.py +++ /dev/null @@ -1,80 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Test links: -# http://ryushare.com/cl0jy8ric2js/random.bin - -import re - -from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo -from module.plugins.internal.CaptchaService import SolveMedia - - -class RyushareCom(XFSHoster): - __name__ = "RyushareCom" - __type__ = "hoster" - __version__ = "0.20" - - __pattern__ = r'http://(?:www\.)?ryushare\.com/\w+' - - __description__ = """Ryushare.com hoster plugin""" - __license__ = "GPLv3" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), - ("stickell", "l.stickell@yahoo.it"), - ("quareevo", "quareevo@arcor.de")] - - - HOSTER_DOMAIN = "ryushare.com" - - WAIT_PATTERN = r'You have to wait ((?P<H>\d+) hour[s]?, )?((?P<M>\d+) minute[s], )?(?P<S>\d+) second[s]' - - LINK_PATTERN = r'<a href="([^"]+)">Click here to download<' - - - def getDownloadLink(self): - retry = False - self.html = self.load(self.pyfile.url) - action, inputs = self.parseHtmlForm(input_names={"op": re.compile("^download")}) - if "method_premium" in inputs: - del inputs['method_premium'] - - self.html = self.load(self.pyfile.url, post=inputs) - action, inputs = self.parseHtmlForm('F1') - - self.setWait(65) - # Wait 1 hour - if "You have reached the download-limit" in self.html: - self.setWait(1 * 60 * 60, True) - retry = True - - m = re.search(self.WAIT_PATTERN, self.html) - if m: - wait = m.groupdict(0) - waittime = int(wait['H']) * 60 * 60 + int(wait['M']) * 60 + int(wait['S']) - self.setWait(waittime, True) - retry = True - - self.wait() - if retry: - self.retry() - - for _i in xrange(5): - solvemedia = SolveMedia(self) - challenge, response = solvemedia.challenge() - - inputs['adcopy_challenge'] = challenge - inputs['adcopy_response'] = response - - self.html = self.load(self.pyfile.url, post=inputs) - if "WRONG CAPTCHA" in self.html: - self.invalidCaptcha() - else: - self.correctCaptcha() - break - else: - self.fail(_("You have entered 5 invalid captcha codes")) - - if "Click here to download" in self.html: - return re.search(r'<a href="([^"]+)">Click here to download</a>', self.html).group(1) - - -getInfo = create_getInfo(RyushareCom) diff --git a/module/plugins/hoster/SendmywayCom.py b/module/plugins/hoster/SendmywayCom.py deleted file mode 100644 index 637098b88..000000000 --- a/module/plugins/hoster/SendmywayCom.py +++ /dev/null @@ -1,21 +0,0 @@ -# -*- coding: utf-8 -*- - -from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo - - -class SendmywayCom(XFSHoster): - __name__ = "SendmywayCom" - __type__ = "hoster" - __version__ = "0.04" - - __pattern__ = r'http://(?:www\.)?sendmyway\.com/\w{12}' - - __description__ = """SendMyWay.com hoster plugin""" - __license__ = "GPLv3" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - - - HOSTER_DOMAIN = "sendmyway.com" - - -getInfo = create_getInfo(SendmywayCom) diff --git a/module/plugins/hoster/SendspaceCom.py b/module/plugins/hoster/SendspaceCom.py index 12f966e31..ffd2995b8 100644 --- a/module/plugins/hoster/SendspaceCom.py +++ b/module/plugins/hoster/SendspaceCom.py @@ -8,7 +8,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class SendspaceCom(SimpleHoster): __name__ = "SendspaceCom" __type__ = "hoster" - __version__ = "0.16" + __version__ = "0.17" __pattern__ = r'https?://(?:www\.)?sendspace\.com/file/\w+' @@ -21,16 +21,16 @@ class SendspaceCom(SimpleHoster): SIZE_PATTERN = r'<div class="file_description reverse margin_center">\s*<b>File Size:</b>\s*(?P<S>[\d.,]+)(?P<U>[\w^_]+)\s*</div>' OFFLINE_PATTERN = r'<div class="msg error" style="cursor: default">Sorry, the file you requested is not available.</div>' - LINK_PATTERN = r'<a id="download_button" href="([^"]+)"' + LINK_FREE_PATTERN = r'<a id="download_button" href="([^"]+)"' CAPTCHA_PATTERN = r'<td><img src="(/captchas/captcha\.php?captcha=([^"]+))"></td>' USER_CAPTCHA_PATTERN = r'<td><img src="/captchas/captcha\.php?user=([^"]+))"></td>' - def handleFree(self): + def handleFree(self, pyfile): params = {} for _i in xrange(3): - m = re.search(self.LINK_PATTERN, self.html) + m = re.search(self.LINK_FREE_PATTERN, self.html) if m: if 'captcha_hash' in params: self.correctCaptcha() @@ -51,7 +51,7 @@ class SendspaceCom(SimpleHoster): params = {'download': "Regular Download"} self.logDebug(params) - self.html = self.load(self.pyfile.url, post=params) + self.html = self.load(pyfile.url, post=params) else: self.fail(_("Download link not found")) diff --git a/module/plugins/hoster/Share4webCom.py b/module/plugins/hoster/Share4webCom.py index 4634917ad..7a276c1fe 100644 --- a/module/plugins/hoster/Share4webCom.py +++ b/module/plugins/hoster/Share4webCom.py @@ -4,8 +4,8 @@ from module.plugins.hoster.UnibytesCom import UnibytesCom from module.plugins.internal.SimpleHoster import create_getInfo -class Share4webCom(UnibytesCom): - __name__ = "Share4webCom" +class Share4WebCom(UnibytesCom): + __name__ = "Share4WebCom" __type__ = "hoster" __version__ = "0.11" @@ -19,4 +19,4 @@ class Share4webCom(UnibytesCom): HOSTER_DOMAIN = "share4web.com" -getInfo = create_getInfo(UnibytesCom) +getInfo = create_getInfo(Share4WebCom) diff --git a/module/plugins/hoster/ShareonlineBiz.py b/module/plugins/hoster/ShareonlineBiz.py index bbf75c94a..636e5824d 100644 --- a/module/plugins/hoster/ShareonlineBiz.py +++ b/module/plugins/hoster/ShareonlineBiz.py @@ -14,7 +14,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class ShareonlineBiz(SimpleHoster): __name__ = "ShareonlineBiz" __type__ = "hoster" - __version__ = "0.46" + __version__ = "0.47" __pattern__ = r'https?://(?:www\.)?(share-online\.biz|egoshare\.com)/(download\.php\?id=|dl/)(?P<ID>\w+)' @@ -32,7 +32,7 @@ class ShareonlineBiz(SimpleHoster): RECAPTCHA_KEY = "6LdatrsSAAAAAHZrB70txiV5p-8Iv8BtVxlTtjKX" - ERROR_INFO_PATTERN = r'<p class="b">Information:</p>\s*<div>\s*<strong>(.*?)</strong>' + ERROR_PATTERN = r'<p class="b">Information:</p>\s*<div>\s*<strong>(.*?)</strong>' @classmethod @@ -88,12 +88,12 @@ class ShareonlineBiz(SimpleHoster): self.fail(_("No valid captcha solution received")) - def handleFree(self): - self.html = self.load(self.pyfile.url, cookies=True) #: refer, stuff - + def handleFree(self, pyfile): self.wait(3) - self.html = self.load("%s/free/" % self.pyfile.url, post={"dl_free": "1", "choice": "free"}, decode=True) + self.html = self.load("%s/free/" % pyfile.url, + post={'dl_free': "1", 'choice': "free"}, + decode=True) self.checkErrors() @@ -110,12 +110,8 @@ class ShareonlineBiz(SimpleHoster): def checkFile(self): - super(ShareonlineBiz, self).checkFile() - - check = self.checkDownload({ - 'cookie': re.compile(r'<div id="dl_failure"'), - 'fail' : re.compile(r"<title>Share-Online") - }) + check = self.checkDownload({'cookie': re.compile(r'<div id="dl_failure"'), + 'fail' : re.compile(r"<title>Share-Online")}) if check == "cookie": self.invalidCaptcha() @@ -125,11 +121,15 @@ class ShareonlineBiz(SimpleHoster): self.invalidCaptcha() self.retry(5, 5 * 60, _("Download failed")) + return super(ShareonlineBiz, self).checkFile() + - def handlePremium(self): #: should be working better loading (account) api internally + def handlePremium(self, pyfile): #: should be working better loading (account) api internally html = self.load("http://api.share-online.biz/account.php", - {"username": self.user, "password": self.account.accounts[self.user]['password'], - "act": "download", "lid": self.info['fileid']}) + get={'username': self.user, + 'password': self.account.getAccountData(self.user)['password'], + 'act' : "download", + 'lid' : self.info['fileid']}) self.api_data = dlinfo = {} @@ -142,8 +142,8 @@ class ShareonlineBiz(SimpleHoster): if not dlinfo['status'] == "online": self.offline() else: - self.pyfile.name = dlinfo['name'] - self.pyfile.size = int(dlinfo['size']) + pyfile.name = dlinfo['name'] + pyfile.size = int(dlinfo['size']) dlLink = dlinfo['url'] @@ -163,7 +163,7 @@ class ShareonlineBiz(SimpleHoster): errmsg = m.group(1).lower() try: - self.logError(errmsg, re.search(self.ERROR_INFO_PATTERN, self.html).group(1)) + self.logError(errmsg, re.search(self.ERROR_PATTERN, self.html).group(1)) except: self.logError("Unknown error occurred", errmsg) diff --git a/module/plugins/hoster/ShareplaceCom.py b/module/plugins/hoster/ShareplaceCom.py index ccf4bcda5..07724a9d1 100644 --- a/module/plugins/hoster/ShareplaceCom.py +++ b/module/plugins/hoster/ShareplaceCom.py @@ -10,9 +10,9 @@ from module.plugins.Hoster import Hoster class ShareplaceCom(Hoster): __name__ = "ShareplaceCom" __type__ = "hoster" - __version__ = "0.11" + __version__ = "0.12" - __pattern__ = r'(http://)?(?:www\.)?shareplace\.(com|org)/\?\w+' + __pattern__ = r'http://(?:www\.)?shareplace\.(com|org)/\?\w+' __description__ = """Shareplace.com hoster plugin""" __license__ = "GPLv3" diff --git a/module/plugins/hoster/SimplyPremiumCom.py b/module/plugins/hoster/SimplyPremiumCom.py index fe38cff6e..39e8a6aeb 100644 --- a/module/plugins/hoster/SimplyPremiumCom.py +++ b/module/plugins/hoster/SimplyPremiumCom.py @@ -11,11 +11,11 @@ from module.plugins.internal.SimpleHoster import secondsToMidnight class SimplyPremiumCom(MultiHoster): __name__ = "SimplyPremiumCom" __type__ = "hoster" - __version__ = "0.07" + __version__ = "0.08" __pattern__ = r'https?://.+simply-premium\.com' - __description__ = """Simply-Premium.com hoster plugin""" + __description__ = """Simply-Premium.com multi-hoster plugin""" __license__ = "GPLv3" __authors__ = [("EvolutionClip", "evolutionclip@live.de")] @@ -24,7 +24,7 @@ class SimplyPremiumCom(MultiHoster): self.chunkLimit = 16 - def handlePremium(self): + def handlePremium(self, pyfile): for i in xrange(5): page = self.load("http://www.simply-premium.com/premium.php", get={'info': "", 'link': self.pyfile.url}) self.logDebug("JSON data: " + page) diff --git a/module/plugins/hoster/SimplydebridCom.py b/module/plugins/hoster/SimplydebridCom.py index 0be9bfa12..a26bc5751 100644 --- a/module/plugins/hoster/SimplydebridCom.py +++ b/module/plugins/hoster/SimplydebridCom.py @@ -8,18 +8,18 @@ from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo class SimplydebridCom(MultiHoster): __name__ = "SimplydebridCom" __type__ = "hoster" - __version__ = "0.14" + __version__ = "0.15" __pattern__ = r'http://\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/sd\.php' - __description__ = """Simply-debrid.com hoster plugin""" + __description__ = """Simply-debrid.com multi-hoster plugin""" __license__ = "GPLv3" __authors__ = [("Kagenoshin", "kagenoshin@gmx.ch")] - def handlePremium(self): + def handlePremium(self, pyfile): #fix the links for simply-debrid.com! - self.link = self.pyfile.url + self.link = pyfile.url self.link = self.link.replace("clz.to", "cloudzer.net/file") self.link = self.link.replace("http://share-online", "http://www.share-online") self.link = self.link.replace("ul.to", "uploaded.net/file") @@ -46,12 +46,10 @@ class SimplydebridCom(MultiHoster): def checkFile(self): - super(SimplydebridCom, self).checkFile() - - check = self.checkDownload({"bad1": "No address associated with hostname", "bad2": "<html"}) - - if check == "bad1" or check == "bad2": + if self.checkDownload({"error": "No address associated with hostname"}): self.retry(24, 3 * 60, "Bad file downloaded") + return super(SimplydebridCom, self).checkFile() + getInfo = create_getInfo(SimplydebridCom) diff --git a/module/plugins/hoster/SmoozedCom.py b/module/plugins/hoster/SmoozedCom.py new file mode 100644 index 000000000..a5116db16 --- /dev/null +++ b/module/plugins/hoster/SmoozedCom.py @@ -0,0 +1,63 @@ +# -*- coding: utf-8 -*- + +from module.common.json_layer import json_loads +from module.plugins.internal.MultiHoster import MultiHoster + + +class SmoozedCom(MultiHoster): + __name__ = "SmoozedCom" + __type__ = "hoster" + __version__ = "0.02" + + __pattern__ = r'^unmatchable$' #: Since we want to allow the user to specify the list of hoster to use we let MultiHoster.coreReady + + __description__ = """Smoozed.com hoster plugin""" + __license__ = "GPLv3" + __authors__ = [("", "")] + + + def handlePremium(self, pyfile): + # In some cases hostsers do not supply us with a filename at download, so we + # are going to set a fall back filename (e.g. for freakshare or xfileshare) + pyfile.name = pyfile.name.split('/').pop() # Remove everthing before last slash + + # Correction for automatic assigned filename: Removing html at end if needed + suffix_to_remove = ["html", "htm", "php", "php3", "asp", "shtm", "shtml", "cfml", "cfm"] + temp = pyfile.name.split('.') + + if temp.pop() in suffix_to_remove: + pyfile.name = ".".join(temp) + + # Check the link + get_data = {'session_key': self.account.getAccountData(self.user)['session_key'], + 'url' : pyfile.url} + + data = json_loads(self.load("http://www2.smoozed.com/api/check", get=get_data)) + + if data["state"] != "ok": + self.fail(data["message"]) + + if data["data"].get("state", "ok") != "ok": + if data["data"] == "Offline": + self.offline() + else: + self.fail(data["data"]["message"]) + + pyfile.name = data["data"]["name"] + pyfile.size = int(data["data"]["size"]) + + # Start the download + header = self.load("http://www2.smoozed.com/api/download", get=get_data, just_header=True) + + if not "location" in header: + self.fail(_("Unable to initialize download")) + else: + self.link = header["location"][-1] if isinstance(header["location"], list) else header["location"] + + + def checkFile(self): + if self.checkDownload({'error': '{"state":"error"}', + 'retry': '{"state":"retry"}'}): + self.fail(_("Error response received")) + + return super(SmoozedCom, self).checkFile() diff --git a/module/plugins/hoster/SpeedyshareCom.py b/module/plugins/hoster/SpeedyshareCom.py index fa54d6060..0acdb7647 100644 --- a/module/plugins/hoster/SpeedyshareCom.py +++ b/module/plugins/hoster/SpeedyshareCom.py @@ -13,7 +13,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class SpeedyshareCom(SimpleHoster): __name__ = "SpeedyshareCom" __type__ = "hoster" - __version__ = "0.03" + __version__ = "0.04" __pattern__ = r'https?://(?:www\.)?(speedyshare\.com|speedy\.sh)/\w+' @@ -27,7 +27,7 @@ class SpeedyshareCom(SimpleHoster): OFFLINE_PATTERN = r'class=downloadfilenamenotfound>.*</span>' - LINK_PATTERN = r'<a href=\'(.*)\'><img src=/gf/slowdownload\.png alt=\'Slow Download\' border=0' + LINK_FREE_PATTERN = r'<a href=\'(.*)\'><img src=/gf/slowdownload\.png alt=\'Slow Download\' border=0' def setup(self): @@ -35,17 +35,13 @@ class SpeedyshareCom(SimpleHoster): self.chunkLimit = 1 - def handleFree(self): - m = re.search(self.LINK_PATTERN, self.html) + def handleFree(self, pyfile): + m = re.search(self.LINK_FREE_PATTERN, self.html) if m is None: self.error(_("Download link not found")) dl_link = urljoin("http://www.speedyshare.com", m.group(1)) self.download(dl_link, disposition=True) - check = self.checkDownload({'html': re.compile("html")}) - if check == "html": - self.error(_("Downloaded file is an html page")) - getInfo = create_getInfo(SpeedyshareCom) diff --git a/module/plugins/hoster/TurbobitNet.py b/module/plugins/hoster/TurbobitNet.py index 258ec7d3e..ccca76018 100644 --- a/module/plugins/hoster/TurbobitNet.py +++ b/module/plugins/hoster/TurbobitNet.py @@ -17,7 +17,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, t class TurbobitNet(SimpleHoster): __name__ = "TurbobitNet" __type__ = "hoster" - __version__ = "0.16" + __version__ = "0.17" __pattern__ = r'http://(?:www\.)?turbobit\.net/(?:download/free/)?(?P<ID>\w+)' @@ -36,24 +36,28 @@ class TurbobitNet(SimpleHoster): OFFLINE_PATTERN = r'<h2>File Not Found</h2>|html\(\'File (?:was )?not found' LINK_PATTERN = r'(/download/redirect/[^"\']+)' - LIMIT_WAIT_PATTERN = r'<div id=\'timeout\'>(\d+)<' - CAPTCHA_PATTERN = r'<img alt="Captcha" src="(.+?)"' + LIMIT_WAIT_PATTERN = r'<div id=\'timeout\'>(\d+)<' + CAPTCHA_PATTERN = r'<img alt="Captcha" src="(.+?)"' - def handleFree(self): + def handleFree(self, pyfile): self.url = "http://turbobit.net/download/free/%s" % self.info['pattern']['ID'] self.html = self.load(self.url, ref=True, decode=True) rtUpdate = self.getRtUpdate() self.solveCaptcha() + self.req.http.c.setopt(HTTPHEADER, ["X-Requested-With: XMLHttpRequest"]) + self.url = self.getDownloadUrl(rtUpdate) self.wait() self.html = self.load(self.url) + self.req.http.c.setopt(HTTPHEADER, ["X-Requested-With:"]) + self.downloadFile() @@ -157,7 +161,7 @@ class TurbobitNet(SimpleHoster): return "%s GMT%+03d%02d" % (time.strftime("%a %b %d %Y %H:%M:%S", lt), -tz // 3600, tz % 3600) - def handlePremium(self): + def handlePremium(self, pyfile): self.logDebug("Premium download as user %s" % self.user) self.downloadFile() diff --git a/module/plugins/hoster/TusfilesNet.py b/module/plugins/hoster/TusfilesNet.py index a4e352956..9d0a86fe9 100644 --- a/module/plugins/hoster/TusfilesNet.py +++ b/module/plugins/hoster/TusfilesNet.py @@ -1,12 +1,13 @@ # -*- coding: utf-8 -*- +from module.network.HTTPRequest import BadHeader from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo class TusfilesNet(XFSHoster): __name__ = "TusfilesNet" __type__ = "hoster" - __version__ = "0.08" + __version__ = "0.09" __pattern__ = r'https?://(?:www\.)?tusfiles\.net/\w{12}' @@ -23,13 +24,19 @@ class TusfilesNet(XFSHoster): def setup(self): - self.multiDL = False self.chunkLimit = -1 + self.multiDL = True self.resumeDownload = True - def handlePremium(self): - return self.handleFree() + def downloadLink(self, link): + try: + return super(TusfilesNet, self).downloadLink(link) + + except BadHeader, e: + if e.code is 503: + self.multiDL = False + raise Retry("503") getInfo = create_getInfo(TusfilesNet) diff --git a/module/plugins/hoster/TwoSharedCom.py b/module/plugins/hoster/TwoSharedCom.py index 1dd67f974..c6ca2ab29 100644 --- a/module/plugins/hoster/TwoSharedCom.py +++ b/module/plugins/hoster/TwoSharedCom.py @@ -8,7 +8,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class TwoSharedCom(SimpleHoster): __name__ = "TwoSharedCom" __type__ = "hoster" - __version__ = "0.12" + __version__ = "0.13" __pattern__ = r'http://(?:www\.)?2shared\.com/(account/)?(download|get|file|document|photo|video|audio)/.+' @@ -17,11 +17,11 @@ class TwoSharedCom(SimpleHoster): __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - NAME_PATTERN = r'<h1>(?P<N>.*)</h1>' - SIZE_PATTERN = r'<span class="dtitle">File size:</span>\s*(?P<S>[\d.,]+) (?P<U>[\w^_]+)' + NAME_PATTERN = r'<h1>(?P<N>.*)</h1>' + SIZE_PATTERN = r'<span class="dtitle">File size:</span>\s*(?P<S>[\d.,]+) (?P<U>[\w^_]+)' OFFLINE_PATTERN = r'The file link that you requested is not valid\.|This file was deleted\.' - LINK_PATTERN = r'window.location =\'(.+?)\';' + LINK_FREE_PATTERN = r'window.location =\'(.+?)\';' def setup(self): @@ -29,13 +29,4 @@ class TwoSharedCom(SimpleHoster): self.multiDL = True - def handleFree(self): - m = re.search(self.LINK_PATTERN, self.html) - if m is None: - self.error(_("Download link")) - - link = m.group(1) - self.download(link) - - getInfo = create_getInfo(TwoSharedCom) diff --git a/module/plugins/hoster/UlozTo.py b/module/plugins/hoster/UlozTo.py index 6b84a5e1b..cadd51149 100644 --- a/module/plugins/hoster/UlozTo.py +++ b/module/plugins/hoster/UlozTo.py @@ -15,7 +15,7 @@ def convertDecimalPrefix(m): class UlozTo(SimpleHoster): __name__ = "UlozTo" __type__ = "hoster" - __version__ = "1.01" + __version__ = "1.02" __pattern__ = r'http://(?:www\.)?(uloz\.to|ulozto\.(cz|sk|net)|bagruj\.cz|zachowajto\.pl)/(?:live/)?(?P<ID>\w+/[^/?]*)' @@ -37,9 +37,6 @@ class UlozTo(SimpleHoster): VIPLINK_PATTERN = r'<a href="[^"]*\?disclaimer=1" class="linkVip">' TOKEN_PATTERN = r'<input type="hidden" name="_token_" .*?value="(.+?)"' - FREE_URL_PATTERN = r'<div class="freeDownloadForm"><form action="([^"]+)"' - PREMIUM_URL_PATTERN = r'<div class="downloadForm"><form action="([^"]+)"' - def setup(self): self.multiDL = self.premium @@ -80,14 +77,14 @@ class UlozTo(SimpleHoster): self.getFileInfo() if self.premium and self.checkTrafficLeft(): - self.handlePremium() + self.handlePremium(pyfile) else: - self.handleFree() + self.handleFree(pyfile) self.doCheckDownload() - def handleFree(self): + def handleFree(self, pyfile): action, inputs = self.parseHtmlForm('id="frm-downloadDialog-freeDownloadForm"') if not action or not inputs: self.error(_("Free download form not found")) @@ -122,29 +119,17 @@ class UlozTo(SimpleHoster): self.download("http://www.ulozto.net" + action, post=inputs, cookies=True, disposition=True) - def handlePremium(self): - self.download(self.pyfile.url + "?do=directDownload", disposition=True) - #parsed_url = self.findDownloadURL(premium=True) - #self.download(parsed_url, post={"download": "Download"}) - - - def findDownloadURL(self, premium=False): - msg = _("%s link" % ("Premium" if premium else "Free")) - m = re.search(self.PREMIUM_URL_PATTERN if premium else self.FREE_URL_PATTERN, self.html) - if m is None: - self.error(msg) - parsed_url = "http://www.ulozto.net" + m.group(1) - self.logDebug("%s: %s" % (msg, parsed_url)) - return parsed_url + def handlePremium(self, pyfile): + self.download(pyfile.url, get={'do': directDownload}, disposition=True) def doCheckDownload(self): check = self.checkDownload({ "wrong_captcha": re.compile(r'<ul class="error">\s*<li>Error rewriting the text.</li>'), - "offline": re.compile(self.OFFLINE_PATTERN), - "passwd": self.PASSWD_PATTERN, - "server_error": 'src="http://img.ulozto.cz/error403/vykricnik.jpg"', # paralell dl, server overload etc. - "not_found": "<title>Ulož.to</title>" + "offline" : re.compile(self.OFFLINE_PATTERN), + "passwd" : self.PASSWD_PATTERN, + "server_error" : 'src="http://img.ulozto.cz/error403/vykricnik.jpg"', # paralell dl, server overload etc. + "not_found" : "<title>Ulož.to</title>" }) if check == "wrong_captcha": @@ -152,15 +137,19 @@ class UlozTo(SimpleHoster): #self.delStorage("captcha_text") self.invalidCaptcha() self.retry(reason=_("Wrong captcha code")) + elif check == "offline": self.offline() + elif check == "passwd": self.fail(_("Wrong password")) + elif check == "server_error": self.logError(_("Server error, try downloading later")) self.multiDL = False self.wait(1 * 60 * 60, True) self.retry() + elif check == "not_found": self.fail(_("Server error - file not downloadable")) diff --git a/module/plugins/hoster/UloziskoSk.py b/module/plugins/hoster/UloziskoSk.py index 0afa4e5a5..0267d4b61 100644 --- a/module/plugins/hoster/UloziskoSk.py +++ b/module/plugins/hoster/UloziskoSk.py @@ -8,7 +8,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class UloziskoSk(SimpleHoster): __name__ = "UloziskoSk" __type__ = "hoster" - __version__ = "0.24" + __version__ = "0.25" __pattern__ = r'http://(?:www\.)?ulozisko\.sk/.+' @@ -21,7 +21,7 @@ class UloziskoSk(SimpleHoster): SIZE_PATTERN = ur'Veľkosť súboru: <strong>(?P<S>[\d.,]+) (?P<U>[\w^_]+)</strong><br />' OFFLINE_PATTERN = ur'<span class = "red">Zadaný súbor neexistuje z jedného z nasledujúcich dôvodov:</span>' - LINK_PATTERN = r'<form name = "formular" action = "([^"]+)" method = "post">' + LINK_FREE_PATTERN = r'<form name = "formular" action = "([^"]+)" method = "post">' ID_PATTERN = r'<input type = "hidden" name = "id" value = "([^"]+)" />' CAPTCHA_PATTERN = r'<img src="(/obrazky/obrazky\.php\?fid=[^"]+)" alt="" />' IMG_PATTERN = ur'<strong>PRE ZVÄČŠENIE KLIKNITE NA OBRÁZOK</strong><br /><a href = "([^"]+)">' @@ -36,13 +36,13 @@ class UloziskoSk(SimpleHoster): url = "http://ulozisko.sk" + m.group(1) self.download(url) else: - self.handleFree() + self.handleFree(pyfile) - def handleFree(self): - m = re.search(self.LINK_PATTERN, self.html) + def handleFree(self, pyfile): + m = re.search(self.LINK_FREE_PATTERN, self.html) if m is None: - self.error(_("LINK_PATTERN not found")) + self.error(_("LINK_FREE_PATTERN not found")) parsed_url = 'http://www.ulozisko.sk' + m.group(1) m = re.search(self.ID_PATTERN, self.html) @@ -61,12 +61,11 @@ class UloziskoSk(SimpleHoster): self.logDebug("CAPTCHA_URL:" + captcha_url + ' CAPTCHA:' + captcha) - self.download(parsed_url, post={ - "antispam": captcha, - "id": id, - "name": self.pyfile.name, - "but": "++++STIAHNI+S%DABOR++++" - }) + self.download(parsed_url, + post={"antispam": captcha, + "id" : id, + "name" : pyfile.name, + "but" : "++++STIAHNI+S%DABOR++++"}) getInfo = create_getInfo(UloziskoSk) diff --git a/module/plugins/hoster/UnibytesCom.py b/module/plugins/hoster/UnibytesCom.py index 8c39cce82..cd4e506c4 100644 --- a/module/plugins/hoster/UnibytesCom.py +++ b/module/plugins/hoster/UnibytesCom.py @@ -12,7 +12,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class UnibytesCom(SimpleHoster): __name__ = "UnibytesCom" __type__ = "hoster" - __version__ = "0.11" + __version__ = "0.12" __pattern__ = r'https?://(?:www\.)?unibytes\.com/[\w .-]{11}B' @@ -26,12 +26,13 @@ class UnibytesCom(SimpleHoster): INFO_PATTERN = r'<span[^>]*?id="fileName"[^>]*>(?P<N>[^>]+)</span>\s*\((?P<S>\d.*?)\)' WAIT_PATTERN = r'Wait for <span id="slowRest">(\d+)</span> sec' - LINK_PATTERN = r'<a href="([^"]+)">Download</a>' + LINK_FREE_PATTERN = r'<a href="([^"]+)">Download</a>' - def handleFree(self): - domain = "http://www.%s/" % self.HOSTER_DOMAIN + def handleFree(self, pyfile): + domain = "http://www.%s/" % self.HOSTER_DOMAIN action, post_data = self.parseHtmlForm('id="startForm"') + self.req.http.c.setopt(FOLLOWLOCATION, 0) for _i in xrange(8): @@ -48,7 +49,7 @@ class UnibytesCom(SimpleHoster): self.retry() if post_data['step'] == 'last': - m = re.search(self.LINK_PATTERN, self.html) + m = re.search(self.LINK_FREE_PATTERN, self.html) if m: url = m.group(1) self.correctCaptcha() @@ -62,12 +63,15 @@ class UnibytesCom(SimpleHoster): if last_step == 'timer': m = re.search(self.WAIT_PATTERN, self.html) self.wait(int(m.group(1)) if m else 60, False) + elif last_step in ("captcha", "last"): post_data['captcha'] = self.decryptCaptcha(urljoin(domain, "/captcha.jpg")) + else: self.fail(_("No valid captcha code entered")) self.req.http.c.setopt(FOLLOWLOCATION, 1) + self.download(url) diff --git a/module/plugins/hoster/UnrestrictLi.py b/module/plugins/hoster/UnrestrictLi.py index c84f1daa7..52f12b5b8 100644 --- a/module/plugins/hoster/UnrestrictLi.py +++ b/module/plugins/hoster/UnrestrictLi.py @@ -12,11 +12,11 @@ from module.plugins.internal.SimpleHoster import secondsToMidnight class UnrestrictLi(MultiHoster): __name__ = "UnrestrictLi" __type__ = "hoster" - __version__ = "0.20" + __version__ = "0.21" __pattern__ = r'https?://(?:www\.)?(unrestrict|unr)\.li/dl/[\w^_]+' - __description__ = """Unrestrict.li hoster plugin""" + __description__ = """Unrestrict.li multi-hoster plugin""" __license__ = "GPLv3" __authors__ = [("stickell", "l.stickell@yahoo.it")] @@ -29,10 +29,10 @@ class UnrestrictLi(MultiHoster): self.resumeDownload = True - def handleFree(self): + def handleFree(self, pyfile): for _i in xrange(5): page = self.load('https://unrestrict.li/unrestrict.php', - post={'link': self.pyfile.url, 'domain': 'long'}) + post={'link': pyfile.url, 'domain': 'long'}) self.logDebug("JSON data: " + page) if page != '': break @@ -63,7 +63,7 @@ class UnrestrictLi(MultiHoster): self.link = page.keys()[0] self.api_data = page[self.link] - if self.link != self.pyfile.url: + if self.link != pyfile.url: self.logDebug("New URL: " + self.link) if hasattr(self, 'api_data'): diff --git a/module/plugins/hoster/UpleaCom.py b/module/plugins/hoster/UpleaCom.py index 7ae46ef38..4ea4e345f 100644 --- a/module/plugins/hoster/UpleaCom.py +++ b/module/plugins/hoster/UpleaCom.py @@ -10,7 +10,7 @@ from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo class UpleaCom(XFSHoster): __name__ = "UpleaCom" __type__ = "hoster" - __version__ = "0.05" + __version__ = "0.06" __pattern__ = r'https?://(?:www\.)?uplea\.com/dl/\w{15}' @@ -38,7 +38,7 @@ class UpleaCom(XFSHoster): self.resumeDownload = True - def handleFree(self): + def handleFree(self, pyfile): m = re.search(self.STEP_PATTERN, self.html) if m is None: self.error("STEP_PATTERN not found") @@ -52,7 +52,7 @@ class UpleaCom(XFSHoster): m = re.search(self.LINK_PATTERN, self.html) if m is None: - self.error("LINK_PATTERN not found") + self.error(_("LINK_PATTERN not found")) self.wait(15) self.download(m.group(1), disposition=True) diff --git a/module/plugins/hoster/UploadableCh.py b/module/plugins/hoster/UploadableCh.py index b09e3ded4..e28944ab9 100644 --- a/module/plugins/hoster/UploadableCh.py +++ b/module/plugins/hoster/UploadableCh.py @@ -11,7 +11,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class UploadableCh(SimpleHoster): __name__ = "UploadableCh" __type__ = "hoster" - __version__ = "0.05" + __version__ = "0.06" __pattern__ = r'http://(?:www\.)?uploadable\.ch/file/(?P<ID>\w+)' @@ -33,15 +33,15 @@ class UploadableCh(SimpleHoster): RECAPTCHA_KEY = "6LdlJuwSAAAAAPJbPIoUhyqOJd7-yrah5Nhim5S3" - def handleFree(self): + def handleFree(self, pyfile): # Click the "free user" button and wait - a = self.load(self.pyfile.url, cookies=True, post={'downloadLink': "wait"}, decode=True) + a = self.load(pyfile.url, cookies=True, post={'downloadLink': "wait"}, decode=True) self.logDebug(a) self.wait(30) # Make the recaptcha appear and show it the pyload interface - b = self.load(self.pyfile.url, cookies=True, post={'checkDownload': "check"}, decode=True) + b = self.load(pyfile.url, cookies=True, post={'checkDownload': "check"}, decode=True) self.logDebug(b) #: Expected output: {"success":"showCaptcha"} recaptcha = ReCaptcha(self) @@ -59,27 +59,21 @@ class UploadableCh(SimpleHoster): self.wait(3) # Get ready for downloading - self.load(self.pyfile.url, cookies=True, post={'downloadLink': "show"}, decode=True) + self.load(pyfile.url, cookies=True, post={'downloadLink': "show"}, decode=True) self.wait(3) # Download the file - self.download(self.pyfile.url, cookies=True, post={'download': "normal"}, disposition=True) + self.download(pyfile.url, cookies=True, post={'download': "normal"}, disposition=True) def checkFile(self): - super(UploadableCh, self).checkFile() - - check = self.checkDownload({'wait_or_reconnect': re.compile("Please wait for"), - 'is_html' : re.compile("<head>")}) - - if check == "wait_or_reconnect": + if self.checkDownload({'wait': re.compile("Please wait for")}): self.logInfo("Downloadlimit reached, please wait or reconnect") self.wait(60 * 60, True) self.retry() - elif check == "is_html": - self.error("Downloaded file is an html file") + return super(UploadableCh, self).checkFile() getInfo = create_getInfo(UploadableCh) diff --git a/module/plugins/hoster/UploadheroCom.py b/module/plugins/hoster/UploadheroCom.py index 189079017..ac0b4b562 100644 --- a/module/plugins/hoster/UploadheroCom.py +++ b/module/plugins/hoster/UploadheroCom.py @@ -11,7 +11,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class UploadheroCom(SimpleHoster): __name__ = "UploadheroCom" __type__ = "hoster" - __version__ = "0.16" + __version__ = "0.17" __pattern__ = r'http://(?:www\.)?uploadhero\.com?/dl/\w+' @@ -31,11 +31,12 @@ class UploadheroCom(SimpleHoster): IP_WAIT_PATTERN = r'<span id="minutes">(\d+)</span>.*\s*<span id="seconds">(\d+)</span>' CAPTCHA_PATTERN = r'"(/captchadl\.php\?\w+)"' - FREE_URL_PATTERN = r'var magicomfg = \'<a href="(http://[^<>"]*?)"|"(http://storage\d+\.uploadhero\.co/\?d=\w+/[^<>"/]+)"' - PREMIUM_URL_PATTERN = r'<a href="([^"]+)" id="downloadnow"' + LINK_FREE_PATTERN = r'var magicomfg = \'<a href="(http://[^<>"]*?)"|"(http://storage\d+\.uploadhero\.co/\?d=\w+/[^<>"/]+)"' + LINK_PREMIUM_PATTERN = r'<a href="([^"]+)" id="downloadnow"' - def handleFree(self): + + def handleFree(self, pyfile): self.checkErrors() m = re.search(self.CAPTCHA_PATTERN, self.html) @@ -45,8 +46,8 @@ class UploadheroCom(SimpleHoster): for _i in xrange(5): captcha = self.decryptCaptcha(captcha_url) - self.html = self.load(self.pyfile.url, get={"code": captcha}) - m = re.search(self.FREE_URL_PATTERN, self.html) + self.html = self.load(pyfile.url, get={"code": captcha}) + m = re.search(self.LINK_FREE_PATTERN, self.html) if m: self.correctCaptcha() download_url = m.group(1) or m.group(2) @@ -59,12 +60,6 @@ class UploadheroCom(SimpleHoster): self.download(download_url) - def handlePremium(self): - self.logDebug("%s: Use Premium Account" % self.__name__) - link = re.search(self.PREMIUM_URL_PATTERN, self.html).group(1) - self.download(link) - - def checkErrors(self): m = re.search(self.IP_BLOCKED_PATTERN, self.html) if m: diff --git a/module/plugins/hoster/UploadingCom.py b/module/plugins/hoster/UploadingCom.py index b163f2252..164b7b243 100644 --- a/module/plugins/hoster/UploadingCom.py +++ b/module/plugins/hoster/UploadingCom.py @@ -11,7 +11,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, t class UploadingCom(SimpleHoster): __name__ = "UploadingCom" __type__ = "hoster" - __version__ = "0.39" + __version__ = "0.40" __pattern__ = r'http://(?:www\.)?uploading\.com/files/(?:get/)?(?P<ID>\w+)' @@ -40,15 +40,15 @@ class UploadingCom(SimpleHoster): self.getFileInfo() if self.premium: - self.handlePremium() + self.handlePremium(pyfile) else: - self.handleFree() + self.handleFree(pyfile) - def handlePremium(self): + def handlePremium(self, pyfile): postData = {'action': 'get_link', - 'code': self.info['pattern']['ID'], - 'pass': 'undefined'} + 'code' : self.info['pattern']['ID'], + 'pass' : 'undefined'} self.html = self.load('http://uploading.com/files/get/?JsHttpRequest=%d-xml' % timestamp(), post=postData) url = re.search(r'"link"\s*:\s*"(.*?)"', self.html) @@ -59,16 +59,16 @@ class UploadingCom(SimpleHoster): raise Exception("Plugin defect") - def handleFree(self): + def handleFree(self, pyfile): m = re.search('<h2>((Daily )?Download Limit)</h2>', self.html) if m: - self.pyfile.error = m.group(1) - self.logWarning(self.pyfile.error) - self.retry(6, (6 * 60 if m.group(2) else 15) * 60, self.pyfile.error) + pyfile.error = m.group(1) + self.logWarning(pyfile.error) + self.retry(6, (6 * 60 if m.group(2) else 15) * 60, pyfile.error) ajax_url = "http://uploading.com/files/get/?ajax" self.req.http.c.setopt(HTTPHEADER, ["X-Requested-With: XMLHttpRequest"]) - self.req.http.lastURL = self.pyfile.url + self.req.http.lastURL = pyfile.url res = json_loads(self.load(ajax_url, post={'action': 'second_page', 'code': self.info['pattern']['ID']})) @@ -95,10 +95,5 @@ class UploadingCom(SimpleHoster): self.download(url) - check = self.checkDownload({"html": re.compile("\A<!DOCTYPE html PUBLIC")}) - if check == "html": - self.logWarning(_("Redirected to a HTML page, wait 10 minutes and retry")) - self.wait(10 * 60, True) - getInfo = create_getInfo(UploadingCom) diff --git a/module/plugins/hoster/UpstoreNet.py b/module/plugins/hoster/UpstoreNet.py index 25c424f1f..f287a2b51 100644 --- a/module/plugins/hoster/UpstoreNet.py +++ b/module/plugins/hoster/UpstoreNet.py @@ -9,7 +9,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class UpstoreNet(SimpleHoster): __name__ = "UpstoreNet" __type__ = "hoster" - __version__ = "0.03" + __version__ = "0.04" __pattern__ = r'https?://(?:www\.)?upstore\.net/' @@ -23,10 +23,10 @@ class UpstoreNet(SimpleHoster): WAIT_PATTERN = r'var sec = (\d+)' CHASH_PATTERN = r'<input type="hidden" name="hash" value="([^"]*)">' - LINK_PATTERN = r'<a href="(https?://.*?)" target="_blank"><b>' + LINK_FREE_PATTERN = r'<a href="(https?://.*?)" target="_blank"><b>' - def handleFree(self): + def handleFree(self, pyfile): # STAGE 1: get link to continue m = re.search(self.CHASH_PATTERN, self.html) if m is None: @@ -35,7 +35,7 @@ class UpstoreNet(SimpleHoster): self.logDebug("Read hash " + chash) # continue to stage2 post_data = {'hash': chash, 'free': 'Slow download'} - self.html = self.load(self.pyfile.url, post=post_data, decode=True) + self.html = self.load(pyfile.url, post=post_data, decode=True) # STAGE 2: solv captcha and wait # first get the infos we need: recaptcha key and wait time @@ -56,10 +56,10 @@ class UpstoreNet(SimpleHoster): post_data.update({'recaptcha_challenge_field': challenge, 'recaptcha_response_field' : response}) - self.html = self.load(self.pyfile.url, post=post_data, decode=True) + self.html = self.load(pyfile.url, post=post_data, decode=True) # STAGE 3: get direct link - m = re.search(self.LINK_PATTERN, self.html, re.S) + m = re.search(self.LINK_FREE_PATTERN, self.html, re.S) if m: break diff --git a/module/plugins/hoster/VeohCom.py b/module/plugins/hoster/VeohCom.py index 6dbac397b..219efa8e1 100644 --- a/module/plugins/hoster/VeohCom.py +++ b/module/plugins/hoster/VeohCom.py @@ -8,7 +8,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class VeohCom(SimpleHoster): __name__ = "VeohCom" __type__ = "hoster" - __version__ = "0.21" + __version__ = "0.22" __pattern__ = r'http://(?:www\.)?veoh\.com/(tv/)?(watch|videos)/(?P<ID>v\w+)' __config__ = [("quality", "Low;High;Auto", "Quality", "Auto")] @@ -32,15 +32,16 @@ class VeohCom(SimpleHoster): self.chunkLimit = -1 - def handleFree(self): + def handleFree(self, pyfile): quality = self.getConfig("quality") if quality == "Auto": quality = ("High", "Low") + for q in quality: pattern = r'"fullPreviewHash%sPath":"(.+?)"' % q m = re.search(pattern, self.html) if m: - self.pyfile.name += ".mp4" + pyfile.name += ".mp4" link = m.group(1).replace("\\", "") self.download(link) return diff --git a/module/plugins/hoster/VimeoCom.py b/module/plugins/hoster/VimeoCom.py index 0e42c1674..f7485f025 100644 --- a/module/plugins/hoster/VimeoCom.py +++ b/module/plugins/hoster/VimeoCom.py @@ -8,7 +8,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class VimeoCom(SimpleHoster): __name__ = "VimeoCom" __type__ = "hoster" - __version__ = "0.03" + __version__ = "0.04" __pattern__ = r'https?://(?:www\.)?(player\.)?vimeo\.com/(video/)?(?P<ID>\d+)' __config__ = [("quality", "Lowest;Mobile;SD;HD;Highest", "Quality", "Highest"), @@ -34,15 +34,14 @@ class VimeoCom(SimpleHoster): self.chunkLimit = -1 - def handleFree(self): + def handleFree(self, pyfile): password = self.getPassword() if self.js and 'class="btn iconify_down_b"' in self.html: - html = self.js.eval(self.load(self.pyfile.url, get={'action': "download", 'password': password}, decode=True)) + html = self.js.eval(self.load(pyfile.url, get={'action': "download", 'password': password}, decode=True)) pattern = r'href="(?P<URL>http://vimeo\.com.+?)".*?\>(?P<QL>.+?) ' else: - id = re.match(self.__pattern__, self.pyfile.url).group('ID') - html = self.load("https://player.vimeo.com/video/" + id, get={'password': password}) + html = self.load("https://player.vimeo.com/video/" + self.info['pattern']['ID'], get={'password': password}) pattern = r'"(?P<QL>\w+)":{"profile".*?"(?P<URL>http://pdl\.vimeocdn\.com.+?)"' link = dict([(l.group('QL').lower(), l.group('URL')) for l in re.finditer(pattern, html)]) diff --git a/module/plugins/hoster/Vipleech4uCom.py b/module/plugins/hoster/Vipleech4uCom.py index 340a3feaa..2ae41b942 100644 --- a/module/plugins/hoster/Vipleech4uCom.py +++ b/module/plugins/hoster/Vipleech4uCom.py @@ -3,8 +3,8 @@ from module.plugins.internal.DeadHoster import DeadHoster, create_getInfo -class Vipleech4uCom(DeadHoster): - __name__ = "Vipleech4uCom" +class Vipleech4UCom(DeadHoster): + __name__ = "Vipleech4UCom" __type__ = "hoster" __version__ = "0.20" @@ -15,4 +15,4 @@ class Vipleech4uCom(DeadHoster): __authors__ = [("Kagenoshin", "kagenoshin@gmx.ch")] -getInfo = create_getInfo(Vipleech4uCom) +getInfo = create_getInfo(Vipleech4UCom) diff --git a/module/plugins/hoster/WebshareCz.py b/module/plugins/hoster/WebshareCz.py index a08341ff3..e3424fc21 100644 --- a/module/plugins/hoster/WebshareCz.py +++ b/module/plugins/hoster/WebshareCz.py @@ -9,7 +9,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class WebshareCz(SimpleHoster): __name__ = "WebshareCz" __type__ = "hoster" - __version__ = "0.14" + __version__ = "0.15" __pattern__ = r'https?://(?:www\.)?webshare\.cz/(?:#/)?file/(?P<ID>\w+)' @@ -40,12 +40,11 @@ class WebshareCz(SimpleHoster): return info - def handleFree(self): - fid = re.match(self.__pattern__, self.pyfile.url).group('ID') + def handleFree(self, pyfile): wst = self.account.infos['wst'] if self.account and 'wst' in self.account.infos else "" api_data = getURL('https://webshare.cz/api/file_link/', - post={'ident': fid, 'wst': wst}, + post={'ident': self.info['pattern']['ID'], 'wst': wst}, decode=True) self.logDebug("API data: " + api_data) @@ -57,8 +56,8 @@ class WebshareCz(SimpleHoster): self.link = m.group(1) - def handlePremium(self): - return self.handleFree() + def handlePremium(self, pyfile): + return self.handleFree(pyfile) getInfo = create_getInfo(WebshareCz) diff --git a/module/plugins/hoster/WrzucTo.py b/module/plugins/hoster/WrzucTo.py index 8e9653307..457e72865 100644 --- a/module/plugins/hoster/WrzucTo.py +++ b/module/plugins/hoster/WrzucTo.py @@ -10,7 +10,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class WrzucTo(SimpleHoster): __name__ = "WrzucTo" __type__ = "hoster" - __version__ = "0.02" + __version__ = "0.03" __pattern__ = r'http://(?:www\.)?wrzuc\.to/(\w+(\.wt|\.html)|(\w+/?linki/\w+))' @@ -29,16 +29,16 @@ class WrzucTo(SimpleHoster): self.multiDL = True - def handleFree(self): + def handleFree(self, pyfile): data = dict(re.findall(r'(md5|file): "(.*?)"', self.html)) if len(data) != 2: self.error(_("No file ID")) self.req.http.c.setopt(HTTPHEADER, ["X-Requested-With: XMLHttpRequest"]) - self.req.http.lastURL = self.pyfile.url + self.req.http.lastURL = pyfile.url self.load("http://www.wrzuc.to/ajax/server/prepair", post={"md5": data['md5']}) - self.req.http.lastURL = self.pyfile.url + self.req.http.lastURL = pyfile.url self.html = self.load("http://www.wrzuc.to/ajax/server/download_link", post={"file": data['file']}) data.update(re.findall(r'"(download_link|server_id)":"(.*?)"', self.html)) diff --git a/module/plugins/hoster/XFileSharingPro.py b/module/plugins/hoster/XFileSharingPro.py index 0acad3dba..1794ae513 100644 --- a/module/plugins/hoster/XFileSharingPro.py +++ b/module/plugins/hoster/XFileSharingPro.py @@ -8,7 +8,7 @@ from module.plugins.internal.XFSHoster import XFSHoster, create_getInfo class XFileSharingPro(XFSHoster): __name__ = "XFileSharingPro" __type__ = "hoster" - __version__ = "0.43" + __version__ = "0.44" __pattern__ = r'^unmatchable$' @@ -31,27 +31,32 @@ class XFileSharingPro(XFSHoster): self.__pattern__ = self.core.pluginManager.hosterPlugins[self.__name__]['pattern'] - self.HOSTER_DOMAIN = re.match(self.__pattern__, self.pyfile.url).group(1).lower() - self.HOSTER_NAME = "".join([str.capitalize() for str in self.HOSTER_DOMAIN.split('.')]) + self.HOSTER_DOMAIN = re.match(self.__pattern__, self.pyfile.url).group("DOMAIN").lower() + self.HOSTER_NAME = "".join([part.capitalize() for part in re.split(r'(\.|\d+)', self.HOSTER_DOMAIN) if part != '.']) + + if self.HOSTER_NAME[0].isdigit(): + self.HOSTER_NAME = 'X' + self.HOSTER_NAME account = self.core.accountManager.getAccountPlugin(self.HOSTER_NAME) if account and account.canUse(): self.account = account + elif self.account: self.account.HOSTER_DOMAIN = self.HOSTER_DOMAIN + else: return self.user, data = self.account.selectAccount() - self.req = self.account.getAccountRequest(self.user) - self.premium = self.account.isPremium(self.user) + self.req = self.account.getAccountRequest(self.user) + self.premium = self.account.isPremium(self.user) def setup(self): - self.chunkLimit = 1 + self.chunkLimit = 1 self.resumeDownload = self.premium - self.multiDL = True + self.multiDL = True getInfo = create_getInfo(XFileSharingPro) diff --git a/module/plugins/hoster/Xdcc.py b/module/plugins/hoster/Xdcc.py index ef6da4a71..bfa62b8db 100644 --- a/module/plugins/hoster/Xdcc.py +++ b/module/plugins/hoster/Xdcc.py @@ -4,11 +4,11 @@ import re import socket import struct import sys -import time from os import makedirs from os.path import exists, join from select import select +from time import time from module.plugins.Hoster import Hoster from module.utils import save_join @@ -84,15 +84,18 @@ class Xdcc(Hoster): ####################### # CONNECT TO IRC AND IDLE FOR REAL LINK - dl_time = time.time() + dl_time = time() sock = socket.socket() sock.connect((host, int(port))) if nick == "pyload": - nick = "pyload-%d" % (time.time() % 1000) # last 3 digits + nick = "pyload-%d" % (time() % 1000) # last 3 digits sock.send("NICK %s\r\n" % nick) sock.send("USER %s %s bla :%s\r\n" % (ident, host, real)) - time.sleep(3) + + self.setWait(3) + self.wait() + sock.send("JOIN #%s\r\n" % chan) sock.send("PRIVMSG %s :xdcc send #%s\r\n" % (bot, pack)) @@ -108,13 +111,13 @@ class Xdcc(Hoster): break if retry: - if time.time() > retry: + if time() > retry: retry = None - dl_time = time.time() + dl_time = time() sock.send("PRIVMSG %s :xdcc send #%s\r\n" % (bot, pack)) else: - if (dl_time + self.timeout) < time.time(): # todo: add in config + if (dl_time + self.timeout) < time(): # todo: add in config sock.send("QUIT :byebye\r\n") sock.close() self.fail(_("XDCC Bot did not answer")) @@ -156,7 +159,7 @@ class Xdcc(Hoster): sock.send("NOTICE %s :%s\r\n" % (msg['origin'], "pyLoad! IRC Interface")) elif msg['text'] == "\x01TIME\x01": self.logDebug("Sending CTCP TIME") - sock.send("NOTICE %s :%d\r\n" % (msg['origin'], time.time())) + sock.send("NOTICE %s :%d\r\n" % (msg['origin'], time())) elif msg['text'] == "\x01LAG\x01": pass # don't know how to answer @@ -169,7 +172,7 @@ class Xdcc(Hoster): print "%s: %s" % (msg['origin'], msg['text']) if "You already requested that pack" in msg['text']: - retry = time.time() + 300 + retry = time() + 300 if "you must be on a known channel to request a pack" in msg['text']: self.fail(_("Wrong channel")) diff --git a/module/plugins/hoster/YibaishiwuCom.py b/module/plugins/hoster/YibaishiwuCom.py index 3b4692933..adc403de4 100644 --- a/module/plugins/hoster/YibaishiwuCom.py +++ b/module/plugins/hoster/YibaishiwuCom.py @@ -9,7 +9,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class YibaishiwuCom(SimpleHoster): __name__ = "YibaishiwuCom" __type__ = "hoster" - __version__ = "0.13" + __version__ = "0.14" __pattern__ = r'http://(?:www\.)?(?:u\.)?115\.com/file/(?P<ID>\w+)' @@ -22,21 +22,25 @@ class YibaishiwuCom(SimpleHoster): SIZE_PATTERN = r'file_size: \'(?P<S>.+?)\'' OFFLINE_PATTERN = ur'<h3><i style="color:red;">哎呀!提取码不存在!不妨搜搜看吧!</i></h3>' - LINK_PATTERN = r'(/\?ct=(pickcode|download)[^"\']+)' + LINK_FREE_PATTERN = r'(/\?ct=(pickcode|download)[^"\']+)' - def handleFree(self): - m = re.search(self.LINK_PATTERN, self.html) + def handleFree(self, pyfile): + m = re.search(self.LINK_FREE_PATTERN, self.html) if m is None: - self.error(_("LINK_PATTERN not found")) + self.error(_("LINK_FREE_PATTERN not found")) + url = m.group(1) + self.logDebug(('FREEUSER' if m.group(2) == 'download' else 'GUEST') + ' URL', url) res = json_loads(self.load("http://115.com" + url, decode=False)) if "urls" in res: mirrors = res['urls'] + elif "data" in res: mirrors = res['data'] + else: mirrors = None diff --git a/module/plugins/hoster/YourfilesTo.py b/module/plugins/hoster/YourfilesTo.py index 83ab89110..e0def108e 100644 --- a/module/plugins/hoster/YourfilesTo.py +++ b/module/plugins/hoster/YourfilesTo.py @@ -10,9 +10,9 @@ from module.plugins.Hoster import Hoster class YourfilesTo(Hoster): __name__ = "YourfilesTo" __type__ = "hoster" - __version__ = "0.21" + __version__ = "0.22" - __pattern__ = r'(http://)?(?:www\.)?yourfiles\.(to|biz)/\?d=\w+' + __pattern__ = r'http://(?:www\.)?yourfiles\.(to|biz)/\?d=\w+' __description__ = """Youfiles.to hoster plugin""" __license__ = "GPLv3" diff --git a/module/plugins/hoster/ZeveraCom.py b/module/plugins/hoster/ZeveraCom.py index 60fc2a12b..fb251142e 100644 --- a/module/plugins/hoster/ZeveraCom.py +++ b/module/plugins/hoster/ZeveraCom.py @@ -1,36 +1,34 @@ # -*- coding: utf-8 -*- +import re + +from urlparse import urljoin + from module.plugins.internal.MultiHoster import MultiHoster, create_getInfo class ZeveraCom(MultiHoster): __name__ = "ZeveraCom" __type__ = "hoster" - __version__ = "0.25" + __version__ = "0.27" - __pattern__ = r'http://(?:www\.)?zevera\.com/.+' + __pattern__ = r'https?://(?:www\.)zevera\.com/(getFiles\.ashx|Members/download\.ashx)\?.*ourl=.+' - __description__ = """Zevera.com hoster plugin""" + __description__ = """Zevera.com multi-hoster plugin""" __license__ = "GPLv3" - __authors__ = [("zoidberg", "zoidberg@mujmail.cz")] - - - def handlePremium(self): - if self.account.getAPIData(self.req, cmd="checklink", olink=self.pyfile.url) != "Alive": - self.fail(_("Offline or not downloadable")) + __authors__ = [("zoidberg", "zoidberg@mujmail.cz"), + ("Walter Purcaro", "vuolter@gmail.com")] - header = self.account.getAPIData(self.req, just_header=True, cmd="generatedownloaddirect", olink=self.pyfile.url) - if not "location" in header: - self.fail(_("Unable to initialize download")) - self.link = header['location'] + def handlePremium(self, pyfile): + return "https://%s/getFiles.ashx?ourl=%s" % (self.account.HOSTER_DOMAIN, pyfile.url) def checkFile(self): - super(ZeveraCom, self).checkFile() + if self.checkDownload({"error": 'action="ErrorDownload.aspx'}): + self.fail(_("Error response received")) - if self.checkDownload({"error": 'action="ErrorDownload.aspx'}) is "error": - self.fail(_("Error response received - contact Zevera support")) + return super(ZeveraCom, self).checkFile() getInfo = create_getInfo(ZeveraCom) diff --git a/module/plugins/hoster/ZippyshareCom.py b/module/plugins/hoster/ZippyshareCom.py index 73dd1f22d..2648f532f 100644 --- a/module/plugins/hoster/ZippyshareCom.py +++ b/module/plugins/hoster/ZippyshareCom.py @@ -10,7 +10,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo class ZippyshareCom(SimpleHoster): __name__ = "ZippyshareCom" __type__ = "hoster" - __version__ = "0.65" + __version__ = "0.66" __pattern__ = r'(?P<HOST>http://www\d{0,2}\.zippyshare\.com)/v(?:/|iew\.jsp.*key=)(?P<KEY>\d+)' @@ -33,9 +33,11 @@ class ZippyshareCom(SimpleHoster): self.resumeDownload = True - def handleFree(self): - url = self.get_link() - self.download(url) + def handleFree(self, pyfile): + checksum = self.get_checksum() + p_url = '/'.join(("d", self.info['pattern']['KEY'], str(checksum), self.pyfile.name)) + + self.link = urljoin(self.info['pattern']['HOST'], p_url) def get_checksum(self): @@ -56,11 +58,4 @@ class ZippyshareCom(SimpleHoster): return b - def get_link(self): - checksum = self.get_checksum() - p_url = '/'.join(("d", self.info['pattern']['KEY'], str(checksum), self.pyfile.name)) - dl_link = urljoin(self.info['pattern']['HOST'], p_url) - return dl_link - - getInfo = create_getInfo(ZippyshareCom) diff --git a/module/plugins/internal/CaptchaService.py b/module/plugins/internal/CaptchaService.py index 965799e8e..b429fd6e0 100644 --- a/module/plugins/internal/CaptchaService.py +++ b/module/plugins/internal/CaptchaService.py @@ -2,6 +2,7 @@ import re +from base64 import urlsafe_b64encode from random import random from module.common.json_layer import json_loads @@ -54,14 +55,14 @@ class CaptchaService: class ReCaptcha(CaptchaService): __name__ = "ReCaptcha" - __version__ = "0.08" + __version__ = "0.09" __description__ = """ReCaptcha captcha service plugin""" __license__ = "GPLv3" __authors__ = [("pyLoad Team", "admin@pyload.org")] - KEY_PATTERN = r'recaptcha(?:/api|\.net)/(?:challenge|noscript)\?k=([\w-]+)' + KEY_PATTERN = r'(?:class="g-recaptcha"\s+data-sitekey="|recaptcha(?:/api|\.net)/(?:challenge|noscript)\?k=)([\w-]+)' KEY_AJAX_PATTERN = r'Recaptcha\.create\s*\(\s*["\']([\w-]+)' @@ -84,7 +85,7 @@ class ReCaptcha(CaptchaService): return None - def challenge(self, key=None): + def challenge(self, key=None, userverify=False): if not key: if self.detect_key(): key = self.key @@ -97,14 +98,30 @@ class ReCaptcha(CaptchaService): try: challenge = re.search("challenge : '(.+?)',", html).group(1) server = re.search("server : '(.+?)',", html).group(1) - except: + + except AttributeError: errmsg = _("ReCaptcha challenge pattern not found") self.plugin.fail(errmsg) - raise ValueError(errmsg) + raise AttributeError(errmsg) self.plugin.logDebug("ReCaptcha challenge: %s" % challenge) - return challenge, self.result(server, challenge) + response = challenge, self.result(server, challenge) + + return self.userverify(*response) if userverify else response + + + def userverify(self, challenge, result): + response = self.plugin.req.load("https://www.google.com/recaptcha/api2/userverify", + post={'c' : challenge, + 'response': urlsafe_b64encode('{"response":"%s"}' % result)}) + try: + return re.search(r'"uvresp","(.+?)"', response).group(1) + + except AttributeError: + errmsg = _("ReCaptcha userverify response not found") + self.plugin.fail(errmsg) + raise AttributeError(errmsg) def result(self, server, challenge): @@ -167,10 +184,11 @@ class AdsCaptcha(CaptchaService): try: challenge = re.search("challenge: '(.+?)',", html).group(1) server = re.search("server: '(.+?)',", html).group(1) - except: + + except AttributeError: errmsg = _("AdsCaptcha challenge pattern not found") self.plugin.fail(errmsg) - raise ValueError(errmsg) + raise AttributeError(errmsg) self.plugin.logDebug("AdsCaptcha challenge: %s" % challenge) @@ -214,10 +232,11 @@ class SolveMedia(CaptchaService): challenge = re.search(r'<input type=hidden name="adcopy_challenge" id="adcopy_challenge" value="([^"]+)">', html).group(1) server = "http://api.solvemedia.com/papi/media" - except: + + except AttributeError: errmsg = _("SolveMedia challenge pattern not found") self.plugin.fail(errmsg) - raise ValueError(errmsg) + raise AttributeError(errmsg) self.plugin.logDebug("SolveMedia challenge: %s" % challenge) @@ -286,10 +305,11 @@ class AdYouLike(CaptchaService): 'callback': callback}) try: challenge = json_loads(re.search(callback + r'\s*\((.+?)\)', html).group(1)) - except: + + except AttributeError: errmsg = _("AdYouLike challenge pattern not found") self.plugin.fail(errmsg) - raise ValueError(errmsg) + raise AttributeError(errmsg) self.plugin.logDebug("AdYouLike challenge: %s" % challenge) @@ -316,10 +336,11 @@ class AdYouLike(CaptchaService): try: instructions_visual = challenge['translations'][server['all']['lang']]['instructions_visual'] result = re.search(u'«(.+?)»', instructions_visual).group(1).strip() - except: + + except AttributeError: errmsg = _("AdYouLike result not found") self.plugin.fail(errmsg) - raise ValueError(errmsg) + raise AttributeError(errmsg) result = {'_ayl_captcha_engine' : "adyoulike", '_ayl_env' : server['all']['env'], diff --git a/module/plugins/internal/DeadCrypter.py b/module/plugins/internal/DeadCrypter.py index 07c5c3881..0fa23eef3 100644 --- a/module/plugins/internal/DeadCrypter.py +++ b/module/plugins/internal/DeadCrypter.py @@ -20,8 +20,10 @@ class DeadCrypter(_Crypter): @classmethod - def getInfo(cls, url="", html=""): - return {'name': urlparse(unquote(url)).path.split('/')[-1] or _("Unknown"), 'size': 0, 'status': 1, 'url': url} + def apiInfo(cls, url="", get={}, post={}): + api = super(DeadCrypter, self).apiInfo(url, get, post) + api['status'] = 1 + return api def setup(self): diff --git a/module/plugins/internal/DeadHoster.py b/module/plugins/internal/DeadHoster.py index 6f3252f70..cc7adf4df 100644 --- a/module/plugins/internal/DeadHoster.py +++ b/module/plugins/internal/DeadHoster.py @@ -20,8 +20,10 @@ class DeadHoster(_Hoster): @classmethod - def getInfo(cls, url="", html=""): - return {'name': urlparse(unquote(url)).path.split('/')[-1] or _("Unknown"), 'size': 0, 'status': 1, 'url': url} + def apiInfo(cls, url="", get={}, post={}): + api = super(DeadHoster, self).apiInfo(url, get, post) + api['status'] = 1 + return api def setup(self): diff --git a/module/plugins/internal/MultiHook.py b/module/plugins/internal/MultiHook.py index ea9f32673..a3b266679 100644 --- a/module/plugins/internal/MultiHook.py +++ b/module/plugins/internal/MultiHook.py @@ -2,19 +2,24 @@ import re +from time import sleep + from module.plugins.Hook import Hook -from module.utils import remove_chars +from module.utils import decode, remove_chars class MultiHook(Hook): __name__ = "MultiHook" __type__ = "hook" - __version__ = "0.29" + __version__ = "0.35" - __config__ = [("mode" , "all;listed;unlisted", "Use for plugins (if supported)" , "all"), - ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), - ("revertfailed", "bool" , "Revert to standard download if download fails", False), - ("interval" , "int" , "Reload interval in hours (0 to disable)" , 12 )] + __config__ = [("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"), + ("pluginlist" , "str" , "Plugin list (comma separated)" , "" ), + ("revertfailed" , "bool" , "Revert to standard download if fails", True ), + ("retry" , "int" , "Number of retries before revert" , 10 ), + ("retryinterval" , "int" , "Retry interval in minutes" , 1 ), + ("reload" , "bool" , "Reload plugin list" , True ), + ("reloadinterval", "int" , "Reload interval in hours" , 12 )] __description__ = """Hook plugin for multi hoster/crypter""" __license__ = "GPLv3" @@ -22,49 +27,78 @@ class MultiHook(Hook): ("Walter Purcaro", "vuolter@gmail.com")] - MIN_INTERVAL = 12 * 60 * 60 #: reload plugins every 12h - - PLUGIN_REPLACEMENTS = [("1fichier.com" , "onefichier.com"), - ("2shared.com" , "twoshared.com" ), - ("4shared.com" , "fourshared.com"), - ("cloudnator.com" , "shragle.com" ), - ("easy-share.com" , "crocko.com" ), - ("fileparadox.com", "fileparadox.in"), - ("freakshare.net" , "freakshare.com"), - ("hellshare.com" , "hellshare.cz" ), - ("ifile.it" , "filecloud.io" ), - ("nowdownload.ch" , "nowdownload.sx"), - ("nowvideo.co" , "nowvideo.sx" ), - ("putlocker.com" , "firedrive.com" ), - ("share-rapid.cz" , "multishare.cz" ), - ("sharerapid.cz" , "multishare.cz" ), - ("ul.to" , "uploaded.to" ), - ("uploaded.net" , "uploaded.to" )] + MIN_INTERVAL = 1 * 60 * 60 + + DOMAIN_REPLACEMENTS = [(r'180upload\.com' , "hundredeightyupload.com"), + (r'1fichier\.com' , "onefichier.com" ), + (r'2shared\.com' , "twoshared.com" ), + (r'4shared\.com' , "fourshared.com" ), + (r'bayfiles\.net' , "bayfiles.com" ), + (r'cloudnator\.com' , "shragle.com" ), + (r'dfiles\.eu' , "depositfiles.com" ), + (r'easy-share\.com' , "crocko.com" ), + (r'freakshare\.net' , "freakshare.com" ), + (r'hellshare\.com' , "hellshare.cz" ), + (r'ifile\.it' , "filecloud.io" ), + (r'nowdownload\.\w+', "nowdownload.sx" ), + (r'nowvideo\.\w+' , "nowvideo.sx" ), + (r'putlocker\.com' , "firedrive.com" ), + (r'share-?rapid\.cz', "multishare.cz" ), + (r'ul\.to' , "uploaded.to" ), + (r'uploaded\.net' , "uploaded.to" ), + (r'uploadhero\.co' , "uploadhero.com" ), + (r'zshares\.net' , "zshare.net" ), + (r'\d+.+' , "X\0" )] def setup(self): - self.account = None - self.type = self.core.pluginManager.findPlugin(self.__name__)[1] or "hoster" self.plugins = [] self.supported = [] self.new_supported = [] + self.account = None + self.pluginclass = None + self.pluginmodule = None + self.pluginname = None + self.plugintype = None + + self._initPlugin() - def coreReady(self): - self.account = self.core.accountManager.getAccountPlugin(self.__name__) + + def _initPlugin(self): + plugin, type = self.core.pluginManager.findPlugin(self.__name__) + + if not plugin: + self.logWarning("Hook plugin will be deactivated due missing plugin reference") + self.setConfig('activated', False) + else: + self.pluginname = self.__name__ + self.plugintype = type + self.pluginmodule = self.core.pluginManager.loadModule(type, self.__name__) + self.pluginclass = getattr(self.pluginmodule, self.__name__) + + + def _loadAccount(self): + self.account = self.core.accountManager.getAccountPlugin(self.pluginname) if self.account and not self.account.canUse(): self.account = None - if not self.account: - self.logWarning("MultiHook will be deactivated due missing account reference") + if not self.account and hasattr(self.pluginclass, "LOGIN_ACCOUNT") and self.pluginclass.LOGIN_ACCOUNT: + self.logWarning("Hook plugin will be deactivated due missing account reference") self.setConfig('activated', False) + def coreReady(self): + self._loadAccount() + + def getURL(self, *args, **kwargs): #@TODO: Remove in 0.4.10 """ see HTTPRequest for argument list """ h = pyreq.getHTTPRequest(timeout=120) try: + if not 'decode' in kwargs: + kwargs['decode'] = True rep = h.load(*args, **kwargs) finally: h.close() @@ -81,40 +115,50 @@ class MultiHook(Hook): return default - def pluginCached(self): - if not self.plugins: + def pluginsCached(self): + if self.plugins: + return self.plugins + + for _i in xrange(3): try: - pluginset = self.pluginSet(self.getHosters() if self.type == "hoster" else self.getCrypters()) + pluginset = self._pluginSet(self.getHosters() if self.plugintype == "hoster" else self.getCrypters()) + except Exception, e: - self.logError(e) - return [] + self.logError(e, "Waiting 1 minute and retry") + sleep(60) + + else: + break + else: + return list() - try: - configmode = self.getConfig("mode", 'all') - if configmode in ("listed", "unlisted"): - pluginlist = self.getConfig("pluginlist", '').replace('|', ',').replace(';', ',').split(',') - configset = self.pluginSet(pluginlist) + try: + configmode = self.getConfig("pluginmode", 'all') + if configmode in ("listed", "unlisted"): + pluginlist = self.getConfig("pluginlist", '').replace('|', ',').replace(';', ',').split(',') + configset = self._pluginSet(pluginlist) - if configmode == "listed": - pluginset &= configset - else: - pluginset -= configset + if configmode == "listed": + pluginset &= configset + else: + pluginset -= configset - except Exception, e: - self.logError(e) + except Exception, e: + self.logError(e) - self.plugins = list(pluginset) + self.plugins = list(pluginset) return self.plugins - def pluginSet(self, plugins): - plugins = set((str(x).strip().lower() for x in plugins)) + def _pluginSet(self, plugins): + plugins = set((decode(x).strip().lower() for x in plugins if '.' in x)) - for rep in self.PLUGIN_REPLACEMENTS: - if rep[0] in plugins: - plugins.remove(rep[0]) - plugins.add(rep[1]) + for rf, rt in self.DOMAIN_REPLACEMENTS: + regex = re.compile(rf) + for p in filter(lambda x: regex.match(x), plugins): + plugins.remove(p) + plugins.add(re.sub(rf, rt, p)) plugins.discard('') @@ -139,9 +183,7 @@ class MultiHook(Hook): def periodical(self): """reload plugin list periodically""" - self.interval = max(self.getConfig("interval", 0), self.MIN_INTERVAL) - - self.logInfo(_("Reloading supported %s list") % self.type) + self.logInfo(_("Reloading supported %s list") % self.plugintype) old_supported = self.supported @@ -158,18 +200,24 @@ class MultiHook(Hook): for plugin in old_supported: self.unloadPlugin(plugin) + if self.getConfig("reload", True): + self.interval = max(self.getConfig("reloadinterval", 12), self.MIN_INTERVAL) + else: + self.core.scheduler.removeJob(self.cb) + self.cb = None + def overridePlugins(self): excludedList = [] - if self.type == "hoster": + if self.plugintype == "hoster": pluginMap = dict((name.lower(), name) for name in self.core.pluginManager.hosterPlugins.iterkeys()) accountList = [account.type.lower() for account in self.core.api.getAccounts(False) if account.valid and account.premium] else: pluginMap = {} accountList = [name[::-1].replace("Folder"[::-1], "", 1).lower()[::-1] for name in self.core.pluginManager.crypterPlugins.iterkeys()] - for plugin in self.pluginCached(): + for plugin in self.pluginsCached(): name = remove_chars(plugin, "-.") if name in accountList: @@ -181,42 +229,39 @@ class MultiHook(Hook): self.new_supported.append(plugin) if not self.supported and not self.new_supported: - self.logError(_("No %s loaded") % self.type) + self.logError(_("No %s loaded") % self.plugintype) return - module = self.core.pluginManager.getPlugin(self.__name__) - klass = getattr(module, self.__name__) - # inject plugin plugin - self.logDebug("Overwritten %ss: %s" % (self.type, ", ".join(sorted(self.supported)))) + self.logDebug("Overwritten %ss: %s" % (self.plugintype, ", ".join(sorted(self.supported)))) for plugin in self.supported: - hdict = self.core.pluginManager.plugins[self.type][plugin] - hdict['new_module'] = module - hdict['new_name'] = self.__name__ + hdict = self.core.pluginManager.plugins[self.plugintype][plugin] + hdict['new_module'] = self.pluginmodule + hdict['new_name'] = self.pluginname if excludedList: - self.logInfo(_("%ss not overwritten: %s") % (self.type.capitalize(), ", ".join(sorted(excludedList)))) + self.logInfo(_("%ss not overwritten: %s") % (self.plugintype.capitalize(), ", ".join(sorted(excludedList)))) if self.new_supported: plugins = sorted(self.new_supported) - self.logDebug("New %ss: %s" % (self.type, ", ".join(plugins))) + self.logDebug("New %ss: %s" % (self.plugintype, ", ".join(plugins))) # create new regexp - regexp = r'.*(%s).*' % "|".join([x.replace(".", "\.") for x in plugins]) - if hasattr(klass, "__pattern__") and isinstance(klass.__pattern__, basestring) and '://' in klass.__pattern__: - regexp = r'%s|%s' % (klass.__pattern__, regexp) + regexp = r'.*(?P<DOMAIN>%s).*' % "|".join([x.replace(".", "\.") for x in plugins]) + if hasattr(self.pluginclass, "__pattern__") and isinstance(self.pluginclass.__pattern__, basestring) and '://' in self.pluginclass.__pattern__: + regexp = r'%s|%s' % (self.pluginclass.__pattern__, regexp) self.logDebug("Regexp: %s" % regexp) - hdict = self.core.pluginManager.plugins[self.type][self.__name__] + hdict = self.core.pluginManager.plugins[self.plugintype][self.pluginname] hdict['pattern'] = regexp hdict['re'] = re.compile(regexp) def unloadPlugin(self, plugin): - hdict = self.core.pluginManager.plugins[self.type][plugin] + hdict = self.core.pluginManager.plugins[self.plugintype][plugin] if "module" in hdict: del hdict['module'] @@ -231,18 +276,29 @@ class MultiHook(Hook): self.unloadPlugin(plugin) # reset pattern - klass = getattr(self.core.pluginManager.getPlugin(self.__name__), self.__name__) - hdict = self.core.pluginManager.plugins[self.type][self.__name__] + hdict = self.core.pluginManager.plugins[self.plugintype][self.pluginname] - hdict['pattern'] = getattr(klass, "__pattern__", r'^unmatchable$') + hdict['pattern'] = getattr(self.pluginclass, "__pattern__", r'^unmatchable$') hdict['re'] = re.compile(hdict['pattern']) def downloadFailed(self, pyfile): """remove plugin override if download fails but not if file is offline/temp.offline""" - if pyfile.hasStatus("failed") and self.getConfig("revertfailed", True): - hdict = self.core.pluginManager.plugins[self.type][pyfile.pluginname] - if "new_name" in hdict and hdict['new_name'] == self.__name__: + if pyfile.status != 8 or not self.getConfig("revertfailed", True): + return + + hdict = self.core.pluginManager.plugins[self.plugintype][pyfile.pluginname] + if "new_name" in hdict and hdict['new_name'] == self.pluginname: + if pyfile.error == "MultiHook": self.logDebug("Unload MultiHook", pyfile.pluginname, hdict) self.unloadPlugin(pyfile.pluginname) pyfile.setStatus("queued") + else: + retries = max(self.getConfig("retry", 10), 0) + wait_time = max(self.getConfig("retryinterval", 1), 0) + + if 0 < retries > pyfile.plugin.retries: + pyfile.setCustomStatus("MultiHook", "queued") + pyfile.plugin.retries += 1 + pyfile.plugin.setWait(wait_time) + pyfile.plugin.wait() diff --git a/module/plugins/internal/MultiHoster.py b/module/plugins/internal/MultiHoster.py index 60320399a..8ca4d427f 100644 --- a/module/plugins/internal/MultiHoster.py +++ b/module/plugins/internal/MultiHoster.py @@ -8,7 +8,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo, r class MultiHoster(SimpleHoster): __name__ = "MultiHoster" __type__ = "hoster" - __version__ = "0.29" + __version__ = "0.32" __pattern__ = r'^unmatchable$' @@ -17,12 +17,14 @@ class MultiHoster(SimpleHoster): __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] + CHECK_TRAFFIC = True LOGIN_ACCOUNT = True def setup(self): - self.chunkLimit = 1 - self.multiDL = self.premium + self.chunkLimit = 1 + self.multiDL = bool(self.account) + self.resumeDownload = self.premium def prepare(self): @@ -50,20 +52,8 @@ class MultiHoster(SimpleHoster): def process(self, pyfile): self.prepare() - try: - module = self.core.pluginManager.hosterPlugins[self.__name__]['module'] - klass = getattr(module, self.__name__) - - self.logDebug("File info (BEFORE): %s" % self.info) - self.info.update(klass.getInfo(self.pyfile.url, self.html)) - self.logDebug("File info (AFTER): %s" % self.info) - - except Exception: - self.checkNameSize() - - else: - self.checkNameSize(getinfo=False) - self.checkStatus(getinfo=False) + if self.__pattern__ != r'^unmatchable$' and re.match(self.__pattern__, pyfile.url): + self.checkInfo() if self.directDL: self.logDebug("Looking for direct download link...") @@ -71,24 +61,34 @@ class MultiHoster(SimpleHoster): if not self.link and not self.lastDownload: self.preload() - self.checkInfo() + + self.checkErrors() + self.checkStatus(getinfo=False) if self.premium and (not self.CHECK_TRAFFIC or self.checkTrafficLeft()): self.logDebug("Handled as premium download") - self.handlePremium() - else: + self.handlePremium(pyfile) + + elif not self.LOGIN_ACCOUNT or (not self.CHECK_TRAFFIC or self.checkTrafficLeft()): self.logDebug("Handled as free download") - self.handleFree() + self.handleFree(pyfile) self.downloadLink(self.link) self.checkFile() - def handlePremium(self, pyfile=None): + #@TODO: Remove in 0.4.10 + def downloadLink(self, link): + if link and isinstance(link, basestring): + self.correctCaptcha() + self.download(link, disposition=True) + + + def handlePremium(self, pyfile): return self.handleFree(pyfile) - def handleFree(self, pyfile=None): + def handleFree(self, pyfile): if self.premium: raise NotImplementedError else: diff --git a/module/plugins/internal/SimpleCrypter.py b/module/plugins/internal/SimpleCrypter.py index bfc473801..43b1347fd 100644 --- a/module/plugins/internal/SimpleCrypter.py +++ b/module/plugins/internal/SimpleCrypter.py @@ -12,7 +12,7 @@ from module.utils import fixup class SimpleCrypter(Crypter, SimpleHoster): __name__ = "SimpleCrypter" __type__ = "crypter" - __version__ = "0.37" + __version__ = "0.38" __pattern__ = r'^unmatchable$' __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), #: Overrides core.config['general']['folder_per_package'] @@ -82,6 +82,8 @@ class SimpleCrypter(Crypter, SimpleHoster): def prepare(self): + self.pyfile.error = "" #@TODO: Remove in 0.4.10 + self.info = {} self.links = [] #@TODO: Move to hoster class in 0.4.10 @@ -120,27 +122,28 @@ class SimpleCrypter(Crypter, SimpleHoster): def checkNameSize(self, getinfo=True): - if getinfo: + if not self.info or getinfo: self.logDebug("File info (BEFORE): %s" % self.info) self.info.update(self.getInfo(self.pyfile.url, self.html)) self.logDebug("File info (AFTER): %s" % self.info) try: - name = self.info['name'] url = self.info['url'] - + name = self.info['name'] if name and name != url: self.pyfile.name = name - else: - self.pyfile.name = self.info['name'] = urlparse(name).path.split('/')[-1] except Exception: pass - folder = self.info['folder'] = self.pyfile.name + try: + folder = self.info['folder'] = self.pyfile.name + + except Exception: + pass self.logDebug("File name: %s" % self.pyfile.name, - "File folder: %s" % folder) + "File folder: %s" % self.pyfile.name) def getLinks(self): @@ -153,8 +156,7 @@ class SimpleCrypter(Crypter, SimpleHoster): def handlePages(self, pyfile): try: - m = re.search(self.PAGES_PATTERN, self.html) - pages = int(m.group(1)) + pages = int(re.search(self.PAGES_PATTERN, self.html).group(1)) except: pages = 1 diff --git a/module/plugins/internal/SimpleDereferer.py b/module/plugins/internal/SimpleDereferer.py index 04d63658e..53b80f827 100644 --- a/module/plugins/internal/SimpleDereferer.py +++ b/module/plugins/internal/SimpleDereferer.py @@ -5,13 +5,13 @@ import re from urllib import unquote from module.plugins.Crypter import Crypter -from module.plugins.internal.SimpleHoster import _isDirectLink, set_cookies +from module.plugins.internal.SimpleHoster import directLink, set_cookies class SimpleDereferer(Crypter): __name__ = "SimpleDereferer" __type__ = "crypter" - __version__ = "0.02" + __version__ = "0.03" __pattern__ = r'^unmatchable$' __config__ = [("use_subfolder", "bool", "Save package to subfolder", True), @@ -45,7 +45,7 @@ class SimpleDereferer(Crypter): def decrypt(self, pyfile): - link = _isDirectLink(pyfile.url) + link = directLink(self, pyfile.url) if not link: try: diff --git a/module/plugins/internal/SimpleHoster.py b/module/plugins/internal/SimpleHoster.py index c87a6160f..5a32ac943 100644 --- a/module/plugins/internal/SimpleHoster.py +++ b/module/plugins/internal/SimpleHoster.py @@ -10,6 +10,7 @@ from urlparse import urljoin, urlparse from module.PyFile import statusMap as _statusMap from module.network.CookieJar import CookieJar +from module.network.HTTPRequest import BadHeader from module.network.RequestFactory import getURL from module.plugins.Hoster import Hoster from module.plugins.Plugin import Fail @@ -126,7 +127,7 @@ def timestamp(): #@TODO: Move to hoster class in 0.4.10 -def _isDirectLink(self, url, resumable=False): +def directLink(self, url, resumable=False): link = "" for i in xrange(5 if resumable else 1): @@ -182,7 +183,7 @@ def secondsToMidnight(gmt=0): class SimpleHoster(Hoster): __name__ = "SimpleHoster" __type__ = "hoster" - __version__ = "0.90" + __version__ = "0.94" __pattern__ = r'^unmatchable$' @@ -244,31 +245,46 @@ class SimpleHoster(Hoster): CHECK_TRAFFIC = False #: Set to True to force checking traffic left for premium account DIRECT_LINK = None #: Set to True to looking for direct link (as defined in handleDirect method), set to None to do it if self.account is True else False MULTI_HOSTER = False #: Set to True to leech other hoster link (as defined in handleMulti method) + LOGIN_ACCOUNT = False #: Set to True to require account login + + directLink = directLink #@TODO: Remove in 0.4.10 @classmethod - def parseInfos(cls, urls): + def parseInfos(cls, urls): #@TODO: Built-in in 0.4.10 core, then remove from plugins for url in urls: url = replace_patterns(url, cls.FILE_URL_REPLACEMENTS if hasattr(cls, "FILE_URL_REPLACEMENTS") else cls.URL_REPLACEMENTS) #@TODO: Remove FILE_URL_REPLACEMENTS check in 0.4.10 yield cls.getInfo(url) @classmethod + def apiInfo(cls, url="", get={}, post={}): + url = unquote(url) + return {'name' : (urlparse(url).path.split('/')[-1] + or urlparse(url).query.split('=', 1)[::-1][0].split('&', 1)[0] + or _("Unknown")), + 'size' : 0, + 'status': 3 if url else 8, + 'url' : url} + + + @classmethod def getInfo(cls, url="", html=""): - info = {'name': urlparse(unquote(url)).path.split('/')[-1] or _("Unknown"), 'size': 0, 'status': 3, 'url': url} + info = cls.apiInfo(url) online = False try: - info['pattern'] = re.match(cls.__pattern__, url).groupdict() #: pattern groups will be saved here, please save api stuff to info['api'] + info['pattern'] = re.match(cls.__pattern__, url).groupdict() #: pattern groups will be saved here + except Exception: - pass + info['pattern'] = {} if not html: if not url: info['error'] = "missing url" info['status'] = 1 - else: + elif info['status'] is 3: try: html = getURL(url, cookies=cls.COOKIES, decode=not cls.TEXT_ENCODING) @@ -312,7 +328,7 @@ class SimpleHoster(Hoster): else: online = True - if 'pattern' in info and not info['pattern']: + if not info['pattern']: info.pop('pattern', None) if online: @@ -343,11 +359,16 @@ class SimpleHoster(Hoster): def prepare(self): + self.pyfile.error = "" #@TODO: Remove in 0.4.10 + self.info = {} self.link = "" #@TODO: Move to hoster class in 0.4.10 self.directDL = False #@TODO: Move to hoster class in 0.4.10 self.multihost = False #@TODO: Move to hoster class in 0.4.10 + if self.LOGIN_ACCOUNT and not self.account: + self.fail(_("Required account not found")) + self.req.setOption("timeout", 120) if isinstance(self.COOKIES, list): @@ -397,11 +418,11 @@ class SimpleHoster(Hoster): if self.premium and (not self.CHECK_TRAFFIC or self.checkTrafficLeft()): self.logDebug("Handled as premium download") - self.handlePremium() + self.handlePremium(pyfile) - else: + elif not self.LOGIN_ACCOUNT or (not self.CHECK_TRAFFIC or self.checkTrafficLeft()): self.logDebug("Handled as free download") - self.handleFree() + self.handleFree(pyfile) self.downloadLink(self.link) self.checkFile() @@ -410,7 +431,7 @@ class SimpleHoster(Hoster): def downloadLink(self, link): if link and isinstance(link, basestring): self.correctCaptcha() - self.download(link, disposition=True) + self.download(link, disposition=False) #@TODO: Set `disposition=True` in 0.4.10 def checkFile(self): @@ -420,15 +441,12 @@ class SimpleHoster(Hoster): elif not self.lastDownload or not exists(fs_encode(self.lastDownload)): self.lastDownload = "" - - errmsg = _("No file downloaded") - if 'error' in self.info: - self.fail(errmsg, self.info['error']) - else: - self.fail(errmsg) + self.fail(self.pyfile.error or _("No file downloaded")) else: - rules = {'empty file': re.compile(r"^$")} + rules = {'empty file': re.compile(r'\A\Z'), + 'html file' : re.compile(r'\A\s*<!DOCTYPE html'), + 'html error': re.compile(r'\A\s*(<.+>)?\d{3}(\Z|\s+)')} if hasattr(self, 'ERROR_PATTERN'): rules['error'] = re.compile(self.ERROR_PATTERN) @@ -444,6 +462,10 @@ class SimpleHoster(Hoster): def checkErrors(self): + if not self.html: + self.logWarning(_("No html code to check")) + return + if hasattr(self, 'PREMIUM_ONLY_PATTERN') and self.premium and re.search(self.PREMIUM_ONLY_PATTERN, self.html): self.fail(_("Link require a premium account to be handled")) @@ -465,42 +487,44 @@ class SimpleHoster(Hoster): def checkStatus(self, getinfo=True): - if getinfo: + if not self.info or getinfo: self.logDebug("File info (BEFORE): %s" % self.info) self.info.update(self.getInfo(self.pyfile.url, self.html)) - if 'status' not in self.info: - return + try: + status = self.info['status'] - status = self.info['status'] + if status is 1: + self.offline() - if status is 1: - self.offline() + elif status is 6: + self.tempOffline() - elif status is 6: - self.tempOffline() + elif status is 8: + self.fail() - elif status is not 2: + finally: self.logDebug("File status: %s" % statusMap[status], "File info: %s" % self.info) def checkNameSize(self, getinfo=True): - if getinfo: + if not self.info or getinfo: self.logDebug("File info (BEFORE): %s" % self.info) self.info.update(self.getInfo(self.pyfile.url, self.html)) self.logDebug("File info (AFTER): %s" % self.info) try: - name = self.info['name'] - size = self.info['size'] url = self.info['url'] - + name = self.info['name'] if name and name != url: self.pyfile.name = name - else: - self.pyfile.name = name = self.info['name'] = urlparse(name).path.split('/')[-1] + except Exception: + pass + + try: + size = self.info['size'] if size > 0: self.pyfile.size = size @@ -529,7 +553,7 @@ class SimpleHoster(Hoster): def handleDirect(self, pyfile): - link = _isDirectLink(self, pyfile.url, self.resumeDownload) + link = self.directLink(pyfile.url, self.resumeDownload) if link: self.logInfo(_("Direct download link detected")) @@ -543,9 +567,9 @@ class SimpleHoster(Hoster): pass - def handleFree(self, pyfile=None): + def handleFree(self, pyfile): if not hasattr(self, 'LINK_FREE_PATTERN'): - self.fail(_("Free download not implemented")) + self.logError(_("Free download not implemented")) try: m = re.search(self.LINK_FREE_PATTERN, self.html) @@ -558,9 +582,11 @@ class SimpleHoster(Hoster): self.fail(e) - def handlePremium(self, pyfile=None): + def handlePremium(self, pyfile): if not hasattr(self, 'LINK_PREMIUM_PATTERN'): - self.fail(_("Premium download not implemented")) + self.logError(_("Premium download not implemented")) + self.logDebug("Handled as free download") + self.handleFree(pyfile) try: m = re.search(self.LINK_PREMIUM_PATTERN, self.html) diff --git a/module/plugins/internal/XFSAccount.py b/module/plugins/internal/XFSAccount.py index 2784ecd0b..c350729ac 100644 --- a/module/plugins/internal/XFSAccount.py +++ b/module/plugins/internal/XFSAccount.py @@ -12,7 +12,7 @@ from module.plugins.internal.SimpleHoster import parseHtmlForm, set_cookies class XFSAccount(Account): __name__ = "XFSAccount" __type__ = "account" - __version__ = "0.33" + __version__ = "0.35" __description__ = """XFileSharing account plugin""" __license__ = "GPLv3" @@ -35,7 +35,7 @@ class XFSAccount(Account): LEECH_TRAFFIC_PATTERN = r'Leech Traffic left:<b>.*?(?P<S>[\d.,]+|[Uu]nlimited)\s*(?:(?P<U>[\w^_]+)\s*)?</b>' LEECH_TRAFFIC_UNIT = "MB" #: used only if no group <U> was found - LOGIN_FAIL_PATTERN = r'>\s*(Incorrect Login or Password|Error<)' + LOGIN_FAIL_PATTERN = r'Incorrect Login or Password|account was banned|Error<' def __init__(self, manager, accounts): #@TODO: remove in 0.4.10 @@ -48,7 +48,7 @@ class XFSAccount(Account): self.logError(_("Missing HOSTER_DOMAIN")) if not self.HOSTER_URL: - self.HOSTER_URL = "http://www.%s/" % self.HOSTER_DOMAIN or "" + self.HOSTER_URL = "http://www.%s/" % (self.HOSTER_DOMAIN or "") def loadAccountInfo(self, user, req): @@ -76,10 +76,10 @@ class XFSAccount(Account): self.logDebug("Valid until: %s" % validuntil) if validuntil > mktime(gmtime()): - premium = True + premium = True trafficleft = -1 else: - premium = False + premium = False validuntil = None #: registered account type (not premium) else: self.logDebug("VALID_UNTIL_PATTERN not found") @@ -143,7 +143,7 @@ class XFSAccount(Account): if isinstance(self.COOKIES, list): set_cookies(req.cj, self.COOKIES) - url = urljoin(self.HOSTER_URL, "login.html") + url = urljoin(self.HOSTER_URL, "login.html") html = req.load(url, decode=True) action, inputs = parseHtmlForm('name="FL"', html) diff --git a/module/plugins/internal/XFSCrypter.py b/module/plugins/internal/XFSCrypter.py index 4b57dab90..3cb837aac 100644 --- a/module/plugins/internal/XFSCrypter.py +++ b/module/plugins/internal/XFSCrypter.py @@ -16,7 +16,6 @@ class XFSCrypter(SimpleCrypter): HOSTER_DOMAIN = None - HOSTER_NAME = None URL_REPLACEMENTS = [(r'&?per_page=\d+', ""), (r'[?/&]+$', ""), (r'(.+/[^?]+)$', r'\1?'), (r'$', r'&per_page=10000')] diff --git a/module/plugins/internal/XFSHoster.py b/module/plugins/internal/XFSHoster.py index e15504d16..b32f5978f 100644 --- a/module/plugins/internal/XFSHoster.py +++ b/module/plugins/internal/XFSHoster.py @@ -15,7 +15,7 @@ from module.utils import html_unescape class XFSHoster(SimpleHoster): __name__ = "XFSHoster" __type__ = "hoster" - __version__ = "0.34" + __version__ = "0.35" __pattern__ = r'^unmatchable$' @@ -27,7 +27,6 @@ class XFSHoster(SimpleHoster): HOSTER_DOMAIN = None - HOSTER_NAME = None TEXT_ENCODING = False COOKIES = [(HOSTER_DOMAIN, "lang", "english")] @@ -66,9 +65,6 @@ class XFSHoster(SimpleHoster): if not self.HOSTER_DOMAIN: self.fail(_("Missing HOSTER_DOMAIN")) - if not self.HOSTER_NAME: - self.HOSTER_NAME = "".join([str.capitalize() for str in self.HOSTER_DOMAIN.split('.')]) - if not self.LINK_PATTERN: pattern = r'(https?://(www\.)?([^/]*?%s|\d+\.\d+\.\d+\.\d+)(\:\d+)?(/d/|(/files)?/\d+/\w+/).+?)["\'<]' self.LINK_PATTERN = pattern % self.HOSTER_DOMAIN.replace('.', '\.') @@ -82,14 +78,12 @@ class XFSHoster(SimpleHoster): self.directDL = bool(self.premium) - def handleFree(self, pyfile=None): - link = self.getDownloadLink() - - if link: + def downloadLink(self, link): + if link and isinstance(link, basestring): if self.captcha: self.correctCaptcha() - self.download(link, ref=True, cookies=True, disposition=True) + self.download(link, ref=True, cookies=True, disposition=False) #@TODO: Set `disposition=True` in 0.4.10 elif self.errmsg: if 'captcha' in self.errmsg: @@ -101,11 +95,7 @@ class XFSHoster(SimpleHoster): self.fail(_("Download link not found")) - def handlePremium(self, pyfile=None): - return self.handleFree(pyfile) - - - def getDownloadLink(self): + def handleFree(self, pyfile): for i in xrange(1, 6): self.logDebug("Getting download link: #%d" % i) @@ -119,7 +109,7 @@ class XFSHoster(SimpleHoster): self.req.http.c.setopt(FOLLOWLOCATION, 0) - self.html = self.load(self.pyfile.url, post=data, ref=True, decode=True) + self.html = self.load(pyfile.url, post=data, ref=True, decode=True) self.req.http.c.setopt(FOLLOWLOCATION, 1) @@ -136,7 +126,11 @@ class XFSHoster(SimpleHoster): self.errmsg = None - return m.group(1).strip() #@TODO: Remove .strip() in 0.4.10 + self.link = m.group(1).strip() #@TODO: Remove .strip() in 0.4.10 + + + def handlePremium(self, pyfile): + return self.handleFree(pyfile) def handleMulti(self, pyfile): |